From 4070d0e4ceb8adf037623bfea9649776cf7fbad4 Mon Sep 17 00:00:00 2001 From: Robert S Date: Wed, 4 Jun 2014 08:24:46 -0400 Subject: [PATCH] Changed angle to renderAngle making it clear its a client only var --- .../energy/grid/MechanicalNode.java | 24 +++++++++++-------- .../fluid/transport/RenderPump.java | 2 +- .../mechanical/gear/GearNode.java | 1 + .../mechanical/gear/PartGear.java | 1 + .../mechanical/gear/RenderGear.java | 2 +- .../mechanical/gearshaft/RenderGearShaft.java | 2 +- .../crusher/RenderMechanicalPiston.java | 2 +- .../process/grinder/RenderGrindingWheel.java | 2 +- .../process/purifier/RenderMixer.java | 2 +- 9 files changed, 22 insertions(+), 16 deletions(-) diff --git a/mechanical/src/main/scala/resonantinduction/mechanical/energy/grid/MechanicalNode.java b/mechanical/src/main/scala/resonantinduction/mechanical/energy/grid/MechanicalNode.java index ebe3658b..1b9c4843 100644 --- a/mechanical/src/main/scala/resonantinduction/mechanical/energy/grid/MechanicalNode.java +++ b/mechanical/src/main/scala/resonantinduction/mechanical/energy/grid/MechanicalNode.java @@ -26,7 +26,7 @@ public class MechanicalNode extends Node= 0) { - angle += Math.min(angularVelocity, this.maxDeltaAngle) * deltaTime; + renderAngle += Math.min(angularVelocity, this.maxDeltaAngle) * deltaTime; } else { - angle += Math.max(angularVelocity, -this.maxDeltaAngle) * deltaTime; + renderAngle += Math.max(angularVelocity, -this.maxDeltaAngle) * deltaTime; } - //System.out.println("Angle: " + angle); + if (world() != null && !world().isRemote) + System.out.println("AngleAfter: " + renderAngle + " Vel: " + angularVelocity); - if (angle % (Math.PI * 2) != angle) + if (renderAngle % (Math.PI * 2) != renderAngle) { revolve(); - angle = angle % (Math.PI * 2); + renderAngle = renderAngle % (Math.PI * 2); } if (world() != null && !world().isRemote) @@ -164,7 +168,7 @@ public class MechanicalNode extends Node notRendered = new ArrayList(); GL11.glPushMatrix(); - GL11.glRotated(Math.toDegrees((float) tile.mechanicalNode.angle), 0, 0, 1); + GL11.glRotated(Math.toDegrees((float) tile.mechanicalNode.renderAngle), 0, 0, 1); for (int i = 1; i <= 12; i++) { diff --git a/mechanical/src/main/scala/resonantinduction/mechanical/gear/GearNode.java b/mechanical/src/main/scala/resonantinduction/mechanical/gear/GearNode.java index 386bf243..ca256ceb 100644 --- a/mechanical/src/main/scala/resonantinduction/mechanical/gear/GearNode.java +++ b/mechanical/src/main/scala/resonantinduction/mechanical/gear/GearNode.java @@ -27,6 +27,7 @@ public class GearNode extends MechanicalNode @Override public void onUpdate() { + super.onUpdate(); if (!gear().getMultiBlock().isPrimary()) { torque = 0; diff --git a/mechanical/src/main/scala/resonantinduction/mechanical/gear/PartGear.java b/mechanical/src/main/scala/resonantinduction/mechanical/gear/PartGear.java index 29f6d099..2dc92c35 100644 --- a/mechanical/src/main/scala/resonantinduction/mechanical/gear/PartGear.java +++ b/mechanical/src/main/scala/resonantinduction/mechanical/gear/PartGear.java @@ -70,6 +70,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure>>" + this.node); if (manualCrankTime > 0) { node.apply(this, isClockwiseCrank ? 15 : -15, isClockwiseCrank ? 0.025f : -0.025f); diff --git a/mechanical/src/main/scala/resonantinduction/mechanical/gear/RenderGear.java b/mechanical/src/main/scala/resonantinduction/mechanical/gear/RenderGear.java index 8675ae72..fc7f25b0 100644 --- a/mechanical/src/main/scala/resonantinduction/mechanical/gear/RenderGear.java +++ b/mechanical/src/main/scala/resonantinduction/mechanical/gear/RenderGear.java @@ -59,7 +59,7 @@ public class RenderGear implements ISimpleItemRenderer // Center the model first. GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f); GL11.glPushMatrix(); - renderGear(part.placementSide.ordinal(), part.tier, part.getMultiBlock().isConstructed(), Math.toDegrees(part.node.angle)); + renderGear(part.placementSide.ordinal(), part.tier, part.getMultiBlock().isConstructed(), Math.toDegrees(part.node.renderAngle)); GL11.glPopMatrix(); GL11.glPopMatrix(); } diff --git a/mechanical/src/main/scala/resonantinduction/mechanical/gearshaft/RenderGearShaft.java b/mechanical/src/main/scala/resonantinduction/mechanical/gearshaft/RenderGearShaft.java index 20cf4712..caa940bc 100644 --- a/mechanical/src/main/scala/resonantinduction/mechanical/gearshaft/RenderGearShaft.java +++ b/mechanical/src/main/scala/resonantinduction/mechanical/gearshaft/RenderGearShaft.java @@ -63,7 +63,7 @@ public class RenderGearShaft implements ISimpleItemRenderer break; } - GL11.glRotatef((float) Math.toDegrees(part.node.angle), 0, 1, 0); + GL11.glRotatef((float) Math.toDegrees(part.node.renderAngle), 0, 1, 0); switch (part.tier) { diff --git a/mechanical/src/main/scala/resonantinduction/mechanical/process/crusher/RenderMechanicalPiston.java b/mechanical/src/main/scala/resonantinduction/mechanical/process/crusher/RenderMechanicalPiston.java index 3391869b..145d4aa6 100644 --- a/mechanical/src/main/scala/resonantinduction/mechanical/process/crusher/RenderMechanicalPiston.java +++ b/mechanical/src/main/scala/resonantinduction/mechanical/process/crusher/RenderMechanicalPiston.java @@ -39,7 +39,7 @@ public class RenderMechanicalPiston extends TileEntitySpecialRenderer RenderUtility.bind(TEXTURE); // Angle in radians of the rotor. - double angle = tile.mechanicalNode.angle; + double angle = tile.mechanicalNode.renderAngle; final String[] staticParts = { "baseRing", "leg1", "leg2", "leg3", "leg4", "connector", "basePlate", "basePlateTop", "connectorBar", "centerPiston" }; final String[] shaftParts = { "topPlate", "outerPiston" }; diff --git a/mechanical/src/main/scala/resonantinduction/mechanical/process/grinder/RenderGrindingWheel.java b/mechanical/src/main/scala/resonantinduction/mechanical/process/grinder/RenderGrindingWheel.java index 8db68193..39cc4f66 100644 --- a/mechanical/src/main/scala/resonantinduction/mechanical/process/grinder/RenderGrindingWheel.java +++ b/mechanical/src/main/scala/resonantinduction/mechanical/process/grinder/RenderGrindingWheel.java @@ -36,7 +36,7 @@ public class RenderGrindingWheel extends TileEntitySpecialRenderer ForgeDirection dir = tile.getDirection(); dir = ForgeDirection.getOrientation(!(dir.ordinal() % 2 == 0) ? dir.ordinal() - 1 : dir.ordinal()); RenderUtility.rotateBlockBasedOnDirection(dir); - glRotatef((float) Math.toDegrees(tile.mechanicalNode.angle), 0, 0, 1); + glRotatef((float) Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 0, 1); RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png"); MODEL.renderAllExcept("teeth"); RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png"); diff --git a/mechanical/src/main/scala/resonantinduction/mechanical/process/purifier/RenderMixer.java b/mechanical/src/main/scala/resonantinduction/mechanical/process/purifier/RenderMixer.java index 87d3eaec..c5171adb 100644 --- a/mechanical/src/main/scala/resonantinduction/mechanical/process/purifier/RenderMixer.java +++ b/mechanical/src/main/scala/resonantinduction/mechanical/process/purifier/RenderMixer.java @@ -40,7 +40,7 @@ public class RenderMixer extends TileEntitySpecialRenderer implements ISimpleIte RenderUtility.bind(TEXTURE); MODEL.renderOnly("centerTop", "centerBase"); glPushMatrix(); - glRotatef((float) Math.toDegrees((float) tile.mechanicalNode.angle), 0, 1, 0); + glRotatef((float) Math.toDegrees((float) tile.mechanicalNode.renderAngle), 0, 1, 0); MODEL.renderAllExcept("centerTop", "centerBase"); glPopMatrix(); glPopMatrix();