Files
Purpur/patches/server/0157-Toggle-for-Zombified-Piglin-death-always-counting-as.patch
BillyGalbreath ef0b93df2e Rebuild patches
2020-12-12 18:19:48 -06:00

56 lines
3.2 KiB
Diff

From c1037da9028a5f62259b39184b7abc83adefb735 Mon Sep 17 00:00:00 2001
From: jmp <jasonpenilla2@me.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/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index 3327dbbf87d8f43cbc7cd728df2f4c6a33dae40d..57f3358b8dfd53f5b1d2e976d64b809f74bc3ce3 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 7c740f643c3c7459b0071c9d303528aef800334f..f24e1271878d6bfcccd11fbadfb4578ae62cb722 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;