mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
47 lines
2.4 KiB
Diff
47 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Encode42 <me@encode42.dev>
|
|
Date: Tue, 11 May 2021 21:00:53 -0400
|
|
Subject: [PATCH] Implement Mob Blindness
|
|
|
|
Ported from https://github.com/raltsmc/mobblindness
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
index 89ae9836b0712ae78a8dfefe688d95d53b1156e2..314516477a07ada0cc44f1d8826c9724be85e1a1 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
@@ -922,6 +922,18 @@ public abstract class EntityLiving extends Entity {
|
|
if (entitytypes == EntityTypes.SKELETON && item == Items.SKELETON_SKULL || entitytypes == EntityTypes.ZOMBIE && item == Items.ZOMBIE_HEAD || entitytypes == EntityTypes.CREEPER && item == Items.CREEPER_HEAD) {
|
|
d0 *= 0.5D;
|
|
}
|
|
+
|
|
+ // Purpur start
|
|
+ if (entity instanceof EntityLiving) {
|
|
+ EntityLiving livingEntity = (EntityLiving) entity;
|
|
+ if (livingEntity.hasEffect(MobEffects.BLINDNESS)) {
|
|
+ int amplifier = livingEntity.getEffect(MobEffects.BLINDNESS).getAmplifier();
|
|
+ for (int i = 0; i < amplifier; i++) {
|
|
+ d0 *= world.purpurConfig.mobsBlindnessMultiplier;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
|
|
return d0;
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 07c66f9d41e7a74021dde6702d654710e400e93b..b8622f687b4fd70aaee5fa44cc50b8ee38582582 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -542,6 +542,11 @@ public class PurpurWorldConfig {
|
|
mobsSpawnOnBlueIce = getBoolean("blocks.blue_ice.allow-mob-spawns", mobsSpawnOnBlueIce);
|
|
}
|
|
|
|
+ public double mobsBlindnessMultiplier = 1;
|
|
+ private void blindnessSettings() {
|
|
+ mobsBlindnessMultiplier = getDouble("gameplay-mechanics.entity-blindness-multiplier", mobsBlindnessMultiplier);
|
|
+ }
|
|
+
|
|
public boolean chestOpenWithBlockOnTop = false;
|
|
private void chestSettings() {
|
|
chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
|