Cleaned up debug messages making them easier to read

This commit is contained in:
Robert S 2014-06-05 01:08:47 -04:00
parent 7196ee31e4
commit 055bbf4b82
5 changed files with 27 additions and 15 deletions

View file

@ -61,7 +61,7 @@ public class TileMotor extends TileElectrical implements IRotatable, INodeProvid
if (node != null)
{
node.update(0.05f);
node.update(0.05f);
if (!isInversed)
{
receiveMechanical();
@ -174,4 +174,10 @@ public class TileMotor extends TileElectrical implements IRotatable, INodeProvid
return null;
}
@Override
public String toString()
{
return "[TileMotor]" + x() + "x " + y() + "y " + z() + "z ";
}
}

View file

@ -65,19 +65,22 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
public void debug(String txt)
{
if (doDebug)
System.out.println("[MechMode]" + txt);
debug(txt, false);
}
public void debug(String txt, boolean nextLine)
{
if (doDebug && world() != null && !world().isRemote)
System.out.println((nextLine ? "\n" : "") + "[MechMode]" + txt);
}
@Override
public void update(float deltaTime)
{
debug("Node->Update");
prevAngularVelocity = angularVelocity;
if (world() != null && !world().isRemote)
debug("Node :" + toString());
debug("\tNode :" + toString());
//Update
if (world() != null && !world().isRemote)
debug("AngleBefore: " + renderAngle + " Vel: " + angularVelocity);
if (angularVelocity >= 0)
{
renderAngle += Math.min(angularVelocity, this.maxDeltaAngle) * deltaTime;
@ -86,8 +89,7 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
{
renderAngle += Math.max(angularVelocity, -this.maxDeltaAngle) * deltaTime;
}
if (world() != null && !world().isRemote)
debug("AngleAfter: " + renderAngle + " Vel: " + angularVelocity);
debug("\tAngle: " + renderAngle + " Vel: " + angularVelocity);
if (renderAngle % (Math.PI * 2) != renderAngle)
{
@ -129,6 +131,7 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
power = getEnergy() / deltaTime;
debug("Node->Connections");
synchronized (connections)
{
Iterator<Entry<MechanicalNode, ForgeDirection>> it = connections.entrySet().iterator();
@ -139,7 +142,7 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
ForgeDirection dir = entry.getValue();
MechanicalNode adjacentMech = entry.getKey();
debug("Connection: " + adjacentMech + " Side: " + dir);
debug("\tConnection: " + adjacentMech + " Side: " + dir);
/** Calculate angular velocity and torque. */
float ratio = adjacentMech.getRatio(dir.getOpposite(), this) / getRatio(dir, adjacentMech);
boolean inverseRotation = inverseRotation(dir, adjacentMech) && adjacentMech.inverseRotation(dir.getOpposite(), this);
@ -321,4 +324,9 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
this.parent = parent;
}
@Override
public String toString()
{
return this.getClass().getName() + this.hashCode();
}
}

View file

@ -50,7 +50,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
if (!world().isRemote)
{
checkClientUpdate();
System.out.println("\nPart: " + this + " Node: " + this.node);
node.debug("Part: " + this + " Node: " + this.node);
this.node.update(0.05f);
}

View file

@ -81,7 +81,7 @@ public class GearNode extends MechanicalNode
@Override
public void recache()
{
System.out.println("doRecache: " + this);
debug("doRecache: " + this);
connections.clear();
/** Only call refresh if this is the main block of a multiblock gear or a single gear block. */

View file

@ -70,12 +70,10 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
if (!this.world().isRemote)
{
//System.out.println(this + ">>>" + this.node);
this.node.update(0.05f);
if (manualCrankTime > 0)
{
node.apply(this, isClockwiseCrank ? 15 : -15, isClockwiseCrank ? 0.025f : -0.025f);
manualCrankTime--;
//manualCrankTime--;
}
}
getMultiBlock().update();