--- ../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); + if (customEntityData != null) + { + nbttagcompound.setCompoundTag("ForgeEntityData", customEntityData); + } writeEntityToNBT(nbttagcompound); } @@ -907,6 +927,10 @@ onGround = nbttagcompound.getBoolean("OnGround"); setPosition(posX, posY, posZ); setRotation(rotationYaw, rotationPitch); + if (nbttagcompound.hasKey("ForgeEntityData")) + { + customEntityData.getCompoundTag("ForgeEntityData"); + } readEntityFromNBT(nbttagcompound); }