Fixed multimeter no-clipping
This commit is contained in:
parent
041f8ff5cd
commit
5164f86590
6 changed files with 39 additions and 42 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit e69dcdcd40ba67043852826a9486eaf132fbe0dc
|
Subproject commit deaf0e46b7754fcce3b1ea22dc71f45e3a000131
|
|
@ -13,6 +13,7 @@ import resonantinduction.multimeter.PartMultimeter;
|
||||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||||
import calclavia.lib.gui.GuiContainerBase;
|
import calclavia.lib.gui.GuiContainerBase;
|
||||||
import calclavia.lib.prefab.TranslationHelper;
|
import calclavia.lib.prefab.TranslationHelper;
|
||||||
|
import calclavia.lib.render.EnumColor;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -76,13 +77,13 @@ public class GuiMultimeter extends GuiContainerBase
|
||||||
{
|
{
|
||||||
String s = TranslationHelper.getLocal("tile.resonantinduction:multimeter.name");
|
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(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.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.renderUniversalDisplay(35, 45, this.multimeter.getDetectedEnergy(), par1, par2, Unit.JOULES);
|
||||||
this.fontRenderer.drawString("Output Redstone If... ", 35, 54, 4210752);
|
this.fontRenderer.drawString(EnumColor.ORANGE + "Output Redstone If... ", 35, 58, 4210752);
|
||||||
this.fontRenderer.drawString(this.multimeter.getMode().display, 35, 65, 4210752);
|
this.fontRenderer.drawString(EnumColor.RED + this.multimeter.getMode().display, 35, 68, 4210752);
|
||||||
this.fontRenderer.drawString("KiloJoules", 35, 100, 4210752);
|
this.fontRenderer.drawString(Unit.JOULES.name + "(s)", 35, 100, 4210752);
|
||||||
|
|
||||||
this.textFieldLimit.drawTextBox();
|
this.textFieldLimit.drawTextBox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,17 +16,17 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
import resonantinduction.base.PartAdvanced;
|
|
||||||
import universalelectricity.api.CompatibilityModule;
|
import universalelectricity.api.CompatibilityModule;
|
||||||
import universalelectricity.api.energy.IConductor;
|
import universalelectricity.api.energy.IConductor;
|
||||||
import universalelectricity.api.energy.IEnergyNetwork;
|
import universalelectricity.api.energy.IEnergyNetwork;
|
||||||
import universalelectricity.api.net.IConnectable;
|
|
||||||
import codechicken.lib.data.MCDataInput;
|
import codechicken.lib.data.MCDataInput;
|
||||||
import codechicken.lib.data.MCDataOutput;
|
import codechicken.lib.data.MCDataOutput;
|
||||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
|
||||||
import codechicken.lib.vec.Cuboid6;
|
import codechicken.lib.vec.Cuboid6;
|
||||||
import codechicken.lib.vec.Rotation;
|
import codechicken.lib.vec.Rotation;
|
||||||
|
import codechicken.lib.vec.Transformation;
|
||||||
import codechicken.lib.vec.Vector3;
|
import codechicken.lib.vec.Vector3;
|
||||||
|
import codechicken.microblock.FaceMicroClass;
|
||||||
|
import codechicken.multipart.JCuboidPart;
|
||||||
import codechicken.multipart.JNormalOcclusion;
|
import codechicken.multipart.JNormalOcclusion;
|
||||||
import codechicken.multipart.NormalOcclusionTest;
|
import codechicken.multipart.NormalOcclusionTest;
|
||||||
import codechicken.multipart.TFacePart;
|
import codechicken.multipart.TFacePart;
|
||||||
|
@ -40,17 +40,19 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
* @author Calclavia
|
* @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
|
static
|
||||||
{
|
{
|
||||||
// Subtract the box a little because we'd like things like posts to get first hit
|
bounds[0][0] = new Cuboid6(1 / 8D, 0, 0, 7 / 8D, 1 / 8D, 1);
|
||||||
Cuboid6 selection = new Cuboid6(0, 0, 0, 1, (2) / 16D, 1).expand(-0.005);
|
bounds[0][1] = new Cuboid6(0, 0, 1 / 8D, 1, 1 / 8D, 7 / 8D);
|
||||||
for (int s = 0; s < 6; s++)
|
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;
|
private long detectedAverageEnergy;
|
||||||
public boolean redstoneOn;
|
public boolean redstoneOn;
|
||||||
private byte side;
|
private byte side;
|
||||||
|
private int ticks;
|
||||||
|
|
||||||
public void preparePlacement(int side, int itemDamage)
|
public void preparePlacement(int side, int itemDamage)
|
||||||
{
|
{
|
||||||
|
@ -94,6 +97,8 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP
|
||||||
{
|
{
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
|
this.ticks++;
|
||||||
|
|
||||||
if (!world().isRemote)
|
if (!world().isRemote)
|
||||||
{
|
{
|
||||||
if (ticks % 20 == 0)
|
if (ticks % 20 == 0)
|
||||||
|
@ -269,12 +274,6 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP
|
||||||
return peakDetection;
|
return peakDetection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canConnect(ForgeDirection direction)
|
|
||||||
{
|
|
||||||
return direction == getDirection();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getType()
|
public String getType()
|
||||||
{
|
{
|
||||||
|
@ -288,9 +287,9 @@ public class PartMultimeter extends PartAdvanced implements IConnectable, TFaceP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<IndexedCuboid6> getSubParts()
|
public Cuboid6 getBounds()
|
||||||
{
|
{
|
||||||
return Arrays.asList(new IndexedCuboid6(0, bounds[side]));
|
return FaceMicroClass.aBounds()[0x10 | this.side];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -83,10 +83,10 @@ public class ItemWire extends JItemMultiPart
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
list.add("Resistance: " + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE));
|
list.add(EnumColor.AQUA + "Resistance: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE));
|
||||||
list.add("Current Capacity: " + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE));
|
list.add(EnumColor.AQUA + "Current Capacity: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE));
|
||||||
list.add("Shock Damage: " + EnumWireMaterial.values()[itemstack.getItemDamage()].damage);
|
list.add(EnumColor.AQUA + "Shock Damage: " + EnumColor.ORANGE + 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.addAll(Calclavia.splitStringPerWord("The energy transfer rate can be increased and the energy loss may be reduced by using a higher the voltage.", 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,17 +54,6 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
||||||
this.network = network;
|
this.network = network;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void preRemove()
|
|
||||||
{
|
|
||||||
if (!world().isRemote)
|
|
||||||
{
|
|
||||||
this.getNetwork().split(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.preRemove();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesTick()
|
public boolean doesTick()
|
||||||
{
|
{
|
||||||
|
@ -131,11 +120,19 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class TraitEnergySink extends TileMultipart implements IEnergySink
|
||||||
TMultiPart part = this.partMap(dir.ordinal());
|
TMultiPart part = this.partMap(dir.ordinal());
|
||||||
|
|
||||||
if (this.icInterfaces.contains(part))
|
if (this.icInterfaces.contains(part))
|
||||||
{System.out.println("DEMAND"+((IEnergySink) part).demandedEnergyUnits());
|
{
|
||||||
return ((IEnergySink) part).demandedEnergyUnits();
|
return ((IEnergySink) part).demandedEnergyUnits();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue