3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 07:10:10 +01:00
Paper/nms-patches/EntityPigZombie.patch

43 Zeilen
1.9 KiB
Diff

--- a/net/minecraft/server/EntityPigZombie.java
+++ b/net/minecraft/server/EntityPigZombie.java
2019-06-21 12:00:00 +02:00
@@ -134,16 +134,27 @@
} else {
Entity entity = damagesource.getEntity();
2019-06-21 12:00:00 +02:00
- if (entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
+ // CraftBukkit start
+ boolean result = super.damageEntity(damagesource, f);
+
2019-06-21 12:00:00 +02:00
+ if (result && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
2019-12-10 23:00:00 +01:00
this.i((EntityLiving) entity);
}
- return super.damageEntity(damagesource, f);
+ return result;
+ // CraftBukkit end
}
}
2019-12-10 23:00:00 +01:00
private boolean i(EntityLiving entityliving) {
- this.angerLevel = this.ez();
+ // CraftBukkit start
2019-12-10 23:00:00 +01:00
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entityliving == null) ? null : entityliving.getBukkitEntity(), this.ez());
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
2019-06-21 12:00:00 +02:00
+ return false;
+ }
+ this.angerLevel = event.getNewAnger();
+ // CraftBukkit end
this.soundDelay = this.random.nextInt(40);
2019-12-10 23:00:00 +01:00
this.setLastDamager(entityliving);
return true;
@@ -209,7 +220,7 @@
@Override
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
2019-12-10 23:00:00 +01:00
if (entityinsentient instanceof EntityPigZombie && this.e.hasLineOfSight(entityliving) && ((EntityPigZombie) entityinsentient).i(entityliving)) {
- entityinsentient.setGoalTarget(entityliving);
+ entityinsentient.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
}
}