--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -2,8 +2,10 @@
 
 import com.google.common.annotations.VisibleForTesting;
 import com.mojang.logging.LogUtils;
+import com.mojang.serialization.DataResult;
 import com.mojang.serialization.Dynamic;
 import java.util.Collections;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.function.BiConsumer;
 import javax.annotation.Nullable;
@@ -70,6 +72,7 @@
 import org.slf4j.Logger;
 
 public class Warden extends Monster implements VibrationListener.VibrationListenerConfig {
+
     private static final Logger LOGGER = LogUtils.getLogger();
     private static final int GAME_EVENT_LISTENER_RANGE = 16;
     private static final int VIBRATION_COOLDOWN_TICKS = 40;
@@ -104,12 +107,11 @@
     public AnimationState diggingAnimationState = new AnimationState();
     public AnimationState attackAnimationState = new AnimationState();
     public AnimationState sonicBoomAnimationState = new AnimationState();
-    private final DynamicGameEventListener<VibrationListener> dynamicGameEventListener;
+    private final DynamicGameEventListener<VibrationListener> dynamicGameEventListener = new DynamicGameEventListener<>(new VibrationListener(new EntityPositionSource(this, this.getEyeHeight()), 16, this));
     private AngerManagement angerManagement = new AngerManagement(this::canTargetEntity, Collections.emptyList());
 
     public Warden(EntityType<? extends Monster> type, Level world) {
         super(type, world);
-        this.dynamicGameEventListener = new DynamicGameEventListener<>(new VibrationListener(new EntityPositionSource(this, this.getEyeHeight()), 16, this));
         this.xpReward = 5;
         this.getNavigation().setCanFloat(true);
         this.setPathfindingMalus(BlockPathTypes.UNPASSABLE_RAIL, 0.0F);
@@ -169,7 +171,7 @@
     }
 
     public static AttributeSupplier.Builder createAttributes() {
-        return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 500.0D).add(Attributes.MOVEMENT_SPEED, (double)0.3F).add(Attributes.KNOCKBACK_RESISTANCE, 1.0D).add(Attributes.ATTACK_KNOCKBACK, 1.5D).add(Attributes.ATTACK_DAMAGE, 30.0D);
+        return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 500.0D).add(Attributes.MOVEMENT_SPEED, 0.30000001192092896D).add(Attributes.KNOCKBACK_RESISTANCE, 1.0D).add(Attributes.ATTACK_KNOCKBACK, 1.5D).add(Attributes.ATTACK_DAMAGE, 30.0D);
     }
 
     @Override
