diff --git a/src/resonantinduction/base/PartAdvanced.java b/src/resonantinduction/base/PartAdvanced.java index 7982a7f5..a62666d9 100644 --- a/src/resonantinduction/base/PartAdvanced.java +++ b/src/resonantinduction/base/PartAdvanced.java @@ -11,12 +11,12 @@ public abstract class PartAdvanced extends TMultiPart @Override public void update() { - if(ticks == 0) + if (ticks == 0) { initiate(); } - if(ticks >= Long.MAX_VALUE) + if (ticks >= Long.MAX_VALUE) { ticks = 1; } @@ -24,14 +24,10 @@ public abstract class PartAdvanced extends TMultiPart ticks++; } - @Override - public void onAdded() - { - world().notifyBlocksOfNeighborChange(x(), y(), z(), ((Block)MultipartProxy.block()).blockID); - } - /** * Called on the TileEntity's first tick. */ - public void initiate() {} + public void initiate() + { + } } diff --git a/src/resonantinduction/gui/GuiMultimeter.java b/src/resonantinduction/gui/GuiMultimeter.java index 99cda0dc..032a4b09 100644 --- a/src/resonantinduction/gui/GuiMultimeter.java +++ b/src/resonantinduction/gui/GuiMultimeter.java @@ -92,8 +92,8 @@ public class GuiMultimeter extends GuiContainerBase protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { super.drawGuiContainerBackgroundLayer(f, x, y); - int length = Math.min((int) (this.multimeter.getDetectedEnergy() / this.multimeter.getPeak()) * 115, 115); - this.drawTexturedModalRect(this.containerWidth + 14, this.containerHeight + 126 - length, 176, 115 - length, 6, length); + /*int length = Math.min((int) (this.multimeter.getDetectedEnergy() / this.multimeter.getPeak()) * 115, 115); + this.drawTexturedModalRect(this.containerWidth + 14, this.containerHeight + 126 - length, 176, 115 - length, 6, length);*/ } @Override diff --git a/src/resonantinduction/multimeter/PartMultimeter.java b/src/resonantinduction/multimeter/PartMultimeter.java index b95d53f6..3487ec74 100644 --- a/src/resonantinduction/multimeter/PartMultimeter.java +++ b/src/resonantinduction/multimeter/PartMultimeter.java @@ -226,12 +226,12 @@ public class PartMultimeter extends JCuboidPart implements TFacePart, JNormalOcc peakDetection = Math.max(peakDetection, detectedEnergy); } - public float getDetectedEnergy() + public long getDetectedEnergy() { return detectedEnergy; } - public float getAverageDetectedEnergy() + public long getAverageDetectedEnergy() { return detectedAverageEnergy; } diff --git a/src/resonantinduction/wire/part/PartConductor.java b/src/resonantinduction/wire/part/PartConductor.java index b8cefd34..d2b415ca 100644 --- a/src/resonantinduction/wire/part/PartConductor.java +++ b/src/resonantinduction/wire/part/PartConductor.java @@ -1,5 +1,6 @@ package resonantinduction.wire.part; +import codechicken.multipart.TMultiPart; import ic2.api.energy.event.EnergyTileLoadEvent; import ic2.api.energy.event.EnergyTileUnloadEvent; import ic2.api.energy.tile.IEnergyTile; @@ -115,7 +116,24 @@ public abstract class PartConductor extends PartAdvanced implements IConductor { if (tile() instanceof IEnergyTile && !world().isRemote) { - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile) tile())); + // Check if there's another part that's an IEnergyTile + boolean foundAnotherPart = false; + + for (int i = 0; i < tile().partList().size(); i++) + { + TMultiPart part = tile().partMap(i); + + if (part instanceof IEnergyTile) + { + foundAnotherPart = true; + break; + } + } + + if (!foundAnotherPart) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile) tile())); + } } } @@ -125,10 +143,27 @@ public abstract class PartConductor extends PartAdvanced implements IConductor if (!world().isRemote) { this.getNetwork().split(this); - + if (tile() instanceof IEnergyTile) { - MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) tile())); + // Check if there's another part that's an IEnergyTile + boolean foundAnotherPart = false; + + for (int i = 0; i < tile().partList().size(); i++) + { + TMultiPart part = tile().partMap(i); + + if (part instanceof IEnergyTile) + { + foundAnotherPart = true; + break; + } + } + + if (!foundAnotherPart) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) tile())); + } } }