ForgePatch/forge/patches/minecraft_server/net/minecraft/src/Entity.java.patch

65 lines
2.2 KiB
Diff
Raw Normal View History

--- ../src_base/minecraft_server/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
2012-03-26 05:02:13 +00:00
@@ -165,6 +165,9 @@
public boolean ignoreFrustumCheck;
public boolean isAirBorne;
+ /** Forge: Used to store custom data for each entity. */
+ private NBTTagCompound customEntityData;
+
public Entity(World par1World)
{
this.entityId = nextEntityID++;
2012-03-26 06:28:32 +00:00
@@ -206,6 +209,29 @@
protected abstract void entityInit();
+ /**
+ * Returns a NBTTagCompound that can be used to store custom data for this entity.
+ * It will be written, and read from disc, so it persists over world saves.
+ * @return A NBTTagCompound
+ */
+ public NBTTagCompound getEntityData()
+ {
+ if (customEntityData == null)
+ {
+ customEntityData = new NBTTagCompound();
+ }
+ return customEntityData;
+ }
2012-03-26 06:28:32 +00:00
+
+ /**
+ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position.
+ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation.
+ */
+ public boolean shouldRiderSit()
+ {
+ return true;
+ }
+
public DataWatcher getDataWatcher()
{
return this.dataWatcher;
2012-03-26 06:28:32 +00:00
@@ -1183,6 +1209,10 @@
par1NBTTagCompound.setShort("Fire", (short)this.fire);
par1NBTTagCompound.setShort("Air", (short)this.getAir());
par1NBTTagCompound.setBoolean("OnGround", this.onGround);
2012-01-12 07:38:23 +00:00
+ if (customEntityData != null)
+ {
+ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
2012-01-12 07:38:23 +00:00
+ }
this.writeEntityToNBT(par1NBTTagCompound);
}
2012-03-26 06:28:32 +00:00
@@ -1224,6 +1254,10 @@
this.onGround = par1NBTTagCompound.getBoolean("OnGround");
this.setPosition(this.posX, this.posY, this.posZ);
this.setRotation(this.rotationYaw, this.rotationPitch);
+ if (par1NBTTagCompound.hasKey("ForgeData"))
2012-01-15 19:16:08 +00:00
+ {
+ customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData");
+ }
this.readEntityFromNBT(par1NBTTagCompound);
}