Save The NBT!!!!

Make sure to save stuff so that it keeps working over save and load!
This commit is contained in:
DarkholmeTenk 2014-03-11 04:46:57 +00:00
parent 8948f00165
commit 9018bb1b6b
2 changed files with 32 additions and 0 deletions

View file

@ -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()
{

View file

@ -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
{