Small mechanical fixes

This commit is contained in:
Calclavia 2014-03-04 22:57:49 +08:00
parent abdb29a4ec
commit 26007d60aa
5 changed files with 12 additions and 8 deletions

View file

@ -286,6 +286,7 @@ public class PartMultimeter extends PartFace implements IConnector<MultimeterNet
{ {
getNetwork().torqueGraph.queue(instance.getTorque()); getNetwork().torqueGraph.queue(instance.getTorque());
getNetwork().angularVelocityGraph.queue(instance.getAngularVelocity()); getNetwork().angularVelocityGraph.queue(instance.getAngularVelocity());
System.out.println(instance.getPower());
getNetwork().powerGraph.queue((long) instance.getPower()); getNetwork().powerGraph.queue((long) instance.getPower());
} }
} }

View file

@ -19,7 +19,7 @@ public class MultipartMechanical implements IPartFactory
MultiPartRegistry.registerParts(this, PART_TYPES); MultiPartRegistry.registerParts(this, PART_TYPES);
MultipartGenerator.registerPassThroughInterface("resonantinduction.core.fluid.IPressurizedNode"); MultipartGenerator.registerPassThroughInterface("resonantinduction.core.fluid.IPressurizedNode");
MultipartGenerator.registerPassThroughInterface("resonantinduction.api.mechanical.fluid.IPressure"); MultipartGenerator.registerPassThroughInterface("resonantinduction.api.mechanical.fluid.IPressure");
MultipartGenerator.registerTrait("resonantinduction.api.mechanical.IMechanicalNodeProvider", "resonantinduction.mechanical.trait.TraitMechanical"); MultipartGenerator.registerTrait("resonantinduction.mechanical.energy.network.IMechanicalNodeProvider", "resonantinduction.mechanical.trait.TraitMechanical");
} }
@Override @Override

View file

@ -133,9 +133,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
/** /**
* Look for gears that are internal and adjacent to this gear. (The 4 sides + * Look for gears that are internal and adjacent to this gear. (The 4 sides +
* the * the internal center)
* internal
* center)
*/ */
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
@ -365,6 +363,8 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
@Override @Override
public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack itemStack) public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack itemStack)
{ {
if (!world().isRemote)
System.out.println(node.getGrid());
if (itemStack != null && itemStack.getItem() instanceof ItemHandCrank) if (itemStack != null && itemStack.getItem() instanceof ItemHandCrank)
{ {
if (!world().isRemote && ControlKeyModifer.isControlDown(player)) if (!world().isRemote && ControlKeyModifer.isControlDown(player))

View file

@ -1,6 +1,7 @@
package resonantinduction.mechanical.energy.network; package resonantinduction.mechanical.energy.network;
import resonantinduction.core.grid.NodeGrid; import resonantinduction.core.grid.NodeGrid;
import universalelectricity.core.net.NetworkTickHandler;
/** /**
* A mechanical network for translate speed and force using mechanical rotations. * A mechanical network for translate speed and force using mechanical rotations.
@ -24,5 +25,6 @@ public class MechanicalNetwork extends NodeGrid<MechanicalNode>
{ {
super(MechanicalNode.class); super(MechanicalNode.class);
add(node); add(node);
NetworkTickHandler.addNetwork(this);
} }
} }

View file

@ -28,7 +28,7 @@ public class MechanicalNode extends EnergyNode
*/ */
public double angle = 0; public double angle = 0;
protected double load = 1; protected double load = 5;
protected byte connectionMap = Byte.parseByte("111111", 2); protected byte connectionMap = Byte.parseByte("111111", 2);
private double power = 0; private double power = 0;
@ -68,13 +68,14 @@ public class MechanicalNode extends EnergyNode
angle = angle % (Math.PI * 2); angle = angle % (Math.PI * 2);
} }
if (!world().isRemote) //TODO: Remove upon split.
if (world() != null && !world().isRemote)
{ {
/** /**
* Loss energy * Loss energy
*/ */
torque -= torque * torque * getTorqueLoad() * deltaTime; torque -= torque * getTorqueLoad() * deltaTime;
angularVelocity -= angularVelocity * angularVelocity * getAngularVelocityLoad() * deltaTime; angularVelocity -= angularVelocity * getAngularVelocityLoad() * deltaTime;
synchronized (connections) synchronized (connections)
{ {