@@ -205,7 +207,7 @@
 
     @Override
     public boolean doHurtTarget(Entity target) {
-        this.level.broadcastEntityEvent(this, (byte)4);
+        this.level.broadcastEntityEvent(this, (byte) 4);
         this.playSound(SoundEvents.WARDEN_ATTACK_IMPACT, 10.0F, this.getVoicePitch());
         SonicBoom.setCooldown(this, 40);
         return super.doHurtTarget(target);
@@ -214,22 +216,25 @@
     @Override
     protected void defineSynchedData() {
         super.defineSynchedData();
-        this.entityData.define(CLIENT_ANGER_LEVEL, 0);
+        this.entityData.define(Warden.CLIENT_ANGER_LEVEL, 0);
     }
 
     public int getClientAngerLevel() {
-        return this.entityData.get(CLIENT_ANGER_LEVEL);
+        return (Integer) this.entityData.get(Warden.CLIENT_ANGER_LEVEL);
     }
 
     private void syncClientAngerLevel() {
-        this.entityData.set(CLIENT_ANGER_LEVEL, this.getActiveAnger());
+        this.entityData.set(Warden.CLIENT_ANGER_LEVEL, this.getActiveAnger());
     }
 
     @Override
     public void tick() {
-        Level var2 = this.level;
-        if (var2 instanceof ServerLevel serverLevel) {
-            this.dynamicGameEventListener.getListener().tick(serverLevel);
+        Level world = this.level;
+
+        if (world instanceof ServerLevel) {
+            ServerLevel worldserver = (ServerLevel) world;
+
+            ((VibrationListener) this.dynamicGameEventListener.getListener()).tick(worldserver);
             if (this.isPersistenceRequired() || this.requiresCustomPersistence()) {
                 WardenAi.setDigCooldown(this);
             }
@@ -267,17 +272,18 @@
 
     @Override
     protected void customServerAiStep() {
-        ServerLevel serverLevel = (ServerLevel)this.level;
-        serverLevel.getProfiler().push("wardenBrain");
-        this.getBrain().tick(serverLevel, this);
+        ServerLevel worldserver = (ServerLevel) this.level;
+
+        worldserver.getProfiler().push("wardenBrain");
+        this.getBrain().tick(worldserver, this);
         this.level.getProfiler().pop();
         super.customServerAiStep();
         if ((this.tickCount + this.getId()) % 120 == 0) {
-            applyDarknessAround(serverLevel, this.position(), this, 20);
+            Warden.applyDarknessAround(worldserver, this.position(), this, 20);
         }
 
         if (this.tickCount % 20 == 0) {
-            this.angerManagement.tick(serverLevel, this::canTargetEntity);
+            this.angerManagement.tick(worldserver, this::canTargetEntity);
             this.syncClientAngerLevel();
         }
 
@@ -300,28 +306,31 @@
     }
 
     private int getHeartBeatDelay() {
-        float f = (float)this.getClientAngerLevel() / (float)AngerLevel.ANGRY.getMinimumAnger();
+        float f = (float) this.getClientAngerLevel() / (float) AngerLevel.ANGRY.getMinimumAnger();
+
         return 40 - Mth.floor(Mth.clamp(f, 0.0F, 1.0F) * 30.0F);
     }
 
     public float getTendrilAnimation(float tickDelta) {
-        return Mth.lerp(tickDelta, (float)this.tendrilAnimationO, (float)this.tendrilAnimation) / 10.0F;
+        return Mth.lerp(tickDelta, (float) this.tendrilAnimationO, (float) this.tendrilAnimation) / 10.0F;
     }
 
     public float getHeartAnimation(float tickDelta) {
-        return Mth.lerp(tickDelta, (float)this.heartAnimationO, (float)this.heartAnimation) / 10.0F;
+        return Mth.lerp(tickDelta, (float) this.heartAnimationO, (float) this.heartAnimation) / 10.0F;
     }
 
     private void clientDiggingParticles(AnimationState animationState) {
-        if ((float)animationState.getAccumulatedTime() < 4500.0F) {
-            RandomSource randomSource = this.getRandom();
-            BlockState blockState = this.getBlockStateOn();
-            if (blockState.getRenderShape() != RenderShape.INVISIBLE) {
-                for(int i = 0; i < 30; ++i) {
-                    double d = this.getX() + (double)Mth.randomBetween(randomSource, -0.7F, 0.7F);
-                    double e = this.getY();
-                    double f = this.getZ() + (double)Mth.randomBetween(randomSource, -0.7F, 0.7F);
-                    this.level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockState), d, e, f, 0.0D, 0.0D, 0.0D);
+        if ((float) animationState.getAccumulatedTime() < 4500.0F) {
+            RandomSource randomsource = this.getRandom();
+            BlockState iblockdata = this.getBlockStateOn();
+
+            if (iblockdata.getRenderShape() != RenderShape.INVISIBLE) {
+                for (int i = 0; i < 30; ++i) {
+                    double d0 = this.getX() + (double) Mth.randomBetween(randomsource, -0.7F, 0.7F);
+                    double d1 = this.getY();
+                    double d2 = this.getZ() + (double) Mth.randomBetween(randomsource, -0.7F, 0.7F);
+
+                    this.level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, iblockdata), d0, d1, d2, 0.0D, 0.0D, 0.0D);
                 }
             }
         }
@@ -330,7 +339,7 @@
 
     @Override
     public void onSyncedDataUpdated(EntityDataAccessor<?> data) {
-        if (DATA_POSE.equals(data)) {
+        if (Warden.DATA_POSE.equals(data)) {
             switch (this.getPose()) {
                 case EMERGING:
                     this.emergeAnimationState.start(this.tickCount);
@@ -361,7 +370,7 @@
 
     @Override
     public Brain<Warden> getBrain() {
-        return super.getBrain();
+        return (Brain<Warden>) super.getBrain(); // CraftBukkit - decompile error
     }
 
     @Override
@@ -372,9 +381,12 @@
 
     @Override
     public void updateDynamicGameEventListener(BiConsumer<DynamicGameEventListener<?>, ServerLevel> callback) {
-        Level var3 = this.level;
-        if (var3 instanceof ServerLevel serverLevel) {
-            callback.accept(this.dynamicGameEventListener, serverLevel);
+        Level world = this.level;
+
+        if (world instanceof ServerLevel) {
+            ServerLevel worldserver = (ServerLevel) world;
+
+            callback.accept(this.dynamicGameEventListener, worldserver);
         }
 
     }
@@ -391,44 +403,67 @@
 
     @Contract("null->false")
     public boolean canTargetEntity(@Nullable Entity entity) {
-        if (entity instanceof LivingEntity livingEntity) {
-            if (this.level == entity.level && EntitySelector.NO_CREATIVE_OR_SPECTATOR.test(entity) && !this.isAlliedTo(entity) && livingEntity.getType() != EntityType.ARMOR_STAND && livingEntity.getType() != EntityType.WARDEN && !livingEntity.isInvulnerable() && !livingEntity.isDeadOrDying() && this.level.getWorldBorder().isWithinBounds(livingEntity.getBoundingBox())) {
-                return true;
+        boolean flag;
+
+        if (entity instanceof LivingEntity) {
+            LivingEntity entityliving = (LivingEntity) entity;
+
+            if (this.level == entity.level && EntitySelector.NO_CREATIVE_OR_SPECTATOR.test(entity) && !this.isAlliedTo(entity) && entityliving.getType() != EntityType.ARMOR_STAND && entityliving.getType() != EntityType.WARDEN && !entityliving.isInvulnerable() && !entityliving.isDeadOrDying() && this.level.getWorldBorder().isWithinBounds(entityliving.getBoundingBox())) {
+                flag = true;
+                return flag;
             }
         }
 
-        return false;
+        flag = false;
+        return flag;
     }
 
     public static void applyDarknessAround(ServerLevel world, Vec3 pos, @Nullable Entity entity, int range) {
-        MobEffectInstance mobEffectInstance = new MobEffectInstance(MobEffects.DARKNESS, 260, 0, false, false);
-        MobEffectUtil.addEffectToPlayersAround(world, entity, pos, (double)range, mobEffectInstance, 200);
+        MobEffectInstance mobeffect = new MobEffectInstance(MobEffects.DARKNESS, 260, 0, false, false);
+
+        MobEffectUtil.addEffectToPlayersAround(world, entity, pos, range, mobeffect, 200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WARDEN); // CraftBukkit - Add EntityPotionEffectEvent.Cause
     }
 
     @Override
     public void addAdditionalSaveData(CompoundTag nbt) {
         super.addAdditionalSaveData(nbt);
-        AngerManagement.codec(this::canTargetEntity).encodeStart(NbtOps.INSTANCE, this.angerManagement).resultOrPartial(LOGGER::error).ifPresent((angerNbt) -> {
-            nbt.put("anger", angerNbt);
+        DataResult<net.minecraft.nbt.Tag> dataresult = AngerManagement.codec(this::canTargetEntity).encodeStart(NbtOps.INSTANCE, this.angerManagement); // CraftBukkit - decompile error
+        Logger logger = Warden.LOGGER;
+
+        Objects.requireNonNull(logger);
+        dataresult.resultOrPartial(logger::error).ifPresent((nbtbase) -> {
+            nbt.put("anger", nbtbase);
         });
-        VibrationListener.codec(this).encodeStart(NbtOps.INSTANCE, this.dynamicGameEventListener.getListener()).resultOrPartial(LOGGER::error).ifPresent((tag) -> {
-            nbt.put("listener", tag);
+        dataresult = VibrationListener.codec(this).encodeStart(NbtOps.INSTANCE, (VibrationListener) this.dynamicGameEventListener.getListener());
+        logger = Warden.LOGGER;
+        Objects.requireNonNull(logger);
+        dataresult.resultOrPartial(logger::error).ifPresent((nbtbase) -> {
+            nbt.put("listener", nbtbase);
         });
     }
 
     @Override
     public void readAdditionalSaveData(CompoundTag nbt) {
         super.readAdditionalSaveData(nbt);
+        DataResult dataresult;
+        Logger logger;
+
         if (nbt.contains("anger")) {
-            AngerManagement.codec(this::canTargetEntity).parse(new Dynamic<>(NbtOps.INSTANCE, nbt.get("anger"))).resultOrPartial(LOGGER::error).ifPresent((angerManager) -> {
-                this.angerManagement = angerManager;
+            dataresult = AngerManagement.codec(this::canTargetEntity).parse(new Dynamic(NbtOps.INSTANCE, nbt.get("anger")));
+            logger = Warden.LOGGER;
+            Objects.requireNonNull(logger);
+            ((DataResult<AngerManagement>) dataresult).resultOrPartial(logger::error).ifPresent((angermanagement) -> { // CraftBukkit - decompile error
+                this.angerManagement = angermanagement;
             });
             this.syncClientAngerLevel();
         }
 
         if (nbt.contains("listener", 10)) {
-            VibrationListener.codec(this).parse(new Dynamic<>(NbtOps.INSTANCE, nbt.getCompound("listener"))).resultOrPartial(LOGGER::error).ifPresent((vibrationListener) -> {
-                this.dynamicGameEventListener.updateListener(vibrationListener, this.level);
+            dataresult = VibrationListener.codec(this).parse(new Dynamic(NbtOps.INSTANCE, nbt.getCompound("listener")));
+            logger = Warden.LOGGER;
+            Objects.requireNonNull(logger);
+            ((DataResult<VibrationListener>) dataresult).resultOrPartial(logger::error).ifPresent((vibrationlistener) -> { // CraftBukkit - decompile error
+                this.dynamicGameEventListener.updateListener(vibrationlistener, this.level);
             });
         }
 
@@ -460,10 +495,20 @@
     @VisibleForTesting
     public void increaseAngerAt(@Nullable Entity entity, int amount, boolean listening) {
         if (!this.isNoAi() && this.canTargetEntity(entity)) {
+            // Paper start
+            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
             WardenAi.setDigCooldown(this);
-            boolean bl = !(this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((LivingEntity)null) instanceof Player);
-            int i = this.angerManagement.increaseAnger(entity, amount);
-            if (entity instanceof Player && bl && AngerLevel.byAnger(i).isAngry()) {
+            boolean flag1 = !(this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null) instanceof Player); // CraftBukkit - decompile error
+            int j = this.angerManagement.increaseAnger(entity, amount);
+
+            if (entity instanceof Player && flag1 && AngerLevel.byAnger(j).isAngry()) {
                 this.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
             }
 
@@ -481,7 +526,7 @@
     @Nullable
     @Override
     public LivingEntity getTarget() {
-        return this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((LivingEntity)null);
+        return (LivingEntity) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
     }
 
     @Override
@@ -495,7 +540,7 @@
         this.getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, 1200L);
         if (spawnReason == MobSpawnType.TRIGGERED) {
             this.setPose(Pose.EMERGING);
-            this.getBrain().setMemoryWithExpiry(MemoryModuleType.IS_EMERGING, Unit.INSTANCE, (long)WardenAi.EMERGE_DURATION);
+            this.getBrain().setMemoryWithExpiry(MemoryModuleType.IS_EMERGING, Unit.INSTANCE, (long) WardenAi.EMERGE_DURATION);
             this.playSound(SoundEvents.WARDEN_AGITATED, 5.0F, 1.0F);
         }
 
@@ -504,32 +549,36 @@
 
     @Override
     public boolean hurt(DamageSource source, float amount) {
-        boolean bl = super.hurt(source, amount);
+        boolean flag = super.hurt(source, amount);
+
         if (!this.level.isClientSide && !this.isNoAi() && !this.isDiggingOrEmerging()) {
             Entity entity = source.getEntity();
+
             this.increaseAngerAt(entity, AngerLevel.ANGRY.getMinimumAnger() + 20, false);
             if (this.brain.getMemory(MemoryModuleType.ATTACK_TARGET).isEmpty() && entity instanceof LivingEntity) {
-                LivingEntity livingEntity = (LivingEntity)entity;
-                if (!(source instanceof IndirectEntityDamageSource) || this.closerThan(livingEntity, 5.0D)) {
-                    this.setAttackTarget(livingEntity);
+                LivingEntity entityliving = (LivingEntity) entity;
+
+                if (!(source instanceof IndirectEntityDamageSource) || this.closerThan(entityliving, 5.0D)) {
+                    this.setAttackTarget(entityliving);
                 }
             }
         }
 
-        return bl;
+        return flag;
     }
 
     public void setAttackTarget(LivingEntity target) {
         this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);
-        this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, target);
+        this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, target); // CraftBukkit - decompile error
         this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
         SonicBoom.setCooldown(this, 200);
     }
 
     @Override
     public EntityDimensions getDimensions(Pose pose) {
-        EntityDimensions entityDimensions = super.getDimensions(pose);
-        return this.isDiggingOrEmerging() ? EntityDimensions.fixed(entityDimensions.width, 1.0F) : entityDimensions;
+        EntityDimensions entitysize = super.getDimensions(pose);
+
+        return this.isDiggingOrEmerging() ? EntityDimensions.fixed(entitysize.width, 1.0F) : entitysize;
     }
 
     @Override
@@ -551,15 +600,20 @@
     @Override
     public boolean shouldListen(ServerLevel world, GameEventListener listener, BlockPos pos, GameEvent event, GameEvent.Context emitter) {
         if (!this.isNoAi() && !this.isDeadOrDying() && !this.getBrain().hasMemoryValue(MemoryModuleType.VIBRATION_COOLDOWN) && !this.isDiggingOrEmerging() && world.getWorldBorder().isWithinBounds(pos)) {
-            Entity var7 = emitter.sourceEntity();
-            if (var7 instanceof LivingEntity) {
-                LivingEntity livingEntity = (LivingEntity)var7;
-                if (!this.canTargetEntity(livingEntity)) {
-                    return false;
+            Entity entity = emitter.sourceEntity();
+            boolean flag;
+
+            if (entity instanceof LivingEntity) {
+                LivingEntity entityliving = (LivingEntity) entity;
+
+                if (!this.canTargetEntity(entityliving)) {
+                    flag = false;
+                    return flag;
                 }
             }
 
-            return true;
+            flag = true;
+            return flag;
         } else {
             return false;
         }
@@ -569,14 +623,15 @@
     public void onSignalReceive(ServerLevel world, GameEventListener listener, BlockPos pos, GameEvent event, @Nullable Entity entity, @Nullable Entity sourceEntity, float distance) {
         if (!this.isDeadOrDying()) {
             this.brain.setMemoryWithExpiry(MemoryModuleType.VIBRATION_COOLDOWN, Unit.INSTANCE, 40L);
-            world.broadcastEntityEvent(this, (byte)61);
+            world.broadcastEntityEvent(this, (byte) 61);
             this.playSound(SoundEvents.WARDEN_TENDRIL_CLICKS, 5.0F, this.getVoicePitch());
-            BlockPos blockPos = pos;
+            BlockPos blockposition1 = pos;
+
             if (sourceEntity != null) {
                 if (this.closerThan(sourceEntity, 30.0D)) {
                     if (this.getBrain().hasMemoryValue(MemoryModuleType.RECENT_PROJECTILE)) {
                         if (this.canTargetEntity(sourceEntity)) {
-                            blockPos = sourceEntity.blockPosition();
+                            blockposition1 = sourceEntity.blockPosition();
                         }
 
                         this.increaseAngerAt(sourceEntity);
@@ -592,8 +647,9 @@
 
             if (!this.getAngerLevel().isAngry()) {
                 Optional<LivingEntity> optional = this.angerManagement.getActiveEntity();
+
                 if (sourceEntity != null || optional.isEmpty() || optional.get() == entity) {
-                    WardenAi.setDisturbanceLocation(this, blockPos);
+                    WardenAi.setDisturbanceLocation(this, blockposition1);
                 }
             }
 
