diff --git a/src/resonantinduction/battery/TileEntityBattery.java b/src/resonantinduction/battery/TileEntityBattery.java index d00b9c9e..774dbc9b 100644 --- a/src/resonantinduction/battery/TileEntityBattery.java +++ b/src/resonantinduction/battery/TileEntityBattery.java @@ -596,7 +596,7 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements @Override public float getRequest(ForgeDirection direction) { - return this.getMaxEnergyStored() - this.getEnergyStored(); + return Math.min(this.getMaxEnergyStored() - this.getEnergyStored(), this.transferThreshold); } @Override diff --git a/src/resonantinduction/multimeter/ItemBlockMultimeter.java b/src/resonantinduction/multimeter/ItemBlockMultimeter.java index 2ad81e66..b29a746e 100644 --- a/src/resonantinduction/multimeter/ItemBlockMultimeter.java +++ b/src/resonantinduction/multimeter/ItemBlockMultimeter.java @@ -10,6 +10,7 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; /** * ItemBlock for the Multimeter @@ -49,7 +50,7 @@ public class ItemBlockMultimeter extends ItemBlock { // if (!world.isRemote) { - par2EntityPlayer.addChatMessage("Energy: " + TileEntityMultimeter.getDetectedEnergy(world.getBlockTileEntity(x, y, z)) + " J"); + par2EntityPlayer.addChatMessage("Energy: " + TileEntityMultimeter.getDetectedEnergy(ForgeDirection.getOrientation(par7), world.getBlockTileEntity(x, y, z)) + " J"); } return true; diff --git a/src/resonantinduction/multimeter/TileEntityMultimeter.java b/src/resonantinduction/multimeter/TileEntityMultimeter.java index 967aad5d..0662f305 100644 --- a/src/resonantinduction/multimeter/TileEntityMultimeter.java +++ b/src/resonantinduction/multimeter/TileEntityMultimeter.java @@ -3,6 +3,8 @@ */ package resonantinduction.multimeter; +import ic2.api.tile.IEnergyStorage; + import java.util.ArrayList; import java.util.HashSet; import java.util.Set; @@ -22,6 +24,7 @@ import universalelectricity.core.grid.IElectricityNetwork; import universalelectricity.prefab.tile.IRotatable; import universalelectricity.prefab.tile.TileEntityAdvanced; import universalelectricity.prefab.tile.TileEntityElectrical; +import buildcraft.api.power.IPowerReceptor; import com.google.common.io.ByteArrayDataInput; @@ -157,10 +160,10 @@ public class TileEntityMultimeter extends TileEntityAdvanced implements IPacketR { ForgeDirection direction = this.getDirection(); TileEntity tileEntity = this.worldObj.getBlockTileEntity(this.xCoord + direction.offsetX, this.yCoord + direction.offsetY, this.zCoord + direction.offsetZ); - return getDetectedEnergy(tileEntity); + return getDetectedEnergy(direction.getOpposite(), tileEntity); } - public static float getDetectedEnergy(TileEntity tileEntity) + public static float getDetectedEnergy(ForgeDirection side, TileEntity tileEntity) { if (tileEntity instanceof TileEntityElectrical) { @@ -179,6 +182,21 @@ public class TileEntityMultimeter extends TileEntityAdvanced implements IPacketR return MultimeterEventHandler.getCache(tileEntity.worldObj).get(network); } } + else if (tileEntity instanceof IEnergyStorage) + { + return ((IEnergyStorage) tileEntity).getStored(); + } + else if (tileEntity instanceof IEnergyStorage) + { + return ((IEnergyStorage) tileEntity).getStored(); + } + else if (tileEntity instanceof IPowerReceptor) + { + if (((IPowerReceptor) tileEntity).getPowerReceiver(side) != null) + { + return ((IPowerReceptor) tileEntity).getPowerReceiver(side).getEnergyStored(); + } + } return 0; } diff --git a/src/resonantinduction/wire/BlockWire.java b/src/resonantinduction/wire/BlockWire.java index cdf4e1e9..898ec4a0 100644 --- a/src/resonantinduction/wire/BlockWire.java +++ b/src/resonantinduction/wire/BlockWire.java @@ -51,7 +51,7 @@ public class BlockWire extends BlockConductor tileEntity.setDye(entityPlayer.getCurrentEquippedItem().getItemDamage()); return true; } - else if (entityPlayer.getCurrentEquippedItem().itemID == Block.cloth.blockID) + else if (entityPlayer.getCurrentEquippedItem().itemID == Block.cloth.blockID && !tileEntity.isInsulated) { tileEntity.setInsulated(); tileEntity.setDye(BlockColored.getDyeFromBlock(entityPlayer.getCurrentEquippedItem().getItemDamage()));