diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch new file mode 100644 index 0000000000..92f5c3d734 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch @@ -0,0 +1,62 @@ +--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java ++++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java +@@ -148,14 +143,14 @@ + double d0 = this.getAttributeValue(Attributes.FOLLOW_RANGE); + AABB aabb = AABB.unitCubeFromLowerCorner(this.position()).inflate(d0, 10.0D, d0); + +- this.level().getEntitiesOfClass(ZombifiedPiglin.class, aabb, EntitySelector.NO_SPECTATORS).stream().filter((zombifiedpiglin) -> { +- return zombifiedpiglin != this; +- }).filter((zombifiedpiglin) -> { +- return zombifiedpiglin.getTarget() == null; +- }).filter((zombifiedpiglin) -> { +- return !zombifiedpiglin.isAlliedTo((Entity) this.getTarget()); +- }).forEach((zombifiedpiglin) -> { +- zombifiedpiglin.setTarget(this.getTarget()); ++ this.level().getEntitiesOfClass(ZombifiedPiglin.class, axisalignedbb, EntitySelector.NO_SPECTATORS).stream().filter((entitypigzombie) -> { ++ return entitypigzombie != this; ++ }).filter((entitypigzombie) -> { ++ return entitypigzombie.getTarget() == null; ++ }).filter((entitypigzombie) -> { ++ return !entitypigzombie.isAlliedTo((Entity) this.getTarget()); ++ }).forEach((entitypigzombie) -> { ++ entitypigzombie.setTarget(this.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit + }); + } + +@@ -164,9 +159,8 @@ + } + + @Override +- @Override +- public void setTarget(@Nullable LivingEntity livingentity) { +- if (this.getTarget() == null && livingentity != null) { ++ public boolean setTarget(@Nullable LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { // CraftBukkit - signature ++ if (this.getTarget() == null && entityliving != null) { + this.playFirstAngerSoundIn = ZombifiedPiglin.FIRST_ANGER_SOUND_DELAY.sample(this.random); + this.ticksUntilNextAlert = ZombifiedPiglin.ALERT_INTERVAL.sample(this.random); + } +@@ -175,13 +169,22 @@ + this.setLastHurtByPlayer((Player) livingentity); + } + +- super.setTarget(livingentity); ++ return super.setTarget(entityliving, reason, fireEvent); // CraftBukkit + } + + @Override + @Override + public void startPersistentAngerTimer() { +- this.setRemainingPersistentAngerTime(ZombifiedPiglin.PERSISTENT_ANGER_TIME.sample(this.random)); ++ // CraftBukkit start ++ Entity entity = ((ServerLevel) this.level()).getEntity(getPersistentAngerTarget()); ++ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), ZombifiedPiglin.PERSISTENT_ANGER_TIME.sample(this.random)); ++ this.level().getCraftServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ this.setPersistentAngerTarget(null); ++ return; ++ } ++ this.setRemainingPersistentAngerTime(event.getNewAnger()); ++ // CraftBukkit end + } + + public static boolean checkZombifiedPiglinSpawnRules(EntityType<ZombifiedPiglin> entitytype, LevelAccessor levelaccessor, MobSpawnType mobspawntype, BlockPos blockpos, RandomSource randomsource) { |