Configurable mob blindness

Ported from https://github.com/raltsmc/mobblindness
This commit is contained in:
Encode42
2025-01-11 18:41:14 -08:00
committed by granny
parent 9548eb8885
commit facd3e2900
3 changed files with 20 additions and 49 deletions

View File

@@ -31,6 +31,24 @@
}
} else if (this.getAirSupply() < this.getMaxAirSupply()) {
this.setAirSupply(this.increaseAirSupply(this.getAirSupply()));
@@ -1018,6 +_,17 @@
}
}
+ // Purpur start - Configurable mob blindness
+ if (lookingEntity instanceof LivingEntity entityliving) {
+ if (entityliving.hasEffect(MobEffects.BLINDNESS)) {
+ int amplifier = entityliving.getEffect(MobEffects.BLINDNESS).getAmplifier();
+ for (int i = 0; i < amplifier; i++) {
+ d *= this.level().purpurConfig.mobsBlindnessMultiplier;
+ }
+ }
+ }
+ // Purpur end - Configurable mob blindness
+
return d;
}
@@ -1372,6 +_,24 @@
this.stopSleeping();
}

View File

@@ -130,6 +130,7 @@ public class PurpurWorldConfig {
public boolean imposeTeleportRestrictionsOnNetherPortals = false;
public boolean imposeTeleportRestrictionsOnEndPortals = false;
public boolean tickFluids = true;
public double mobsBlindnessMultiplier = 1;
private void miscGameplayMechanicsSettings() {
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
@@ -150,6 +151,7 @@ public class PurpurWorldConfig {
imposeTeleportRestrictionsOnNetherPortals = getBoolean("gameplay-mechanics.impose-teleport-restrictions-on-nether-portals", imposeTeleportRestrictionsOnNetherPortals);
imposeTeleportRestrictionsOnEndPortals = getBoolean("gameplay-mechanics.impose-teleport-restrictions-on-end-portals", imposeTeleportRestrictionsOnEndPortals);
tickFluids = getBoolean("gameplay-mechanics.tick-fluids", tickFluids);
mobsBlindnessMultiplier = getDouble("gameplay-mechanics.entity-blindness-multiplier", mobsBlindnessMultiplier);
}
public int daytimeTicks = 12000;