This commit is contained in:
Aidan Brady 2013-08-05 12:54:32 -04:00
commit 0de97ab6fa
2 changed files with 8 additions and 9 deletions

View file

@ -95,7 +95,7 @@ public class GuiMultimeter extends GuiContainer
GL11.glColor4f(1, 1, 1, 1); GL11.glColor4f(1, 1, 1, 1);
this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, this.xSize, this.ySize); 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); this.drawTexturedModalRect(this.containerWidth + 14, this.containerHeight + 126 - length, 176, 115 - length, 6, length);
} }

View file

@ -85,17 +85,17 @@ public class TileEntityMultimeter extends TileEntityBase implements IPacketRecei
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, ResonantInduction.blockMultimeter.blockID); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, ResonantInduction.blockMultimeter.blockID);
} }
/* if (prevDetectedEnergy != this.detectedEnergy)
* if (prevDetectedEnergy != this.detectedEnergy) { {
* this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
*/ }
} }
} }
@Override @Override
public Packet getDescriptionPacket() 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 @Override
@ -107,6 +107,7 @@ public class TileEntityMultimeter extends TileEntityBase implements IPacketRecei
{ {
default: default:
this.detectMode = DetectMode.values()[input.readByte()]; this.detectMode = DetectMode.values()[input.readByte()];
this.detectedEnergy = input.readFloat();
this.energyLimit = input.readFloat(); this.energyLimit = input.readFloat();
break; break;
case 2: case 2:
@ -132,9 +133,7 @@ public class TileEntityMultimeter extends TileEntityBase implements IPacketRecei
public float doGetDetectedEnergy() public float doGetDetectedEnergy()
{ {
ForgeDirection direction = ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); ForgeDirection direction = ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
ForgeDirection opp = direction.getOpposite(); TileEntity tileEntity = this.worldObj.getBlockTileEntity(this.xCoord + direction.offsetX, this.yCoord + direction.offsetY, this.zCoord + direction.offsetZ);
TileEntity tileEntity = this.worldObj.getBlockTileEntity(this.xCoord + opp.offsetX, this.yCoord + opp.offsetY, this.zCoord + opp.offsetZ);
return getDetectedEnergy(tileEntity); return getDetectedEnergy(tileEntity);
} }