diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/AgeableMob.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/AgeableMob.java.patch | 205 |
1 files changed, 205 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/AgeableMob.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/AgeableMob.java.patch new file mode 100644 index 0000000000..3dfd9f6366 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/AgeableMob.java.patch @@ -0,0 +1,205 @@ +--- a/net/minecraft/world/entity/AgeableMob.java ++++ b/net/minecraft/world/entity/AgeableMob.java +@@ -20,33 +20,32 @@ + protected int age; + protected int forcedAge; + protected int forcedAgeTimer; ++ public boolean ageLocked; // CraftBukkit + +- protected AgeableMob(EntityType<? extends AgeableMob> entitytype, Level level) { +- super(entitytype, level); ++ protected AgeableMob(EntityType<? extends AgeableMob> entityType, Level level) { ++ super(entityType, level); + } + + @Override +- @Override +- public SpawnGroupData finalizeSpawn(ServerLevelAccessor serverlevelaccessor, DifficultyInstance difficultyinstance, MobSpawnType mobspawntype, @Nullable SpawnGroupData spawngroupdata, @Nullable CompoundTag compoundtag) { +- if (spawngroupdata == null) { +- spawngroupdata = new AgeableMob.AgeableMobGroupData(true); ++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) { ++ if (spawnData == null) { ++ spawnData = new AgeableMob.AgeableMobGroupData(true); + } + +- AgeableMob.AgeableMobGroupData ageablemob_ageablemobgroupdata = (AgeableMob.AgeableMobGroupData) spawngroupdata; ++ AgeableMob.AgeableMobGroupData entityageable_a = (AgeableMob.AgeableMobGroupData) spawnData; + +- if (ageablemob_ageablemobgroupdata.isShouldSpawnBaby() && ageablemob_ageablemobgroupdata.getGroupSize() > 0 && serverlevelaccessor.getRandom().nextFloat() <= ageablemob_ageablemobgroupdata.getBabySpawnChance()) { ++ if (entityageable_a.isShouldSpawnBaby() && entityageable_a.getGroupSize() > 0 && level.getRandom().nextFloat() <= entityageable_a.getBabySpawnChance()) { + this.setAge(-24000); + } + +- ageablemob_ageablemobgroupdata.increaseGroupSizeByOne(); +- return super.finalizeSpawn(serverlevelaccessor, difficultyinstance, mobspawntype, (SpawnGroupData) spawngroupdata, compoundtag); ++ entityageable_a.increaseGroupSizeByOne(); ++ return super.finalizeSpawn(level, difficulty, reason, (GroupDataEntity) spawnData, dataTag); + } + + @Nullable + public abstract AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent); + + @Override +- @Override + protected void defineSynchedData() { + super.defineSynchedData(); + this.entityData.define(AgeableMob.DATA_BABY_ID, false); +@@ -60,11 +59,11 @@ + return this.level().isClientSide ? ((Boolean) this.entityData.get(AgeableMob.DATA_BABY_ID) ? -1 : 1) : this.age; + } + +- public void ageUp(int i, boolean flag) { ++ public void ageUp(int amount, boolean forced) { + int j = this.getAge(); + int k = j; + +- j += i * 20; ++ j += amount * 20; + if (j > 0) { + j = 0; + } +@@ -72,7 +71,7 @@ + int l = j - k; + + this.setAge(j); +- if (flag) { ++ if (forced) { + this.forcedAge += l; + if (this.forcedAgeTimer == 0) { + this.forcedAgeTimer = 40; +@@ -85,52 +84,50 @@ + + } + +- public void ageUp(int i) { +- this.ageUp(i, false); ++ public void ageUp(int amount) { ++ this.ageUp(amount, false); + } + +- public void setAge(int i) { ++ public void setAge(int age) { + int j = this.getAge(); + +- this.age = i; +- if (j < 0 && i >= 0 || j >= 0 && i < 0) { +- this.entityData.set(AgeableMob.DATA_BABY_ID, i < 0); ++ this.age = age; ++ if (j < 0 && age >= 0 || j >= 0 && age < 0) { ++ this.entityData.set(AgeableMob.DATA_BABY_ID, age < 0); + this.ageBoundaryReached(); + } + + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- super.addAdditionalSaveData(compoundtag); +- compoundtag.putInt("Age", this.getAge()); +- compoundtag.putInt("ForcedAge", this.forcedAge); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ super.addAdditionalSaveData(compound); ++ compound.putInt("Age", this.getAge()); ++ compound.putInt("ForcedAge", this.forcedAge); ++ compound.putBoolean("AgeLocked", this.ageLocked); // CraftBukkit + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- super.readAdditionalSaveData(compoundtag); +- this.setAge(compoundtag.getInt("Age")); +- this.forcedAge = compoundtag.getInt("ForcedAge"); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ super.readAdditionalSaveData(compound); ++ this.setAge(compound.getInt("Age")); ++ this.forcedAge = compound.getInt("ForcedAge"); ++ this.ageLocked = compound.getBoolean("AgeLocked"); // CraftBukkit + } + + @Override +- @Override +- public void onSyncedDataUpdated(EntityDataAccessor<?> entitydataaccessor) { +- if (AgeableMob.DATA_BABY_ID.equals(entitydataaccessor)) { ++ public void onSyncedDataUpdated(EntityDataAccessor<?> key) { ++ if (AgeableMob.DATA_BABY_ID.equals(key)) { + this.refreshDimensions(); + } + +- super.onSyncedDataUpdated(entitydataaccessor); ++ super.onSyncedDataUpdated(key); + } + + @Override +- @Override + public void aiStep() { + super.aiStep(); +- if (this.level().isClientSide) { ++ if (this.level().isClientSide || ageLocked) { // CraftBukkit + if (this.forcedAgeTimer > 0) { + if (this.forcedAgeTimer % 4 == 0) { + this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D); +@@ -157,9 +154,9 @@ + Entity entity = this.getVehicle(); + + if (entity instanceof Boat) { +- Boat boat = (Boat) entity; ++ Boat entityboat = (Boat) entity; + +- if (!boat.hasEnoughSpaceFor(this)) { ++ if (!entityboat.hasEnoughSpaceFor(this)) { + this.stopRiding(); + } + } +@@ -168,38 +165,36 @@ + } + + @Override +- @Override + public boolean isBaby() { + return this.getAge() < 0; + } + + @Override +- @Override +- public void setBaby(boolean flag) { +- this.setAge(flag ? -24000 : 0); ++ public void setBaby(boolean baby) { ++ this.setAge(baby ? -24000 : 0); + } + +- public static int getSpeedUpSecondsWhenFeeding(int i) { +- return (int) ((float) (i / 20) * 0.1F); ++ public static int getSpeedUpSecondsWhenFeeding(int ticksUntilAdult) { ++ return (int) ((float) (ticksUntilAdult / 20) * 0.1F); + } + +- public static class AgeableMobGroupData implements SpawnGroupData { ++ public static class AgeableMobGroupData implements GroupDataEntity { + + private int groupSize; + private final boolean shouldSpawnBaby; + private final float babySpawnChance; + +- private AgeableMobGroupData(boolean flag, float f) { +- this.shouldSpawnBaby = flag; +- this.babySpawnChance = f; ++ private AgeableMobGroupData(boolean shouldSpawnBaby, float babySpawnChance) { ++ this.shouldSpawnBaby = shouldSpawnBaby; ++ this.babySpawnChance = babySpawnChance; + } + +- public AgeableMobGroupData(boolean flag) { +- this(flag, 0.05F); ++ public AgeableMobGroupData(boolean shouldSpawnBaby) { ++ this(shouldSpawnBaby, 0.05F); + } + +- public AgeableMobGroupData(float f) { +- this(true, f); ++ public AgeableMobGroupData(float babySpawnChance) { ++ this(true, babySpawnChance); + } + + public int getGroupSize() { |