diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/warden/AngerManagement.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/warden/AngerManagement.java.patch new file mode 100644 index 0000000000..12bd7bec5a --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/warden/AngerManagement.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/entity/monster/warden/AngerManagement.java ++++ b/net/minecraft/world/entity/monster/warden/AngerManagement.java +@@ -146,7 +_,7 @@ + + public int increaseAnger(Entity entity, int offset) { + boolean flag = !this.angerBySuspect.containsKey(entity); +- int i = this.angerBySuspect.computeInt(entity, (entity1, integer) -> Math.min(150, (integer == null ? 0 : integer) + offset)); ++ int i = this.angerBySuspect.computeInt(entity, (entity1, integer) -> Math.min(150, (integer == null ? 0 : integer) + offset)); // Paper - diff on change (Warden#increaseAngerAt WardenAngerChangeEvent) + if (flag) { + int i1 = this.angerByUuid.removeInt(entity.getUUID()); + i += i1; diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/warden/Warden.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/warden/Warden.java.patch new file mode 100644 index 0000000000..f6da9a7ec3 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/warden/Warden.java.patch @@ -0,0 +1,27 @@ +--- a/net/minecraft/world/entity/monster/warden/Warden.java ++++ b/net/minecraft/world/entity/monster/warden/Warden.java +@@ -407,7 +_,7 @@ + + public static void applyDarknessAround(ServerLevel level, Vec3 pos, @Nullable Entity source, int radius) { + MobEffectInstance mobEffectInstance = new MobEffectInstance(MobEffects.DARKNESS, 260, 0, false, false); +- MobEffectUtil.addEffectToPlayersAround(level, source, pos, radius, mobEffectInstance, 200); ++ MobEffectUtil.addEffectToPlayersAround(level, source, pos, radius, mobEffectInstance, 200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WARDEN); // CraftBukkit - Add EntityPotionEffectEvent.Cause + } + + @Override +@@ -469,6 +_,15 @@ + @VisibleForTesting + public void increaseAngerAt(@Nullable Entity entity, int offset, boolean playListeningSound) { + if (!this.isNoAi() && this.canTargetEntity(entity)) { ++ // Paper start - Add WardenAngerChangeEvent ++ int activeAnger = this.angerManagement.getActiveAnger(entity); ++ io.papermc.paper.event.entity.WardenAngerChangeEvent event = new io.papermc.paper.event.entity.WardenAngerChangeEvent((org.bukkit.entity.Warden) this.getBukkitEntity(), entity.getBukkitEntity(), activeAnger, Math.min(150, activeAnger + offset)); ++ this.level().getCraftServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ return; ++ } ++ offset = event.getNewAnger() - activeAnger; ++ // Paper end - Add WardenAngerChangeEvent + WardenAi.setDigCooldown(this); + boolean flag = !(this.getTarget() instanceof Player); + int i = this.angerManagement.increaseAnger(entity, offset); diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/monster/warden/AngerManagement.java.patch b/paper-server/patches/unapplied/net/minecraft/world/entity/monster/warden/AngerManagement.java.patch deleted file mode 100644 index f65a699a17..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/monster/warden/AngerManagement.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/monster/warden/AngerManagement.java -+++ b/net/minecraft/world/entity/monster/warden/AngerManagement.java -@@ -146,7 +146,7 @@ - - public int increaseAnger(Entity entity, int amount) { - boolean bl = !this.angerBySuspect.containsKey(entity); -- int i = this.angerBySuspect.computeInt(entity, (suspect, anger) -> Math.min(150, (anger == null ? 0 : anger) + amount)); -+ int i = this.angerBySuspect.computeInt(entity, (suspect, anger) -> Math.min(150, (anger == null ? 0 : anger) + amount)); // Paper - diff on change (Warden#increaseAngerAt WardenAngerChangeEvent) - if (bl) { - int j = this.angerByUuid.removeInt(entity.getUUID()); - i += j; diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/monster/warden/Warden.java.patch b/paper-server/patches/unapplied/net/minecraft/world/entity/monster/warden/Warden.java.patch deleted file mode 100644 index c6378460b2..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/monster/warden/Warden.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- a/net/minecraft/world/entity/monster/warden/Warden.java -+++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -375,7 +375,7 @@ - - @Override - public Brain getBrain() { -- return super.getBrain(); -+ return (Brain) super.getBrain(); // CraftBukkit - decompile error - } - - @Override -@@ -412,7 +412,7 @@ - public static void applyDarknessAround(ServerLevel world, Vec3 pos, @Nullable Entity entity, int range) { - MobEffectInstance mobeffect = new MobEffectInstance(MobEffects.DARKNESS, 260, 0, false, false); - -- MobEffectUtil.addEffectToPlayersAround(world, entity, pos, (double) range, mobeffect, 200); -+ MobEffectUtil.addEffectToPlayersAround(world, entity, pos, range, mobeffect, 200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WARDEN); // CraftBukkit - Add EntityPotionEffectEvent.Cause - } - - @Override -@@ -482,6 +482,15 @@ - @VisibleForTesting - public void increaseAngerAt(@Nullable Entity entity, int amount, boolean listening) { - if (!this.isNoAi() && this.canTargetEntity(entity)) { -+ // Paper start - Add WardenAngerChangeEvent -+ int activeAnger = this.angerManagement.getActiveAnger(entity); -+ io.papermc.paper.event.entity.WardenAngerChangeEvent event = new io.papermc.paper.event.entity.WardenAngerChangeEvent((org.bukkit.entity.Warden) this.getBukkitEntity(), entity.getBukkitEntity(), activeAnger, Math.min(150, activeAnger + amount)); -+ this.level().getCraftServer().getPluginManager().callEvent(event); -+ if (event.isCancelled()) { -+ return; -+ } -+ amount = event.getNewAnger() - activeAnger; -+ // Paper end - Add WardenAngerChangeEvent - WardenAi.setDigCooldown(this); - boolean flag1 = !(this.getTarget() instanceof Player); - int j = this.angerManagement.increaseAnger(entity, amount); -@@ -547,7 +556,7 @@ - - public void setAttackTarget(LivingEntity target) { - this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET); -- this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) target); -+ this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, target); // CraftBukkit - decompile error - this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); - SonicBoom.setCooldown(this, 200); - } -@@ -582,11 +591,11 @@ - - @Override - protected PathNavigation createNavigation(Level world) { -- return new GroundPathNavigation(this, this, world) { -+ return new GroundPathNavigation(this, world) { // CraftBukkit - decompile error - @Override - protected PathFinder createPathFinder(int range) { - this.nodeEvaluator = new WalkNodeEvaluator(); -- return new PathFinder(this, this.nodeEvaluator, range) { -+ return new PathFinder(this.nodeEvaluator, range) { // CraftBukkit - decompile error - @Override - protected float distance(Node a, Node b) { - return a.distanceToXZ(b);