From e87b6418e636b1760f3607a43ff32388bb34b230 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Mon, 4 Nov 2013 19:54:04 -0500 Subject: [PATCH] Added a tile that only stores NBT --- .../machine/TileEntityNBTContainer.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/dark/core/prefab/machine/TileEntityNBTContainer.java diff --git a/src/dark/core/prefab/machine/TileEntityNBTContainer.java b/src/dark/core/prefab/machine/TileEntityNBTContainer.java new file mode 100644 index 00000000..b2f6e898 --- /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; + } +}