Paper/nms-patches/EntityAgeable.patch
2019-04-23 12:00:00 +10:00

45 lines
2.0 KiB
Diff

--- a/net/minecraft/server/EntityAgeable.java
+++ b/net/minecraft/server/EntityAgeable.java
@@ -8,6 +8,7 @@
protected int b;
protected int c;
protected int d;
+ public boolean ageLocked; // CraftBukkit
protected EntityAgeable(EntityTypes<? extends EntityAgeable> entitytypes, World world) {
super(entitytypes, world);
@@ -30,7 +31,7 @@
if (entityageable != null) {
entityageable.setAgeRaw(-24000);
entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F);
- this.world.addEntity(entityageable);
+ this.world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
if (itemstack.hasName()) {
entityageable.setCustomName(itemstack.getName());
}
@@ -103,6 +104,7 @@
super.b(nbttagcompound);
nbttagcompound.setInt("Age", this.getAge());
nbttagcompound.setInt("ForcedAge", this.c);
+ nbttagcompound.setBoolean("AgeLocked", this.ageLocked); // CraftBukkit
}
@Override
@@ -110,6 +112,7 @@
super.a(nbttagcompound);
this.setAgeRaw(nbttagcompound.getInt("Age"));
this.c = nbttagcompound.getInt("ForcedAge");
+ this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
}
@Override
@@ -124,7 +127,7 @@
@Override
public void movementTick() {
super.movementTick();
- if (this.world.isClientSide) {
+ if (this.world.isClientSide || ageLocked) { // CraftBukkit
if (this.d > 0) {
if (this.d % 4 == 0) {
this.world.addParticle(Particles.HAPPY_VILLAGER, this.locX + (double) (this.random.nextFloat() * this.getWidth() * 2.0F) - (double) this.getWidth(), this.locY + 0.5D + (double) (this.random.nextFloat() * this.getHeight()), this.locZ + (double) (this.random.nextFloat() * this.getWidth() * 2.0F) - (double) this.getWidth(), 0.0D, 0.0D, 0.0D);