PaperMC/paper-server/patches/sources/net/minecraft/world/entity/AgeableMob.java.patch
2024-12-16 14:08:25 +01:00

43 lines
1.6 KiB
Diff

--- a/net/minecraft/world/entity/AgeableMob.java
+++ b/net/minecraft/world/entity/AgeableMob.java
@@ -20,6 +_,7 @@
protected int age;
protected int forcedAge;
protected int forcedAgeTimer;
+ public boolean ageLocked; // CraftBukkit
protected AgeableMob(EntityType<? extends AgeableMob> entityType, Level level) {
super(entityType, level);
@@ -66,6 +_,7 @@
}
public void ageUp(int amount, boolean forced) {
+ if (this.ageLocked) return; // Paper - Honor ageLock
int age = this.getAge();
age += amount * 20;
if (age > 0) {
@@ -104,6 +_,7 @@
super.addAdditionalSaveData(compound);
compound.putInt("Age", this.getAge());
compound.putInt("ForcedAge", this.forcedAge);
+ compound.putBoolean("AgeLocked", this.ageLocked); // CraftBukkit
}
@Override
@@ -111,6 +_,7 @@
super.readAdditionalSaveData(compound);
this.setAge(compound.getInt("Age"));
this.forcedAge = compound.getInt("ForcedAge");
+ this.ageLocked = compound.getBoolean("AgeLocked"); // CraftBukkit
}
@Override
@@ -125,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);