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

56 lines
1.9 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
@@ -140,6 +140,9 @@
public boolean ignoreFrustrumCheck;
public boolean isAirBorne;
+ /** Forge: Used to store custom data for each entity. */
+ private NBTTagCompound customEntityData;
+
public Entity(World par1World)
{
this.entityId = nextEntityID++;
@@ -181,6 +184,20 @@
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;
+ }
+
public DataWatcher getDataWatcher()
{
return this.dataWatcher;
@@ -1128,6 +1145,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);
}
@@ -1169,6 +1190,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);
}