Files
Purpur/patches/server/0038-Fix-pig-zombies-MC-56653.patch
William Blake Galbreath 4757060211 Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
df0d7b0d Update upstream CB
6ea3c2cf [CI-SKIP] Rebuild patches
d7bed4cb Heavily optimise random block ticking (#2914)
b66d9ff8 Update upstream CB
ba71c5d6 Stop stripping private use block Unicode from signs
28d9dcfc Entity Jump API (#1587)
9976a768 Fix PlayerNaturallySpawnCreaturesEvent boolean inversion
054e20da Clean up imports on ThrownEggHatchEvent
a8984ccb Add ThrownEggHatchEvent (#1982)
9f24d495 Allow nerfed blazes, endermen to take water damage (#2847)
2020-02-12 21:21:34 -06:00

65 lines
3.2 KiB
Diff

From 66b0d01874ce9969852d99bd8b92376f035b5447 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Tue, 9 Jul 2019 20:56:47 -0500
Subject: [PATCH] Fix pig zombies (MC-56653)
---
src/main/java/net/minecraft/server/EntityPigZombie.java | 9 ++++++++-
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index fb9ef88ea..227fff3f1 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -155,6 +155,7 @@ public class EntityPigZombie extends EntityZombie {
boolean result = super.damageEntity(damagesource, f);
if (result && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
+ if (world.purpurConfig.zombiePigmanDontTargetUnlessHit) this.setLastDamager((EntityHuman) entity); // Purpur - fix MC-56653
this.i((EntityLiving) entity);
}
@@ -173,7 +174,7 @@ public class EntityPigZombie extends EntityZombie {
this.angerLevel = event.getNewAnger();
// CraftBukkit end
this.soundDelay = this.random.nextInt(40);
- this.setLastDamager(entityliving);
+ if (!world.purpurConfig.zombiePigmanDontTargetUnlessHit) this.setLastDamager(entityliving); // Purpur - fix MC-56653
return true;
}
@@ -215,6 +216,12 @@ public class EntityPigZombie extends EntityZombie {
return this.eA();
}
+ // Purpur start - fix MC-56653
+ protected boolean isDropExperience() {
+ return super.isDropExperience() && (!world.purpurConfig.zombiePigmanDontTargetUnlessHit || getLastDamager() instanceof EntityHuman);
+ }
+ // Purpur end
+
static class PathfinderGoalAnger extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
public PathfinderGoalAnger(EntityPigZombie entitypigzombie) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index be2f6bac1..e660121df 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -774,10 +774,12 @@ public class PurpurWorldConfig {
public boolean zombiePigmanRidable = false;
public boolean zombiePigmanRidableInWater = false;
public boolean zombiePigmanRequireShiftToMount = true;
+ public boolean zombiePigmanDontTargetUnlessHit = false;
private void zombiePigmanSettings() {
zombiePigmanRidable = getBoolean("mobs.zombie_pigman.ridable", zombiePigmanRidable);
zombiePigmanRidableInWater = getBoolean("mobs.zombie_pigman.ridable-in-water", zombiePigmanRidableInWater);
zombiePigmanRequireShiftToMount = getBoolean("mobs.zombie_pigman.require-shift-to-mount", zombiePigmanRequireShiftToMount);
+ zombiePigmanDontTargetUnlessHit = getBoolean("mobs.zombie_pigman.dont-target-unless-hit", zombiePigmanDontTargetUnlessHit);
}
public boolean zombieVillagerRidable = false;
--
2.24.0