--- ../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 @@ -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++; @@ -206,6 +209,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; @@ -1183,6 +1200,10 @@ par1NBTTagCompound.setShort("Fire", (short)this.fire); par1NBTTagCompound.setShort("Air", (short)this.getAir()); par1NBTTagCompound.setBoolean("OnGround", this.onGround); + if (customEntityData != null) + { + par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData); + } this.writeEntityToNBT(par1NBTTagCompound); } @@ -1224,6 +1245,10 @@ this.onGround = par1NBTTagCompound.getBoolean("OnGround"); this.setPosition(this.posX, this.posY, this.posZ); this.setRotation(this.rotationYaw, this.rotationPitch); + if (par1NBTTagCompound.hasKey("ForgeData")) + { + customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData"); + } this.readEntityFromNBT(par1NBTTagCompound); }