From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: jmp Date: Sat, 5 Dec 2020 02:34:22 -0800 Subject: [PATCH] Toggle for Zombified Piglin death always counting as player kill when angry In Vanilla (as of 1.16.4), when Zombified Piglins die while angry, it will count as a player kill regardless of whether a player has ever hit them, meaning they will drop XP. This is abused in Zombified Piglin farms where the player kills the entities through cramming, but they still drop XP due to the Piglin being angry, even though the player never hit them. This patch adds a toggle to disable this behavior. diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java index 3327dbbf8..57f3358b8 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -95,7 +95,7 @@ public class EntityPigZombie extends EntityZombie implements IEntityAngerable { this.eY(); } - if (this.isAngry()) { + if (this.isAngry() && this.world.purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) { // Purpur this.lastDamageByPlayerTime = this.ticksLived; } @@ -150,7 +150,7 @@ public class EntityPigZombie extends EntityZombie implements IEntityAngerable { this.bt = EntityPigZombie.bs.a(this.random); } - if (entityliving instanceof EntityHuman) { + if (entityliving instanceof EntityHuman && this.world.purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) { // Purpur this.e((EntityHuman) entityliving); } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index 7c740f643..f24e12718 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -1190,12 +1190,14 @@ public class PurpurWorldConfig { public boolean zombifiedPiglinJockeyOnlyBaby = true; public double zombifiedPiglinJockeyChance = 0.05D; public boolean zombifiedPiglinJockeyTryExistingChickens = true; + public boolean zombifiedPiglinCountAsPlayerKillWhenAngry = true; private void zombifiedPiglinSettings() { zombifiedPiglinRidable = getBoolean("mobs.zombified_piglin.ridable", zombifiedPiglinRidable); zombifiedPiglinRidableInWater = getBoolean("mobs.zombified_piglin.ridable-in-water", zombifiedPiglinRidableInWater); zombifiedPiglinJockeyOnlyBaby = getBoolean("mobs.zombified_piglin.jockey.only-babies", zombifiedPiglinJockeyOnlyBaby); zombifiedPiglinJockeyChance = getDouble("mobs.zombified_piglin.jockey.chance", zombifiedPiglinJockeyChance); zombifiedPiglinJockeyTryExistingChickens = getBoolean("mobs.zombified_piglin.jockey.try-existing-chickens", zombifiedPiglinJockeyTryExistingChickens); + zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry); } public boolean zombieVillagerRidable = false;