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
2012-03-26 05:02:13 +00:00
@@ -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++;
2012-03-26 05:02:13 +00:00
@@ -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;
2012-03-26 05:02:13 +00:00
@@ -1183,6 +1200,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);
}
2012-03-26 05:02:13 +00:00
@@ -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"))
2012-01-15 19:16:08 +00:00
+ {
+ customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData");
+ }
this.readEntityFromNBT(par1NBTTagCompound);
}