aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch
new file mode 100644
index 0000000000..ca4080c2ed
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch
@@ -0,0 +1,68 @@
+--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
++++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+@@ -142,15 +140,18 @@
+ }
+
+ private void alertOthers() {
+- double attributeValue = this.getAttributeValue(Attributes.FOLLOW_RANGE);
+- AABB aABB = AABB.unitCubeFromLowerCorner(this.position()).inflate(attributeValue, 10.0, attributeValue);
+- this.level()
+- .getEntitiesOfClass(ZombifiedPiglin.class, aABB, EntitySelector.NO_SPECTATORS)
+- .stream()
+- .filter(zombifiedPiglin -> zombifiedPiglin != this)
+- .filter(zombifiedPiglin -> zombifiedPiglin.getTarget() == null)
+- .filter(zombifiedPiglin -> !zombifiedPiglin.isAlliedTo(this.getTarget()))
+- .forEach(zombifiedPiglin -> zombifiedPiglin.setTarget(this.getTarget()));
++ double d0 = this.getAttributeValue(Attributes.FOLLOW_RANGE);
++ AABB axisalignedbb = AABB.unitCubeFromLowerCorner(this.position()).inflate(d0, 10.0D, d0);
++
++ 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
++ });
+ }
+
+ private void playAngerSound() {
+@@ -158,22 +159,31 @@
+ }
+
+ @Override
+- public void setTarget(@Nullable LivingEntity livingEntity) {
+- if (this.getTarget() == null && livingEntity != null) {
+- this.playFirstAngerSoundIn = FIRST_ANGER_SOUND_DELAY.sample(this.random);
+- this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random);
++ 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);
+ }
+
+ if (livingEntity instanceof Player) {
+ this.setLastHurtByPlayer((Player)livingEntity);
+ }
+
+- super.setTarget(livingEntity);
++ return super.setTarget(entityliving, reason, fireEvent); // CraftBukkit
+ }
+
+ @Override
+ public void startPersistentAngerTimer() {
+- this.setRemainingPersistentAngerTime(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(