Honor EntityAgeable.ageLock

This commit is contained in:
BillyGalbreath 2018-09-23 20:59:53 -05:00
parent 4bea989f34
commit 46109028f9
2 changed files with 27 additions and 3 deletions

View file

@ -39,7 +39,15 @@
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData entityData) {
if (entityData == null) {
entityData = new AgeableMob.AgeableMobGroupData(true);
@@ -104,6 +130,7 @@
@@ -60,6 +86,7 @@
}
public void ageUp(int age, boolean overGrow) {
+ if (this.ageLocked) return; // Paper - Honor ageLock
int j = this.getAge();
int k = j;
@@ -104,6 +131,7 @@
super.addAdditionalSaveData(nbt);
nbt.putInt("Age", this.getAge());
nbt.putInt("ForcedAge", this.forcedAge);
@ -47,7 +55,7 @@
}
@Override
@@ -111,6 +138,7 @@
@@ -111,6 +139,7 @@
super.readAdditionalSaveData(nbt);
this.setAge(nbt.getInt("Age"));
this.forcedAge = nbt.getInt("ForcedAge");
@ -55,7 +63,7 @@
}
@Override
@@ -125,7 +153,7 @@
@@ -125,7 +154,7 @@
@Override
public void aiStep() {
super.aiStep();

View file

@ -251,3 +251,19 @@
Objects.requireNonNull(nbttagcompound);
list.forEach(nbttagcompound::remove);
@@ -391,6 +442,7 @@
}
private static void setBeeReleaseData(int ticksInHive, Bee beeEntity) {
+ if (!beeEntity.ageLocked) { // Paper - Honor ageLock
int j = beeEntity.getAge();
if (j < 0) {
@@ -400,6 +452,7 @@
}
beeEntity.setInLoveTime(Math.max(0, beeEntity.getInLoveTime() - ticksInHive));
+ } // Paper - Honor ageLock
}
}