diff --git a/Universal-Electricity b/Universal-Electricity index e69dcdcd..deaf0e46 160000 --- a/Universal-Electricity +++ b/Universal-Electricity @@ -1 +1 @@ -Subproject commit e69dcdcd40ba67043852826a9486eaf132fbe0dc +Subproject commit deaf0e46b7754fcce3b1ea22dc71f45e3a000131 diff --git a/src/resonantinduction/gui/GuiMultimeter.java b/src/resonantinduction/gui/GuiMultimeter.java index 23003190..99cda0dc 100644 --- a/src/resonantinduction/gui/GuiMultimeter.java +++ b/src/resonantinduction/gui/GuiMultimeter.java @@ -13,6 +13,7 @@ import resonantinduction.multimeter.PartMultimeter; import universalelectricity.api.energy.UnitDisplay.Unit; import calclavia.lib.gui.GuiContainerBase; import calclavia.lib.prefab.TranslationHelper; +import calclavia.lib.render.EnumColor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -76,13 +77,13 @@ public class GuiMultimeter extends GuiContainerBase { String s = TranslationHelper.getLocal("tile.resonantinduction:multimeter.name"); this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 15, 4210752); - this.fontRenderer.drawString("Average Energy:", 35, 15, 4210752); + this.fontRenderer.drawString(EnumColor.DARK_GREEN + "Average Energy:", 35, 15, 4210752); this.renderUniversalDisplay(35, 25, this.multimeter.getAverageDetectedEnergy(), par1, par2, Unit.JOULES); - this.fontRenderer.drawString("Energy:", 35, 35, 4210752); + this.fontRenderer.drawString(EnumColor.DARK_GREEN + "Energy:", 35, 35, 4210752); this.renderUniversalDisplay(35, 45, this.multimeter.getDetectedEnergy(), par1, par2, Unit.JOULES); - this.fontRenderer.drawString("Output Redstone If... ", 35, 54, 4210752); - this.fontRenderer.drawString(this.multimeter.getMode().display, 35, 65, 4210752); - this.fontRenderer.drawString("KiloJoules", 35, 100, 4210752); + this.fontRenderer.drawString(EnumColor.ORANGE + "Output Redstone If... ", 35, 58, 4210752); + this.fontRenderer.drawString(EnumColor.RED + this.multimeter.getMode().display, 35, 68, 4210752); + this.fontRenderer.drawString(Unit.JOULES.name + "(s)", 35, 100, 4210752); this.textFieldLimit.drawTextBox(); } diff --git a/src/resonantinduction/multimeter/PartMultimeter.java b/src/resonantinduction/multimeter/PartMultimeter.java index 9a59104e..b95d53f6 100644 --- a/src/resonantinduction/multimeter/PartMultimeter.java +++ b/src/resonantinduction/multimeter/PartMultimeter.java @@ -16,17 +16,17 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.ForgeDirection; import resonantinduction.ResonantInduction; -import resonantinduction.base.PartAdvanced; import universalelectricity.api.CompatibilityModule; import universalelectricity.api.energy.IConductor; import universalelectricity.api.energy.IEnergyNetwork; -import universalelectricity.api.net.IConnectable; import codechicken.lib.data.MCDataInput; import codechicken.lib.data.MCDataOutput; -import codechicken.lib.raytracer.IndexedCuboid6; import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Rotation; +import codechicken.lib.vec.Transformation; import codechicken.lib.vec.Vector3; +import codechicken.microblock.FaceMicroClass; +import codechicken.multipart.JCuboidPart; import codechicken.multipart.JNormalOcclusion; import codechicken.multipart.NormalOcclusionTest; import codechicken.multipart.TFacePart; @@ -40,17 +40,19 @@ import cpw.mods.fml.relauncher.SideOnly; * @author Calclavia * */ -public class PartMultimeter extends PartAdvanced implements IConnectable, TFacePart, JNormalOcclusion +public class PartMultimeter extends JCuboidPart implements TFacePart, JNormalOcclusion { - public static Cuboid6[] bounds = new Cuboid6[6]; + public static Cuboid6[][] bounds = new Cuboid6[6][2]; static { - // Subtract the box a little because we'd like things like posts to get first hit - Cuboid6 selection = new Cuboid6(0, 0, 0, 1, (2) / 16D, 1).expand(-0.005); - for (int s = 0; s < 6; s++) + bounds[0][0] = new Cuboid6(1 / 8D, 0, 0, 7 / 8D, 1 / 8D, 1); + bounds[0][1] = new Cuboid6(0, 0, 1 / 8D, 1, 1 / 8D, 7 / 8D); + for (int s = 1; s < 6; s++) { - bounds[s] = selection.copy().apply(Rotation.sideRotations[s].at(Vector3.center)); + Transformation t = Rotation.sideRotations[s].at(Vector3.center); + bounds[s][0] = bounds[0][0].copy().apply(t); + bounds[s][1] = bounds[0][1].copy().apply(t); } } @@ -76,6 +78,7 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP private long detectedAverageEnergy; public boolean redstoneOn; private byte side; + private int ticks; public void preparePlacement(int side, int itemDamage) { @@ -94,6 +97,8 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP { super.update(); + this.ticks++; + if (!world().isRemote) { if (ticks % 20 == 0) @@ -269,12 +274,6 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP return peakDetection; } - @Override - public boolean canConnect(ForgeDirection direction) - { - return direction == getDirection(); - } - @Override public String getType() { @@ -288,9 +287,9 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP } @Override - public Iterable getSubParts() + public Cuboid6 getBounds() { - return Arrays.asList(new IndexedCuboid6(0, bounds[side])); + return FaceMicroClass.aBounds()[0x10 | this.side]; } @Override diff --git a/src/resonantinduction/wire/ItemWire.java b/src/resonantinduction/wire/ItemWire.java index 8381ce36..3654b541 100644 --- a/src/resonantinduction/wire/ItemWire.java +++ b/src/resonantinduction/wire/ItemWire.java @@ -83,10 +83,10 @@ public class ItemWire extends JItemMultiPart } else { - list.add("Resistance: " + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE)); - list.add("Current Capacity: " + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE)); - list.add("Shock Damage: " + EnumWireMaterial.values()[itemstack.getItemDamage()].damage); - list.addAll(Calclavia.splitStringPerWord("The maximum energy transfer rate can be increased and the energy loss may be reduced by using higher the voltage of the network.", 5)); + list.add(EnumColor.AQUA + "Resistance: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE)); + list.add(EnumColor.AQUA + "Current Capacity: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE)); + list.add(EnumColor.AQUA + "Shock Damage: " + EnumColor.ORANGE + EnumWireMaterial.values()[itemstack.getItemDamage()].damage); + list.addAll(Calclavia.splitStringPerWord("The energy transfer rate can be increased and the energy loss may be reduced by using a higher the voltage.", 5)); } } diff --git a/src/resonantinduction/wire/part/PartConductor.java b/src/resonantinduction/wire/part/PartConductor.java index 9a6936b0..b8cefd34 100644 --- a/src/resonantinduction/wire/part/PartConductor.java +++ b/src/resonantinduction/wire/part/PartConductor.java @@ -54,17 +54,6 @@ public abstract class PartConductor extends PartAdvanced implements IConductor this.network = network; } - @Override - public void preRemove() - { - if (!world().isRemote) - { - this.getNetwork().split(this); - } - - super.preRemove(); - } - @Override public boolean doesTick() { @@ -131,11 +120,19 @@ public abstract class PartConductor extends PartAdvanced implements IConductor } @Override - public void onWorldSeparate() + public void preRemove() { - if (tile() instanceof IEnergyTile && !world().isRemote) + if (!world().isRemote) { - MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) tile())); + this.getNetwork().split(this); + + if (tile() instanceof IEnergyTile) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) tile())); + } } + + super.preRemove(); + } } diff --git a/src/resonantinduction/wire/part/TraitEnergySink.java b/src/resonantinduction/wire/part/TraitEnergySink.java index 74732379..e77d0725 100644 --- a/src/resonantinduction/wire/part/TraitEnergySink.java +++ b/src/resonantinduction/wire/part/TraitEnergySink.java @@ -86,7 +86,7 @@ public class TraitEnergySink extends TileMultipart implements IEnergySink TMultiPart part = this.partMap(dir.ordinal()); if (this.icInterfaces.contains(part)) - {System.out.println("DEMAND"+((IEnergySink) part).demandedEnergyUnits()); + { return ((IEnergySink) part).demandedEnergyUnits(); } }