Files
Paper/paper-server/patches/sources/net/minecraft/world/entity/AgeableMob.java.patch
Nassim Jahnke f00727c57e 1.21.5
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: MiniDigger | Martin <admin@minidigger.dev>
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
2025-04-12 17:27:00 +02:00

53 lines
1.9 KiB
Diff

--- 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<? extends AgeableMob> 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);