2018-08-01 11:29:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityPigZombie.java
|
|
|
|
+++ b/net/minecraft/server/EntityPigZombie.java
|
2020-06-25 02:00:00 +02:00
|
|
|
@@ -35,7 +35,7 @@
|
|
|
|
protected void m() {
|
|
|
|
this.goalSelector.a(2, new PathfinderGoalZombieAttack(this, 1.0D, false));
|
|
|
|
this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D));
|
|
|
|
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
|
|
|
|
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this).a(new Class[0])); // CraftBukkit - decompile error
|
|
|
|
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::b));
|
|
|
|
this.targetSelector.a(3, new PathfinderGoalUniversalAngerReset<>(this, true));
|
|
|
|
}
|
|
|
|
@@ -108,7 +108,7 @@
|
|
|
|
}).filter((entitypigzombie) -> {
|
|
|
|
return !entitypigzombie.r(this.getGoalTarget());
|
|
|
|
}).forEach((entitypigzombie) -> {
|
|
|
|
- entitypigzombie.setGoalTarget(this.getGoalTarget());
|
|
|
|
+ entitypigzombie.setGoalTarget(this.getGoalTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
|
|
|
|
});
|
2018-08-01 11:29:24 +02:00
|
|
|
}
|
|
|
|
|
2020-07-03 02:11:34 +02:00
|
|
|
@@ -117,7 +117,7 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
- public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
|
|
|
+ public boolean setGoalTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { // CraftBukkit - signature
|
|
|
|
if (this.getGoalTarget() == null && entityliving != null) {
|
|
|
|
this.bv = EntityPigZombie.d.a(this.random);
|
|
|
|
this.bA = EntityPigZombie.bz.a(this.random);
|
|
|
|
@@ -127,12 +127,21 @@
|
|
|
|
this.e((EntityHuman) entityliving);
|
|
|
|
}
|
|
|
|
|
|
|
|
- super.setGoalTarget(entityliving);
|
|
|
|
+ return super.setGoalTarget(entityliving, reason, fireEvent); // CraftBukkit
|
|
|
|
}
|
2020-06-25 02:00:00 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void anger() {
|
|
|
|
- this.setAnger(EntityPigZombie.bw.a(this.random));
|
2018-08-05 02:18:01 +02:00
|
|
|
+ // CraftBukkit start
|
2020-06-25 02:00:00 +02:00
|
|
|
+ Entity entity = ((WorldServer) this.world).getEntity(getAngerTarget());
|
|
|
|
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), EntityPigZombie.bw.a(this.random));
|
2018-08-05 02:18:01 +02:00
|
|
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
|
|
+ if (event.isCancelled()) {
|
2020-06-25 02:00:00 +02:00
|
|
|
+ this.setAngerTarget(null);
|
|
|
|
+ return;
|
2018-08-05 02:18:01 +02:00
|
|
|
+ }
|
2020-06-25 02:00:00 +02:00
|
|
|
+ this.setAnger(event.getNewAnger());
|
2018-08-05 02:18:01 +02:00
|
|
|
+ // CraftBukkit end
|
2020-06-25 02:00:00 +02:00
|
|
|
}
|
2019-06-23 01:14:01 +02:00
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
public static boolean b(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {
|