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

47 lines
1.6 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
@@ -119,6 +119,22 @@
protected abstract void entityInit();
+ //Forge: Used to store custom data for each entity.
+ private NBTTagCompound customEntityData;
+ /**
+ * 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 dataWatcher;
@@ -873,6 +889,10 @@
nbttagcompound.setShort("Fire", (short)fire);
nbttagcompound.setShort("Air", (short)getAir());
nbttagcompound.setBoolean("OnGround", onGround);
2012-01-12 07:38:23 +00:00
+ if (customEntityData != null)
+ {
+ nbttagcompound.setCompoundTag("ForgeData", customEntityData);
2012-01-12 07:38:23 +00:00
+ }
writeEntityToNBT(nbttagcompound);
}
@@ -907,6 +927,9 @@
onGround = nbttagcompound.getBoolean("OnGround");
setPosition(posX, posY, posZ);
setRotation(rotationYaw, rotationPitch);
+ if (nbttagcompound.hasKey("ForgeData")) {
+ customEntityData=nbttagcompound.getCompoundTag("ForgeData");
+ }
readEntityFromNBT(nbttagcompound);
}