Resolved #172 - Multimeter can now go flat on the ground

This commit is contained in:
Calclavia 2014-02-22 14:33:30 +08:00
parent 31c44b5c57
commit c643a40ca9
4 changed files with 54 additions and 27 deletions

View file

@ -33,11 +33,6 @@ public class ItemMultimeter extends JItemMultiPart implements IHighlight
{
side = FacePlacementGrid$.MODULE$.getHitSlot(hit, side);
if (side <= 1)
{
return null;
}
PartMultimeter part = (PartMultimeter) MultiPartRegistry.createPart("resonant_induction_multimeter", false);
if (part != null)

View file

@ -31,6 +31,7 @@ public class MultimeterNetwork extends Network<MultimeterNetwork, PartMultimeter
public final GraphI fluidGraph = new GraphI(maxData);
/**
* The absolute center of the multimeter screens.
*/

View file

@ -54,8 +54,8 @@ public class RenderMultimeter implements ISimpleItemRenderer
RenderUtility.renderCube(-0.501, -0.0501, -0.501, 0.501, 0.0501, -0.44, ResonantInduction.blockMachinePart, null, metadata);
// DOWN
RenderUtility.renderCube(-0.501, -0.0501, 0.44, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
// LEFT
for (int i = 2; i < 6; i++)
for (int i = 0; i < 6; i++)
{
ForgeDirection check = ForgeDirection.getOrientation(i);
@ -100,42 +100,68 @@ public class RenderMultimeter implements ISimpleItemRenderer
// Render the main panel
RenderUtility.renderCube(-0.5, -0.05, -0.5, 0.5, 0.05, 0.5, ResonantInduction.blockMachinePart, RenderUtility.loadedIconMap.get(Reference.PREFIX + "multimeter_screen"));
final int metadata = 8;
// Render edges
// UP
if (!part.hasMultimeter(part.x(), part.y() + 1, part.z()))
RenderUtility.renderCube(-0.501, -0.0501, -0.501, 0.501, 0.0501, -0.44, ResonantInduction.blockMachinePart, null, metadata);
// DOWN
if (!part.hasMultimeter(part.x(), part.y() - 1, part.z()))
RenderUtility.renderCube(-0.501, -0.0501, 0.44, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
// LEFT
for (int i = 2; i < 6; i++)
for (int i = 0; i < 6; i++)
{
ForgeDirection check = ForgeDirection.getOrientation(i);
if (!part.hasMultimeter(part.x() + check.offsetX, part.y() + check.offsetY, part.z() + check.offsetZ))
{
if (dir.offsetX != 0 && check.offsetZ != 0)
if (dir.offsetX != 0)
{
if (dir.offsetX != check.offsetZ)
if (check.offsetZ != 0)
{
RenderUtility.renderCube(-0.501, -0.0501, -0.501, -0.44, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
if (dir.offsetX != check.offsetZ)
RenderUtility.renderCube(-0.501, -0.0501, -0.501, -0.44, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
else if (dir.offsetX == check.offsetZ)
RenderUtility.renderCube(0.44, -0.0501, -0.501, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
}
else if (dir.offsetX == check.offsetZ)
else if (check.offsetY != 0)
{
RenderUtility.renderCube(0.44, -0.0501, -0.501, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
if (dir.offsetX != check.offsetY)
RenderUtility.renderCube(-0.501, -0.0501, 0.44, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
else if (dir.offsetX == check.offsetY)
RenderUtility.renderCube(-0.501, -0.0501, -0.501, 0.501, 0.0501, -0.44, ResonantInduction.blockMachinePart, null, metadata);
}
}
if (dir.offsetZ != 0 && check.offsetX != 0)
if (dir.offsetZ != 0)
{
if (dir.offsetZ == check.offsetX)
if (check.offsetX != 0)
{
RenderUtility.renderCube(-0.501, -0.0501, -0.501, -0.44, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
if (dir.offsetZ == check.offsetX)
RenderUtility.renderCube(-0.501, -0.0501, -0.501, -0.44, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
else if (dir.offsetZ != check.offsetX)
RenderUtility.renderCube(0.44, -0.0501, -0.501, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
}
else if (dir.offsetZ != check.offsetX)
else if (check.offsetY != 0)
{
RenderUtility.renderCube(0.44, -0.0501, -0.501, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
if (dir.offsetZ != check.offsetY)
RenderUtility.renderCube(-0.501, -0.0501, -0.501, 0.501, 0.0501, -0.44, ResonantInduction.blockMachinePart, null, metadata);
else if (dir.offsetZ == check.offsetY)
RenderUtility.renderCube(-0.501, -0.0501, 0.44, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
}
}
if (dir.offsetY != 0)
{
if (check.offsetX != 0)
{
if (dir.offsetY != check.offsetX)
RenderUtility.renderCube(0.44, -0.0501, -0.501, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
else if (dir.offsetY == check.offsetX)
RenderUtility.renderCube(-0.501, -0.0501, -0.501, -0.44, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
}
else if (check.offsetZ != 0)
{
if (dir.offsetY != check.offsetZ)
RenderUtility.renderCube(-0.501, -0.0501, 0.44, 0.501, 0.0501, 0.501, ResonantInduction.blockMachinePart, null, metadata);
else if (dir.offsetY == check.offsetZ)
RenderUtility.renderCube(-0.501, -0.0501, -0.501, 0.501, 0.0501, -0.44, ResonantInduction.blockMachinePart, null, metadata);
}
}
}
}
@ -152,9 +178,8 @@ public class RenderMultimeter implements ISimpleItemRenderer
Vector3 centerTranslation = part.getNetwork().center.clone().subtract(part.x(), part.y(), part.z()).add(-0.5);
GL11.glTranslated(centerTranslation.x, centerTranslation.y, centerTranslation.z);
RenderUtility.rotateFaceBlockToSideOutwards(part.getDirection().getOpposite());
GL11.glTranslated(0, 0.05, 0);
GL11.glTranslated(0, 0.07, 0);
// TODO: Add other dispaly info support.
List<String> information = new ArrayList<String>();
if (part.getNetwork().energyGraph.get(0) > 0 && part.getNetwork().energyGraph.points.size() > 0)

View file

@ -66,6 +66,12 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
return "resonant_induction_wire";
}
@Override
public boolean doesTick()
{
return false;
}
@Override
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
{