Files
Purpur/patches/server/0123-Toggle-for-Zombified-Piglin-death-always-counting-as.patch
Ben Kerllenevich 9e5a8b1937 drop patches
2021-11-25 12:41:01 -05:00

56 lines
3.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
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/ZombifiedPiglin.java b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
index 76f1bbec2b8ebe037de65ee5ec718e17a6081c13..f8b742ee8e637edd8e8b05aff2fcc7a75afe959a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
@@ -138,7 +138,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
this.maybeAlertOthers();
}
- if (this.isAngry()) {
+ if (this.isAngry() && this.level.purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) { // Purpur
this.lastHurtByPlayerTime = this.tickCount;
}
@@ -193,7 +193,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
this.ticksUntilNextAlert = ZombifiedPiglin.ALERT_INTERVAL.sample(this.random);
}
- if (entityliving instanceof Player) {
+ if (entityliving instanceof Player && this.level.purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) { // Purpur
this.setLastHurtByPlayer((Player) entityliving);
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 459f48b3bf3667b6768a05496b9fb564ed1af09d..18bb80875573b5bb35ab9ec448dcb3992407a56d 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -1860,6 +1860,7 @@ 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);
@@ -1873,5 +1874,6 @@ public class PurpurWorldConfig {
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);
}
}