Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
44 lines
1.6 KiB
Diff
44 lines
1.6 KiB
Diff
--- a/net/minecraft/world/entity/AgeableMob.java
|
|
+++ b/net/minecraft/world/entity/AgeableMob.java
|
|
@@ -23,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);
|
|
@@ -69,6 +_,7 @@
|
|
}
|
|
|
|
public void ageUp(int amount, boolean forced) {
|
|
+ if (this.ageLocked) return; // Paper - Honor ageLock
|
|
int age = this.getAge();
|
|
int previousAge = age;
|
|
age += amount * 20;
|
|
@@ -108,6 +_,7 @@
|
|
super.addAdditionalSaveData(output);
|
|
output.putInt("Age", this.getAge());
|
|
output.putInt("ForcedAge", this.forcedAge);
|
|
+ output.putBoolean("AgeLocked", this.ageLocked); // CraftBukkit
|
|
}
|
|
|
|
@Override
|
|
@@ -115,6 +_,7 @@
|
|
super.readAdditionalSaveData(input);
|
|
this.setAge(input.getIntOr("Age", 0));
|
|
this.forcedAge = input.getIntOr("ForcedAge", 0);
|
|
+ this.ageLocked = input.getBooleanOr("AgeLocked", false); // CraftBukkit
|
|
}
|
|
|
|
@Override
|
|
@@ -129,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);
|