Cleaned up debug messages making them easier to read
This commit is contained in:
parent
7196ee31e4
commit
055bbf4b82
5 changed files with 27 additions and 15 deletions
|
@ -174,4 +174,10 @@ public class TileMotor extends TileElectrical implements IRotatable, INodeProvid
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "[TileMotor]" + x() + "x " + y() + "y " + z() + "z ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,19 +65,22 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
|
||||||
|
|
||||||
public void debug(String txt)
|
public void debug(String txt)
|
||||||
{
|
{
|
||||||
if (doDebug)
|
debug(txt, false);
|
||||||
System.out.println("[MechMode]" + txt);
|
}
|
||||||
|
|
||||||
|
public void debug(String txt, boolean nextLine)
|
||||||
|
{
|
||||||
|
if (doDebug && world() != null && !world().isRemote)
|
||||||
|
System.out.println((nextLine ? "\n" : "") + "[MechMode]" + txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(float deltaTime)
|
public void update(float deltaTime)
|
||||||
{
|
{
|
||||||
|
debug("Node->Update");
|
||||||
prevAngularVelocity = angularVelocity;
|
prevAngularVelocity = angularVelocity;
|
||||||
if (world() != null && !world().isRemote)
|
debug("\tNode :" + toString());
|
||||||
debug("Node :" + toString());
|
|
||||||
//Update
|
//Update
|
||||||
if (world() != null && !world().isRemote)
|
|
||||||
debug("AngleBefore: " + renderAngle + " Vel: " + angularVelocity);
|
|
||||||
if (angularVelocity >= 0)
|
if (angularVelocity >= 0)
|
||||||
{
|
{
|
||||||
renderAngle += Math.min(angularVelocity, this.maxDeltaAngle) * deltaTime;
|
renderAngle += Math.min(angularVelocity, this.maxDeltaAngle) * deltaTime;
|
||||||
|
@ -86,8 +89,7 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
|
||||||
{
|
{
|
||||||
renderAngle += Math.max(angularVelocity, -this.maxDeltaAngle) * deltaTime;
|
renderAngle += Math.max(angularVelocity, -this.maxDeltaAngle) * deltaTime;
|
||||||
}
|
}
|
||||||
if (world() != null && !world().isRemote)
|
debug("\tAngle: " + renderAngle + " Vel: " + angularVelocity);
|
||||||
debug("AngleAfter: " + renderAngle + " Vel: " + angularVelocity);
|
|
||||||
|
|
||||||
if (renderAngle % (Math.PI * 2) != renderAngle)
|
if (renderAngle % (Math.PI * 2) != renderAngle)
|
||||||
{
|
{
|
||||||
|
@ -129,6 +131,7 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
|
||||||
|
|
||||||
power = getEnergy() / deltaTime;
|
power = getEnergy() / deltaTime;
|
||||||
|
|
||||||
|
debug("Node->Connections");
|
||||||
synchronized (connections)
|
synchronized (connections)
|
||||||
{
|
{
|
||||||
Iterator<Entry<MechanicalNode, ForgeDirection>> it = connections.entrySet().iterator();
|
Iterator<Entry<MechanicalNode, ForgeDirection>> it = connections.entrySet().iterator();
|
||||||
|
@ -139,7 +142,7 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
|
||||||
|
|
||||||
ForgeDirection dir = entry.getValue();
|
ForgeDirection dir = entry.getValue();
|
||||||
MechanicalNode adjacentMech = entry.getKey();
|
MechanicalNode adjacentMech = entry.getKey();
|
||||||
debug("Connection: " + adjacentMech + " Side: " + dir);
|
debug("\tConnection: " + adjacentMech + " Side: " + dir);
|
||||||
/** Calculate angular velocity and torque. */
|
/** Calculate angular velocity and torque. */
|
||||||
float ratio = adjacentMech.getRatio(dir.getOpposite(), this) / getRatio(dir, adjacentMech);
|
float ratio = adjacentMech.getRatio(dir.getOpposite(), this) / getRatio(dir, adjacentMech);
|
||||||
boolean inverseRotation = inverseRotation(dir, adjacentMech) && adjacentMech.inverseRotation(dir.getOpposite(), this);
|
boolean inverseRotation = inverseRotation(dir, adjacentMech) && adjacentMech.inverseRotation(dir.getOpposite(), this);
|
||||||
|
@ -321,4 +324,9 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return this.getClass().getName() + this.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
if (!world().isRemote)
|
if (!world().isRemote)
|
||||||
{
|
{
|
||||||
checkClientUpdate();
|
checkClientUpdate();
|
||||||
System.out.println("\nPart: " + this + " Node: " + this.node);
|
node.debug("Part: " + this + " Node: " + this.node);
|
||||||
this.node.update(0.05f);
|
this.node.update(0.05f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class GearNode extends MechanicalNode
|
||||||
@Override
|
@Override
|
||||||
public void recache()
|
public void recache()
|
||||||
{
|
{
|
||||||
System.out.println("doRecache: " + this);
|
debug("doRecache: " + this);
|
||||||
connections.clear();
|
connections.clear();
|
||||||
|
|
||||||
/** Only call refresh if this is the main block of a multiblock gear or a single gear block. */
|
/** Only call refresh if this is the main block of a multiblock gear or a single gear block. */
|
||||||
|
|
|
@ -70,12 +70,10 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
||||||
|
|
||||||
if (!this.world().isRemote)
|
if (!this.world().isRemote)
|
||||||
{
|
{
|
||||||
//System.out.println(this + ">>>" + this.node);
|
|
||||||
this.node.update(0.05f);
|
|
||||||
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);
|
||||||
manualCrankTime--;
|
//manualCrankTime--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getMultiBlock().update();
|
getMultiBlock().update();
|
||||||
|
|
Loading…
Reference in a new issue