66 lines
2.7 KiB
Diff

--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -47,6 +47,10 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.gameevent.GameEvent;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityDamageEvent;
+// CraftBukkit end
+
public class Armadillo extends EntityAnimal {
public static final float BABY_SCALE = 0.6F;
@@ -132,14 +136,16 @@
@Override
protected void customServerAiStep() {
this.level().getProfiler().push("armadilloBrain");
- this.brain.tick((WorldServer) this.level(), this);
+ ((BehaviorController<Armadillo>) this.brain).tick((WorldServer) this.level(), this); // CraftBukkit - decompile error
this.level().getProfiler().pop();
this.level().getProfiler().push("armadilloActivityUpdate");
ArmadilloAi.updateActivity(this);
this.level().getProfiler().pop();
if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) {
this.playSound(SoundEffects.ARMADILLO_SCUTE_DROP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation((IMaterial) Items.ARMADILLO_SCUTE);
+ this.forceDrops = false; // CraftBukkit
this.gameEvent(GameEvent.ENTITY_PLACE);
this.scuteTime = this.pickNextScuteDropTime();
}
@@ -286,8 +292,13 @@
}
@Override
- protected void actuallyHurt(DamageSource damagesource, float f) {
- super.actuallyHurt(damagesource, f);
+ // CraftBukkit start - void -> boolean
+ public boolean actuallyHurt(DamageSource damagesource, float f, EntityDamageEvent event) {
+ boolean damageResult = super.actuallyHurt(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);
@@ -299,6 +310,7 @@
}
}
+ return true; // CraftBukkit
}
@Override
@@ -326,7 +338,9 @@
if (this.isBaby()) {
return false;
} else {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation(new ItemStack(Items.ARMADILLO_SCUTE));
+ this.forceDrops = false; // CraftBukkit
this.gameEvent(GameEvent.ENTITY_INTERACT);
this.playSound(SoundEffects.ARMADILLO_BRUSH);
return true;