Files
CatServer/patches/net/minecraft/entity/EntityAgeable.java.patch
2018-07-20 01:14:44 +08:00

67 lines
2.6 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/EntityAgeable.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityAgeable.java
@@ -21,6 +21,7 @@
protected int forcedAgeTimer;
private float ageWidth = -1.0F;
private float ageHeight;
+ public boolean ageLocked; // CraftBukkit
public EntityAgeable(World worldIn)
{
@@ -45,7 +46,8 @@
{
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F);
- this.worldObj.spawnEntityInWorld(entityageable);
+ //this.worldObj.spawnEntityInWorld(entityageable);
+ this.worldObj.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
if (stack.hasDisplayName())
{
@@ -55,6 +57,11 @@
if (!player.capabilities.isCreativeMode)
{
--stack.stackSize;
+ // CraftBukkit start - allow less than 0 stacks as "infinite"
+ if (stack.stackSize == 0) {
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null);
+ }
+ // CraftBukkit end
}
}
}
@@ -131,6 +138,7 @@
super.writeEntityToNBT(compound);
compound.setInteger("Age", this.getGrowingAge());
compound.setInteger("ForcedAge", this.forcedAge);
+ compound.setBoolean("AgeLocked", this.ageLocked); // CraftBukkit
}
public void readEntityFromNBT(NBTTagCompound compound)
@@ -138,6 +146,7 @@
super.readEntityFromNBT(compound);
this.setGrowingAge(compound.getInteger("Age"));
this.forcedAge = compound.getInteger("ForcedAge");
+ this.ageLocked = compound.getBoolean("AgeLocked"); // CraftBukkit
}
public void notifyDataManagerChange(DataParameter<?> key)
@@ -154,7 +163,7 @@
{
super.onLivingUpdate();
- if (this.worldObj.isRemote)
+ if (this.worldObj.isRemote || ageLocked)
{
if (this.forcedAgeTimer > 0)
{
@@ -202,7 +211,7 @@
this.setScale(child ? 0.5F : 1.0F);
}
- protected final void setSize(float width, float height)
+ public final void setSize(float width, float height)
{
boolean flag = this.ageWidth > 0.0F;
this.ageWidth = width;