Changed angle to renderAngle making it clear its a client only var
This commit is contained in:
parent
cf7876add2
commit
4070d0e4ce
9 changed files with 22 additions and 16 deletions
|
@ -26,7 +26,7 @@ public class MechanicalNode extends Node<INodeProvider, TickingGrid, MechanicalN
|
|||
public float acceleration = 2f;
|
||||
|
||||
/** The current rotation of the mechanical node. */
|
||||
public double angle = 0;
|
||||
public double renderAngle = 0;
|
||||
public double prev_angle = 0;
|
||||
/** Limits the max distance an object can rotate in a single update */
|
||||
protected double maxDeltaAngle = Math.toRadians(180);
|
||||
|
@ -53,7 +53,7 @@ public class MechanicalNode extends Node<INodeProvider, TickingGrid, MechanicalN
|
|||
this.connectionMap = connectionMap;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getRadius()
|
||||
{
|
||||
|
@ -64,22 +64,26 @@ public class MechanicalNode extends Node<INodeProvider, TickingGrid, MechanicalN
|
|||
public void update(float deltaTime)
|
||||
{
|
||||
prevAngularVelocity = angularVelocity;
|
||||
|
||||
if (world() != null && !world().isRemote)
|
||||
System.out.println("\nNode :" + toString());
|
||||
//Update
|
||||
if (world() != null && !world().isRemote)
|
||||
System.out.println("AngleBefore: " + renderAngle + " Vel: " + angularVelocity);
|
||||
if (angularVelocity >= 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<INodeProvider, TickingGrid, MechanicalN
|
|||
}
|
||||
|
||||
onUpdate();
|
||||
prev_angle = angle;
|
||||
prev_angle = renderAngle;
|
||||
}
|
||||
|
||||
protected void onUpdate()
|
||||
|
@ -290,6 +294,6 @@ public class MechanicalNode extends Node<INodeProvider, TickingGrid, MechanicalN
|
|||
super.save(nbt);
|
||||
nbt.setDouble("torque", torque);
|
||||
nbt.setDouble("angularVelocity", angularVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class RenderPump extends TileEntitySpecialRenderer
|
|||
List<String> notRendered = new ArrayList<String>();
|
||||
|
||||
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++)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ public class GearNode extends MechanicalNode
|
|||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
if (!gear().getMultiBlock().isPrimary())
|
||||
{
|
||||
torque = 0;
|
||||
|
|
|
@ -70,6 +70,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
|
||||
if (!this.world().isRemote)
|
||||
{
|
||||
System.out.println(this + ">>>" + this.node);
|
||||
if (manualCrankTime > 0)
|
||||
{
|
||||
node.apply(this, isClockwiseCrank ? 15 : -15, isClockwiseCrank ? 0.025f : -0.025f);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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" };
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue