From db5d1a002aae58f91c85f81e7ed849074a1805a9 Mon Sep 17 00:00:00 2001 From: Calclavia Date: Mon, 5 Aug 2013 12:37:27 -0400 Subject: [PATCH] Fixed multimeter detection wrong side --- .../multimeter/GuiMultimeter.java | 2 +- .../multimeter/TileEntityMultimeter.java | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/resonantinduction/multimeter/GuiMultimeter.java b/src/resonantinduction/multimeter/GuiMultimeter.java index 0e1bdd7b..59941018 100644 --- a/src/resonantinduction/multimeter/GuiMultimeter.java +++ b/src/resonantinduction/multimeter/GuiMultimeter.java @@ -95,7 +95,7 @@ public class GuiMultimeter extends GuiContainer GL11.glColor4f(1, 1, 1, 1); this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, this.xSize, this.ySize); - int length = (int) (this.tileEntity.getDetectedEnergy() / this.tileEntity.getPeak()) * 115; + int length = Math.min((int) (this.tileEntity.getDetectedEnergy() / this.tileEntity.getPeak()) * 115, 115); this.drawTexturedModalRect(this.containerWidth + 14, this.containerHeight + 126 - length, 176, 115 - length, 6, length); } diff --git a/src/resonantinduction/multimeter/TileEntityMultimeter.java b/src/resonantinduction/multimeter/TileEntityMultimeter.java index e7b91026..7b3e361b 100644 --- a/src/resonantinduction/multimeter/TileEntityMultimeter.java +++ b/src/resonantinduction/multimeter/TileEntityMultimeter.java @@ -85,17 +85,17 @@ public class TileEntityMultimeter extends TileEntityBase implements IPacketRecei this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, ResonantInduction.blockMultimeter.blockID); } - /* - * if (prevDetectedEnergy != this.detectedEnergy) { - * this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } - */ + if (prevDetectedEnergy != this.detectedEnergy) + { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } } } @Override public Packet getDescriptionPacket() { - return PacketHandler.getTileEntityPacket(this, (byte) 1, (byte) this.detectMode.ordinal(), this.energyLimit); + return PacketHandler.getTileEntityPacket(this, (byte) 1, (byte) this.detectMode.ordinal(), this.detectedEnergy, this.energyLimit); } @Override @@ -107,6 +107,7 @@ public class TileEntityMultimeter extends TileEntityBase implements IPacketRecei { default: this.detectMode = DetectMode.values()[input.readByte()]; + this.detectedEnergy = input.readFloat(); this.energyLimit = input.readFloat(); break; case 2: @@ -132,9 +133,7 @@ public class TileEntityMultimeter extends TileEntityBase implements IPacketRecei public float doGetDetectedEnergy() { ForgeDirection direction = ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); - ForgeDirection opp = direction.getOpposite(); - TileEntity tileEntity = this.worldObj.getBlockTileEntity(this.xCoord + opp.offsetX, this.yCoord + opp.offsetY, this.zCoord + opp.offsetZ); - + TileEntity tileEntity = this.worldObj.getBlockTileEntity(this.xCoord + direction.offsetX, this.yCoord + direction.offsetY, this.zCoord + direction.offsetZ); return getDetectedEnergy(tileEntity); }