--- a/net/minecraft/world/entity/AgeableMob.java +++ b/net/minecraft/world/entity/AgeableMob.java @@ -22,6 +_,7 @@ protected int age = 0; protected int forcedAge = 0; protected int forcedAgeTimer; + public boolean ageLocked; // CraftBukkit protected AgeableMob(EntityType entityType, Level level) { super(entityType, level); @@ -68,13 +_,15 @@ } public void ageUp(int amount, boolean forced) { + if (this.ageLocked) return; // Paper - Honor ageLock int age = this.getAge(); + int previousAge = age; // Paper - Decompile fix: lvt reassignment lost age += amount * 20; if (age > 0) { age = 0; } - int i1 = age - age; + int i1 = age - previousAge; // Paper - Decompile fix this.setAge(age); if (forced) { this.forcedAge += i1; @@ -106,6 +_,7 @@ super.addAdditionalSaveData(compound); compound.putInt("Age", this.getAge()); compound.putInt("ForcedAge", this.forcedAge); + compound.putBoolean("AgeLocked", this.ageLocked); // CraftBukkit } @Override @@ -113,6 +_,7 @@ super.readAdditionalSaveData(compound); this.setAge(compound.getIntOr("Age", 0)); this.forcedAge = compound.getIntOr("ForcedAge", 0); + this.ageLocked = compound.getBooleanOr("AgeLocked", false); // CraftBukkit } @Override @@ -127,7 +_,7 @@ @Override public void aiStep() { super.aiStep(); - if (this.level().isClientSide) { + if (this.level().isClientSide || this.ageLocked) { // CraftBukkit if (this.forcedAgeTimer > 0) { if (this.forcedAgeTimer % 4 == 0) { this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0), this.getRandomY() + 0.5, this.getRandomZ(1.0), 0.0, 0.0, 0.0);