diff --git a/src/resonantinduction/battery/TileEntityBattery.java b/src/resonantinduction/battery/TileEntityBattery.java index 19a8685c..0ecdc30a 100644 --- a/src/resonantinduction/battery/TileEntityBattery.java +++ b/src/resonantinduction/battery/TileEntityBattery.java @@ -11,8 +11,10 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; import resonantinduction.PacketHandler; import resonantinduction.api.IBattery; +import resonantinduction.api.ITesla; import resonantinduction.base.IPacketReceiver; import resonantinduction.base.ListUtil; import resonantinduction.base.TileEntityBase; @@ -24,7 +26,7 @@ import com.google.common.io.ByteArrayDataInput; * * @author AidanBrady */ -public class TileEntityBattery extends TileEntityBase implements IPacketReceiver, IInventory +public class TileEntityBattery extends TileEntityBase implements IPacketReceiver, IInventory, ITesla { public SynchronizedBatteryData structure = SynchronizedBatteryData.getBase(this); @@ -93,6 +95,7 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver for(int tagCount = 0; tagCount < tagList.tagCount(); tagCount++) { + System.out.println("Read"); NBTTagCompound tagCompound = (NBTTagCompound)tagList.tagAt(tagCount); int slotID = tagCompound.getInteger("Slot"); structure.inventory.add(slotID, ItemStack.loadItemStackFromNBT(tagCompound)); @@ -140,6 +143,7 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver { if(structure.inventory.get(slotCount) != null) { + System.out.println("Save"); NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setInteger("Slot", slotCount); structure.inventory.get(slotCount).writeToNBT(tagCompound); @@ -468,4 +472,16 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver { return false; } + + @Override + public float transfer(float transferEnergy, boolean doTransfer) + { + return addEnergy(transferEnergy, doTransfer); + } + + @Override + public boolean canReceive(TileEntity transferTile) + { + return true; + } } diff --git a/src/resonantinduction/contractor/TileEntityEMContractor.java b/src/resonantinduction/contractor/TileEntityEMContractor.java index 1790a576..37a63bee 100644 --- a/src/resonantinduction/contractor/TileEntityEMContractor.java +++ b/src/resonantinduction/contractor/TileEntityEMContractor.java @@ -29,7 +29,7 @@ import com.google.common.io.ByteArrayDataInput; * @author AidanBrady * */ -public class TileEntityEMContractor extends TileEntityBase implements IPacketReceiver, ITesla +public class TileEntityEMContractor extends TileEntityBase implements IPacketReceiver { public static int MAX_REACH = 40; public static int PUSH_DELAY = 5; @@ -41,8 +41,6 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec private int pushDelay; - private float energyStored; - private AxisAlignedBB operationBounds; private AxisAlignedBB suckBounds; @@ -159,8 +157,6 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec if (operationBounds != null) { - energyStored -= ENERGY_USAGE; - for (EntityItem entityItem : (List) worldObj.getEntitiesWithinAABB(EntityItem.class, operationBounds)) { if (this.worldObj.isRemote && this.ticks % 5 == 0) @@ -417,7 +413,6 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec this.facing = ForgeDirection.getOrientation(nbt.getInteger("facing")); this.suck = nbt.getBoolean("suck"); - this.energyStored = nbt.getFloat("energyStored"); this.dyeID = nbt.getInteger("dyeID"); this.tempLinkVector = new Vector3(nbt.getInteger("link_x"), nbt.getInteger("link_y"), nbt.getInteger("link_z")); updateBounds(); @@ -430,7 +425,6 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec nbt.setInteger("facing", facing.ordinal()); nbt.setBoolean("suck", suck); - nbt.setFloat("energyStored", energyStored); nbt.setInteger("dyeID", this.dyeID); if (this.linked != null) @@ -448,7 +442,6 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec { facing = ForgeDirection.getOrientation(input.readInt()); suck = input.readBoolean(); - energyStored = input.readFloat(); this.dyeID = input.readInt(); if (input.readBoolean()) @@ -469,7 +462,6 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec { data.add(facing.ordinal()); data.add(suck); - data.add(energyStored); data.add(this.dyeID); if (this.linked != null) @@ -487,25 +479,6 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec return data; } - @Override - public float transfer(float transferEnergy, boolean doTransfer) - { - float energyToUse = Math.min(transferEnergy, ENERGY_USAGE - energyStored); - - if (doTransfer) - { - energyStored += energyToUse; - } - - return energyToUse; - } - - @Override - public boolean canReceive(TileEntity transferTile) - { - return true; - } - /** * Link between two TileEntities, do pathfinding operation. */