Files
Purpur/patches/server/0206-Implement-Mob-Blindness.patch
Ben Kerllenevich 72895cb7b4 Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
0daded2f2 Add more line of sight methods (#5749)
8fd4e70db Improve seed based feature search to not load chunk (#5760)
7ad8498c3 Make item validations configurable (#5775)
3673d6758 Fix Cannot be adventure component serialized when the legacy component is null (#5754)
afb0748a2 [Auto] Updated Upstream (Bukkit)
7d751ad8d Fix dangerous end portal logic (#5776)
12716324d Do not tick Chunk TickS for every chunk
af1a50993 [Auto] Updated Upstream (CraftBukkit)

Tuinity Changes:
2683c775c Use area map for nearby players in mob spawning (#283)
2021-06-05 07:18:48 -04:00

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 379782d5dcb212419c8df2a9a534749b3bd63f21..fa8df6ecede6ecb207e0e3390cc96c72d71a8a18 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);