diff --git a/paper-server/nms-patches/net/minecraft/world/entity/monster/breeze/Breeze.patch b/paper-server/nms-patches/net/minecraft/world/entity/monster/breeze/Breeze.patch new file mode 100644 index 0000000000..a397ebdf67 --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/world/entity/monster/breeze/Breeze.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/world/entity/monster/breeze/Breeze.java ++++ b/net/minecraft/world/entity/monster/breeze/Breeze.java +@@ -77,7 +77,7 @@ + + @Override + public BehaviorController getBrain() { +- return super.getBrain(); ++ return (BehaviorController) super.getBrain(); // CraftBukkit - decompile error + } + + @Override +@@ -255,6 +255,7 @@ + + @Override + public boolean canAttackType(EntityTypes entitytypes) { ++ if (this.getTarget() != null) return this.getTarget().getType() == entitytypes; // SPIGOT-7957: Allow attack if target from brain was set + return entitytypes == EntityTypes.PLAYER || entitytypes == EntityTypes.IRON_GOLEM; + } + diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftBreeze.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftBreeze.java index 0edefad5a9..7223fabab6 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftBreeze.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftBreeze.java @@ -1,7 +1,10 @@ package org.bukkit.craftbukkit.entity; +import net.minecraft.world.entity.EntityLiving; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Breeze; +import org.bukkit.entity.LivingEntity; public class CraftBreeze extends CraftMonster implements Breeze { @@ -14,6 +17,13 @@ public class CraftBreeze extends CraftMonster implements Breeze { return (net.minecraft.world.entity.monster.breeze.Breeze) entity; } + @Override + public void setTarget(LivingEntity target) { + super.setTarget(target); + EntityLiving entityLivingTarget = (target instanceof CraftLivingEntity craftLivingEntity) ? craftLivingEntity.getHandle() : null; + this.getHandle().getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, entityLivingTarget); // SPIGOT-7957: We need override memory for set target and trigger attack behaviours + } + @Override public String toString() { return "CraftBreeze";