From 9018bb1b6b29f5a852edffc53820b1c8768649b6 Mon Sep 17 00:00:00 2001 From: DarkholmeTenk Date: Tue, 11 Mar 2014 04:46:57 +0000 Subject: [PATCH] Save The NBT!!!! Make sure to save stuff so that it keeps working over save and load! --- .../machines/TileEntityLaserReactorMonitor.java | 15 +++++++++++++++ .../machines/TileEntityTransporter.java | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/cr0s/WarpDrive/machines/TileEntityLaserReactorMonitor.java b/src/cr0s/WarpDrive/machines/TileEntityLaserReactorMonitor.java index 2bfe6cd5..7c46c508 100644 --- a/src/cr0s/WarpDrive/machines/TileEntityLaserReactorMonitor.java +++ b/src/cr0s/WarpDrive/machines/TileEntityLaserReactorMonitor.java @@ -15,6 +15,7 @@ import cr0s.WarpDrive.WarpDriveConfig; import cr0s.WarpDrive.item.ItemReactorLaserFocus; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraftforge.common.ForgeDirection; @@ -134,6 +135,20 @@ public class TileEntityLaserReactorMonitor extends TileEntityAbstractLaser imple } } + @Override + public void writeToNBT(NBTTagCompound tag) + { + super.writeToNBT(tag); + tag.setDouble("energyStored", energyStored); + } + + @Override + public void readFromNBT(NBTTagCompound tag) + { + super.readFromNBT(tag); + energyStored = tag.getDouble("energyStored"); + } + @Override public boolean shouldChunkLoad() { diff --git a/src/cr0s/WarpDrive/machines/TileEntityTransporter.java b/src/cr0s/WarpDrive/machines/TileEntityTransporter.java index 91d130b1..e535b0d8 100644 --- a/src/cr0s/WarpDrive/machines/TileEntityTransporter.java +++ b/src/cr0s/WarpDrive/machines/TileEntityTransporter.java @@ -12,6 +12,7 @@ import cr0s.WarpDrive.WarpDriveConfig; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatMessageComponent; @@ -405,6 +406,22 @@ public class TileEntityTransporter extends WarpTE implements IEnergySink, IPerip super.invalidate(); } + @Override + public void writeToNBT(NBTTagCompound tag) + { + super.writeToNBT(tag); + tag.setDouble("energyBuffer",energyBuffer); + tag.setDouble("powerBoost", powerBoost); + } + + @Override + public void readFromNBT(NBTTagCompound tag) + { + super.readFromNBT(tag); + energyBuffer = tag.getDouble("energyBuffer"); + powerBoost = tag.getDouble("powerBoost"); + } + class TeleporterDamage extends DamageSource {