--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java @@ -48,6 +48,10 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.storage.loot.LootTables; +// CraftBukkit start +import org.bukkit.event.entity.EntityDamageEvent; +// CraftBukkit end + public class Armadillo extends EntityAnimal { public static final float BABY_SCALE = 0.6F; @@ -135,16 +139,18 @@ GameProfilerFiller gameprofilerfiller = Profiler.get(); gameprofilerfiller.push("armadilloBrain"); - this.brain.tick(worldserver, this); + ((BehaviorController) this.brain).tick(worldserver, this); // CraftBukkit - decompile error gameprofilerfiller.pop(); gameprofilerfiller.push("armadilloActivityUpdate"); ArmadilloAi.updateActivity(this); gameprofilerfiller.pop(); if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { + this.forceDrops = true; // CraftBukkit if (this.dropFromGiftLootTable(worldserver, LootTables.ARMADILLO_SHED, this::spawnAtLocation)) { this.playSound(SoundEffects.ARMADILLO_SCUTE_DROP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.gameEvent(GameEvent.ENTITY_PLACE); } + this.forceDrops = false; // CraftBukkit this.scuteTime = this.pickNextScuteDropTime(); } @@ -291,8 +297,13 @@ } @Override - protected void actuallyHurt(WorldServer worldserver, DamageSource damagesource, float f) { - super.actuallyHurt(worldserver, damagesource, f); + // CraftBukkit start - void -> boolean + public boolean actuallyHurt(WorldServer worldserver, DamageSource damagesource, float f, EntityDamageEvent event) { + boolean damageResult = super.actuallyHurt(worldserver, damagesource, f, event); + if (!damageResult) { + return false; + } + // CraftBukkit end if (!this.isNoAi() && !this.isDeadOrDying()) { if (damagesource.getEntity() instanceof EntityLiving) { this.getBrain().setMemoryWithExpiry(MemoryModuleType.DANGER_DETECTED_RECENTLY, true, 80L); @@ -304,6 +315,7 @@ } } + return true; // CraftBukkit } @Override @@ -327,7 +339,9 @@ if (world instanceof WorldServer) { WorldServer worldserver = (WorldServer) world; + this.forceDrops = true; // CraftBukkit this.spawnAtLocation(worldserver, new ItemStack(Items.ARMADILLO_SCUTE)); + this.forceDrops = false; // CraftBukkit this.gameEvent(GameEvent.ENTITY_INTERACT); this.playSound(SoundEffects.ARMADILLO_BRUSH); } @@ -431,7 +445,7 @@ } public static Armadillo.a fromName(String s) { - return (Armadillo.a) Armadillo.a.CODEC.byName(s, (Enum) Armadillo.a.IDLE); + return (Armadillo.a) Armadillo.a.CODEC.byName(s, Armadillo.a.IDLE); // CraftBukkit - decompile error } @Override