mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
64 lines
2.9 KiB
Diff
64 lines
2.9 KiB
Diff
From d2c8b1879fd458f8cdc7a0679c9ce2ec2e3fb300 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 8d57c5f1b5..1c3be1c2c0 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.i((EntityLiving) entity);
|
|
}
|
|
|
|
@@ -157,7 +158,7 @@ public class EntityPigZombie extends EntityZombie {
|
|
this.angerLevel = event.getNewAnger();
|
|
// CraftBukkit end
|
|
this.soundDelay = this.random.nextInt(40);
|
|
- this.setLastDamager(entityliving);
|
|
+ if (!net.pl3x.purpur.PurpurConfig.pigmenDontTargetUnlessHit) this.setLastDamager(entityliving); // Purpur - fix MC-56653
|
|
return true;
|
|
}
|
|
|
|
@@ -204,6 +205,12 @@ public class EntityPigZombie extends EntityZombie {
|
|
return this.eA();
|
|
}
|
|
|
|
+ // 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 f0ed3c9749..8a875a5764 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.24.0.rc1
|
|
|