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/world/entity/monster/EntityPigZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityPigZombie.java index 9f50054211db48e7fe764434e8d71aab0995e57a..82279ab2f3c1edec14c24c3a7ad24d097d52dea2 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EntityPigZombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/EntityPigZombie.java @@ -130,7 +130,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; } @@ -185,7 +185,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 efe82464beb6741413b73bbd6adc5c45eba7bcd6..7d32788c5e538be6eff9b6ff4655f279ac1e0e6b 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -1268,12 +1268,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;