Little cleanup and removal of debug
This commit is contained in:
parent
92b047741e
commit
4fbbdd101b
1 changed files with 22 additions and 59 deletions
|
@ -31,6 +31,8 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
/** Packets */
|
||||
int ticks = 0;
|
||||
boolean markPacketUpdate = false;
|
||||
/** Simple debug external GUI */
|
||||
GearDebugFrame frame = null;
|
||||
|
||||
/** Side of the block this is placed on */
|
||||
public ForgeDirection placementSide = ForgeDirection.UNKNOWN;
|
||||
|
@ -47,13 +49,20 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
public void update()
|
||||
{
|
||||
ticks++;
|
||||
if (ticks >= Long.MAX_VALUE)
|
||||
{
|
||||
ticks = 0;
|
||||
}
|
||||
|
||||
if (!world().isRemote)
|
||||
{
|
||||
checkClientUpdate();
|
||||
node.debug("Part: " + this + " Node: " + this.node);
|
||||
this.node.update(0.05f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//System.out.println("Client->[" + this + "]Angle: " + node.renderAngle);
|
||||
}
|
||||
if (frame != null)
|
||||
{
|
||||
frame.update();
|
||||
|
@ -61,27 +70,17 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
super.update();
|
||||
}
|
||||
|
||||
GearDebugFrame frame = null;
|
||||
|
||||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack itemStack)
|
||||
{
|
||||
if (ResonantEngine.runningAsDev)
|
||||
{
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (!world().isRemote)
|
||||
if (itemStack != null && !world().isRemote)
|
||||
{
|
||||
if (itemStack.getItem().itemID == Item.stick.itemID)
|
||||
{
|
||||
|
||||
//Set the nodes debug mode
|
||||
if (!ControlKeyModifer.isControlDown(player))
|
||||
{
|
||||
this.node.doDebug = !this.node.doDebug;
|
||||
player.addChatMessage("[Debug] PartMechanical debug mode is now " + (this.node.doDebug ? "on" : "off"));
|
||||
}
|
||||
else
|
||||
if (ControlKeyModifer.isControlDown(player))
|
||||
{
|
||||
//Opens a debug GUI
|
||||
if (frame == null)
|
||||
|
@ -95,36 +94,6 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
frame = null;
|
||||
}
|
||||
}
|
||||
|
||||
}//Changes the debug cue of the node
|
||||
else if (itemStack.getItem().itemID == Item.blazeRod.itemID)
|
||||
{
|
||||
if (this.node.doDebug)
|
||||
{
|
||||
//Increases the cue count
|
||||
if (!ControlKeyModifer.isControlDown(player))
|
||||
{
|
||||
if (this.node.debugCue + 1 <= this.node.maxDebugCue)
|
||||
this.node.debugCue++;
|
||||
else
|
||||
{
|
||||
player.addChatMessage("[Debug] PartMechanical is at max debug cue");
|
||||
}
|
||||
|
||||
}//Decreases the cue count
|
||||
else
|
||||
{
|
||||
if (this.node.debugCue - 1 >= this.node.minDebugCue)
|
||||
this.node.debugCue--;
|
||||
else
|
||||
{
|
||||
player.addChatMessage("[Debug] PartMechanical is at min debug cue");
|
||||
}
|
||||
}
|
||||
player.addChatMessage("[Debug] PartMechanical debug due is now " + this.node.debugCue);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,16 +102,10 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
|
||||
public void checkClientUpdate()
|
||||
{
|
||||
if (Math.abs(prevAngularVelocity - node.angularVelocity) > 0.001f || (prevAngularVelocity != node.angularVelocity && (prevAngularVelocity == 0 || node.angularVelocity == 0)))
|
||||
if (Math.abs(prevAngularVelocity - node.angularVelocity) >= 0.1)
|
||||
{
|
||||
prevAngularVelocity = node.angularVelocity;
|
||||
markPacketUpdate = true;
|
||||
}
|
||||
|
||||
if (markPacketUpdate && ticks % 10 == 0)
|
||||
{
|
||||
sendRotationPacket();
|
||||
markPacketUpdate = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue