diff --git a/src/dark/core/prefab/machine/TileEntityNBTContainer.java b/src/dark/core/prefab/machine/TileEntityNBTContainer.java new file mode 100644 index 000000000..b2f6e898c --- /dev/null +++ b/src/dark/core/prefab/machine/TileEntityNBTContainer.java @@ -0,0 +1,42 @@ +package dark.core.prefab.machine; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +/** NBT Container blocks to use that don't really need a tileEntity for anything other than to record + * a few values + * + * @author DarkGuardsman */ +public class TileEntityNBTContainer extends TileEntity +{ + private NBTTagCompound saveData; + + public NBTTagCompound getSaveData() + { + if (this.saveData == null) + { + this.saveData = new NBTTagCompound(); + } + return saveData; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) + { + super.readFromNBT(nbt); + nbt.setCompoundTag("saveData", this.getSaveData()); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) + { + super.writeToNBT(nbt); + this.saveData = nbt.getCompoundTag("saveData"); + } + + @Override + public boolean canUpdate() + { + return false; + } +}