Files
Purpur/patches/server/0162-Configurable-mob-blindness.patch
granny 0458d847e2 Updated Upstream (Paper & Pufferfish)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@44ee1cd fix recipe packet limiter (#9841)
PaperMC/Paper@e57af7d sync netty version with vanilla (#9842)

Pufferfish Changes:
pufferfish-gg/Pufferfish@0020a8b Port a patch from upstream
pufferfish-gg/Pufferfish@979d3a2 Update upstream (last 1.20.1)
pufferfish-gg/Pufferfish@06262c1 Initial 1.20.2 update
2023-10-16 04:52:01 -07:00

50 lines
3.2 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] Configurable mob blindness
Ported from https://github.com/raltsmc/mobblindness
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6f6f6610c27c738db440d7be747f0be2296f2815..f7bd53e548ea2f57f697b143b58b6d2e21371366 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1036,6 +1036,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.PIGLIN && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.PIGLIN_BRUTE && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
d0 *= 0.5D;
}
+
+ // Purpur start
+ if (entity instanceof LivingEntity entityliving) {
+ if (entityliving.hasEffect(MobEffects.BLINDNESS)) {
+ int amplifier = entityliving.getEffect(MobEffects.BLINDNESS).getAmplifier();
+ for (int i = 0; i < amplifier; i++) {
+ d0 *= this.level().purpurConfig.mobsBlindnessMultiplier;
+ }
+ }
+ }
+ // Purpur end
}
return d0;
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 99c7e2ff1dfdb7e9bb755c6081232c1c64c96396..01b3d8263d24f6b58da087c751c001a6bd5c723c 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -132,6 +132,7 @@ public class PurpurWorldConfig {
public boolean persistentDroppableEntityDisplayNames = true;
public boolean projectilesBypassMobGriefing = false;
public boolean tickFluids = true;
+ public double mobsBlindnessMultiplier = 1;
public double tridentLoyaltyVoidReturnHeight = 0.0D;
public double voidDamageHeight = -64.0D;
public double voidDamageDealt = 4.0D;
@@ -152,6 +153,7 @@ public class PurpurWorldConfig {
persistentDroppableEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-droppable-entity-display-names", persistentDroppableEntityDisplayNames);
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
tickFluids = getBoolean("gameplay-mechanics.tick-fluids", tickFluids);
+ mobsBlindnessMultiplier = getDouble("gameplay-mechanics.entity-blindness-multiplier", mobsBlindnessMultiplier);
tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
voidDamageHeight = getDouble("gameplay-mechanics.void-damage-height", voidDamageHeight);
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);