mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
64 lines
2.9 KiB
Diff
64 lines
2.9 KiB
Diff
From ba8da9b4384da86598467168816372d701a9ffcf 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/PurpurConfig.java | 5 +++++
|
|
2 files changed, 13 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
|
|
index 5760a1836..54ccc93f1 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
|
|
@@ -139,6 +139,7 @@ public class EntityPigZombie extends EntityZombie {
|
|
boolean result = super.damageEntity(damagesource, f);
|
|
|
|
if (result && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
|
|
+ if (net.pl3x.purpur.PurpurConfig.pigmenDontTargetUnlessHit) this.setLastDamager((EntityHuman) entity); // Purpur - fix MC-56653
|
|
this.a(entity);
|
|
}
|
|
|
|
@@ -158,7 +159,7 @@ public class EntityPigZombie extends EntityZombie {
|
|
// CraftBukkit end
|
|
this.soundDelay = this.random.nextInt(40);
|
|
if (entity instanceof EntityLiving) {
|
|
- this.setLastDamager((EntityLiving) entity);
|
|
+ if (!net.pl3x.purpur.PurpurConfig.pigmenDontTargetUnlessHit) this.setLastDamager((EntityLiving) entity); // Purpur - fix MC-56653
|
|
}
|
|
|
|
return true;
|
|
@@ -207,6 +208,12 @@ public class EntityPigZombie extends EntityZombie {
|
|
return this.ef();
|
|
}
|
|
|
|
+ // Purpur start - fix MC-56653
|
|
+ protected boolean isDropExperience() {
|
|
+ return super.isDropExperience() && (!net.pl3x.purpur.PurpurConfig.pigmenDontTargetUnlessHit || getLastDamager() instanceof EntityHuman);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
static class PathfinderGoalAnger extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
|
|
|
public PathfinderGoalAnger(EntityPigZombie entitypigzombie) {
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
index f0ed3c974..8a875a576 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -200,6 +200,11 @@ public class PurpurConfig {
|
|
phantomsOrbitCrystalsRadius = getDouble("settings.mobs.phantom.orbit-crystal-radius", phantomsOrbitCrystalsRadius);
|
|
}
|
|
|
|
+ public static boolean pigmenDontTargetUnlessHit = false;
|
|
+ private static void pigmenSettings() {
|
|
+ pigmenDontTargetUnlessHit = getBoolean("settings.mobs.pigmen.dont-target-unless-hit", pigmenDontTargetUnlessHit);
|
|
+ }
|
|
+
|
|
public static boolean snowmanDropsPumpkin = false;
|
|
public static boolean snowmanPumpkinPutBack = false;
|
|
private static void snowmansSettings() {
|
|
--
|
|
2.23.0.rc1
|
|
|