2012-01-01 07:42:21 +00:00
|
|
|
--- ../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;
|
2012-01-11 18:39:42 +00:00
|
|
|
@@ -873,6 +889,10 @@
|
2012-01-01 07:42:21 +00:00
|
|
|
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)
|
|
|
|
+ {
|
2012-01-13 19:21:01 +00:00
|
|
|
+ nbttagcompound.setCompoundTag("ForgeData", customEntityData);
|
2012-01-12 07:38:23 +00:00
|
|
|
+ }
|
2012-01-01 07:42:21 +00:00
|
|
|
writeEntityToNBT(nbttagcompound);
|
|
|
|
}
|
|
|
|
|
2012-01-13 19:21:01 +00:00
|
|
|
@@ -907,6 +927,9 @@
|
2012-01-01 07:42:21 +00:00
|
|
|
onGround = nbttagcompound.getBoolean("OnGround");
|
|
|
|
setPosition(posX, posY, posZ);
|
|
|
|
setRotation(rotationYaw, rotationPitch);
|
2012-01-13 19:21:01 +00:00
|
|
|
+ if (nbttagcompound.hasKey("ForgeData")) {
|
|
|
|
+ customEntityData=nbttagcompound.getCompoundTag("ForgeData");
|
2012-01-01 07:42:21 +00:00
|
|
|
+ }
|
|
|
|
readEntityFromNBT(nbttagcompound);
|
|
|
|
}
|
|
|
|
|