Paper/nms-patches/EntityAgeable.patch

45 lines
2.0 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntityAgeable.java
+++ b/net/minecraft/server/EntityAgeable.java
2019-04-23 04:00:00 +02:00
@@ -8,6 +8,7 @@
protected int b;
protected int c;
2019-04-23 04:00:00 +02:00
protected int d;
2016-02-29 22:32:46 +01:00
+ public boolean ageLocked; // CraftBukkit
2019-04-23 04:00:00 +02:00
protected EntityAgeable(EntityTypes<? extends EntityAgeable> entitytypes, World world) {
2018-07-15 02:00:00 +02:00
super(entitytypes, world);
2019-04-23 04:00:00 +02:00
@@ -30,7 +31,7 @@
2018-07-15 02:00:00 +02:00
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());
}
2019-04-23 04:00:00 +02:00
@@ -103,6 +104,7 @@
super.b(nbttagcompound);
nbttagcompound.setInt("Age", this.getAge());
2019-04-23 04:00:00 +02:00
nbttagcompound.setInt("ForcedAge", this.c);
+ nbttagcompound.setBoolean("AgeLocked", this.ageLocked); // CraftBukkit
}
2019-04-23 04:00:00 +02:00
@Override
@@ -110,6 +112,7 @@
super.a(nbttagcompound);
this.setAgeRaw(nbttagcompound.getInt("Age"));
2019-04-23 04:00:00 +02:00
this.c = nbttagcompound.getInt("ForcedAge");
+ this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
}
2019-04-23 04:00:00 +02:00
@Override
@@ -124,7 +127,7 @@
@Override
2018-12-13 01:00:00 +01:00
public void movementTick() {
super.movementTick();
2015-02-26 23:41:06 +01:00
- if (this.world.isClientSide) {
+ if (this.world.isClientSide || ageLocked) { // CraftBukkit
2019-04-23 04:00:00 +02:00
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);