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;
|
public float acceleration = 2f;
|
||||||
|
|
||||||
/** The current rotation of the mechanical node. */
|
/** The current rotation of the mechanical node. */
|
||||||
public double angle = 0;
|
public double renderAngle = 0;
|
||||||
public double prev_angle = 0;
|
public double prev_angle = 0;
|
||||||
/** Limits the max distance an object can rotate in a single update */
|
/** Limits the max distance an object can rotate in a single update */
|
||||||
protected double maxDeltaAngle = Math.toRadians(180);
|
protected double maxDeltaAngle = Math.toRadians(180);
|
||||||
|
@ -64,22 +64,26 @@ public class MechanicalNode extends Node<INodeProvider, TickingGrid, MechanicalN
|
||||||
public void update(float deltaTime)
|
public void update(float deltaTime)
|
||||||
{
|
{
|
||||||
prevAngularVelocity = angularVelocity;
|
prevAngularVelocity = angularVelocity;
|
||||||
|
if (world() != null && !world().isRemote)
|
||||||
|
System.out.println("\nNode :" + toString());
|
||||||
//Update
|
//Update
|
||||||
|
if (world() != null && !world().isRemote)
|
||||||
|
System.out.println("AngleBefore: " + renderAngle + " Vel: " + angularVelocity);
|
||||||
if (angularVelocity >= 0)
|
if (angularVelocity >= 0)
|
||||||
{
|
{
|
||||||
angle += Math.min(angularVelocity, this.maxDeltaAngle) * deltaTime;
|
renderAngle += Math.min(angularVelocity, this.maxDeltaAngle) * deltaTime;
|
||||||
}
|
}
|
||||||
else
|
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();
|
revolve();
|
||||||
angle = angle % (Math.PI * 2);
|
renderAngle = renderAngle % (Math.PI * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world() != null && !world().isRemote)
|
if (world() != null && !world().isRemote)
|
||||||
|
@ -164,7 +168,7 @@ public class MechanicalNode extends Node<INodeProvider, TickingGrid, MechanicalN
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdate();
|
onUpdate();
|
||||||
prev_angle = angle;
|
prev_angle = renderAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onUpdate()
|
protected void onUpdate()
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class RenderPump extends TileEntitySpecialRenderer
|
||||||
List<String> notRendered = new ArrayList<String>();
|
List<String> notRendered = new ArrayList<String>();
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
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++)
|
for (int i = 1; i <= 12; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class GearNode extends MechanicalNode
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate()
|
public void onUpdate()
|
||||||
{
|
{
|
||||||
|
super.onUpdate();
|
||||||
if (!gear().getMultiBlock().isPrimary())
|
if (!gear().getMultiBlock().isPrimary())
|
||||||
{
|
{
|
||||||
torque = 0;
|
torque = 0;
|
||||||
|
|
|
@ -70,6 +70,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
||||||
|
|
||||||
if (!this.world().isRemote)
|
if (!this.world().isRemote)
|
||||||
{
|
{
|
||||||
|
System.out.println(this + ">>>" + this.node);
|
||||||
if (manualCrankTime > 0)
|
if (manualCrankTime > 0)
|
||||||
{
|
{
|
||||||
node.apply(this, isClockwiseCrank ? 15 : -15, isClockwiseCrank ? 0.025f : -0.025f);
|
node.apply(this, isClockwiseCrank ? 15 : -15, isClockwiseCrank ? 0.025f : -0.025f);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class RenderGear implements ISimpleItemRenderer
|
||||||
// Center the model first.
|
// Center the model first.
|
||||||
GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
|
GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
|
||||||
GL11.glPushMatrix();
|
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();
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class RenderGearShaft implements ISimpleItemRenderer
|
||||||
break;
|
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)
|
switch (part.tier)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class RenderMechanicalPiston extends TileEntitySpecialRenderer
|
||||||
RenderUtility.bind(TEXTURE);
|
RenderUtility.bind(TEXTURE);
|
||||||
|
|
||||||
// Angle in radians of the rotor.
|
// 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[] staticParts = { "baseRing", "leg1", "leg2", "leg3", "leg4", "connector", "basePlate", "basePlateTop", "connectorBar", "centerPiston" };
|
||||||
final String[] shaftParts = { "topPlate", "outerPiston" };
|
final String[] shaftParts = { "topPlate", "outerPiston" };
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class RenderGrindingWheel extends TileEntitySpecialRenderer
|
||||||
ForgeDirection dir = tile.getDirection();
|
ForgeDirection dir = tile.getDirection();
|
||||||
dir = ForgeDirection.getOrientation(!(dir.ordinal() % 2 == 0) ? dir.ordinal() - 1 : dir.ordinal());
|
dir = ForgeDirection.getOrientation(!(dir.ordinal() % 2 == 0) ? dir.ordinal() - 1 : dir.ordinal());
|
||||||
RenderUtility.rotateBlockBasedOnDirection(dir);
|
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");
|
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png");
|
||||||
MODEL.renderAllExcept("teeth");
|
MODEL.renderAllExcept("teeth");
|
||||||
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png");
|
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png");
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class RenderMixer extends TileEntitySpecialRenderer implements ISimpleIte
|
||||||
RenderUtility.bind(TEXTURE);
|
RenderUtility.bind(TEXTURE);
|
||||||
MODEL.renderOnly("centerTop", "centerBase");
|
MODEL.renderOnly("centerTop", "centerBase");
|
||||||
glPushMatrix();
|
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");
|
MODEL.renderAllExcept("centerTop", "centerBase");
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
Loading…
Reference in a new issue