Minor packet and NBT bug fix

This commit is contained in:
Calclavia 2014-01-18 15:17:59 +08:00
parent 1ba081a992
commit e6970bc083
2 changed files with 11 additions and 1 deletions

View file

@ -103,6 +103,7 @@ public class TileGenerator extends TileElectrical implements IMechanical
{ {
super.readFromNBT(nbt); super.readFromNBT(nbt);
isInversed = nbt.getBoolean("isInversed"); isInversed = nbt.getBoolean("isInversed");
torqueRatio = nbt.getFloat("torqueRatio");
} }
@Override @Override
@ -110,5 +111,6 @@ public class TileGenerator extends TileElectrical implements IMechanical
{ {
super.writeToNBT(nbt); super.writeToNBT(nbt);
nbt.setBoolean("isInversed", isInversed); nbt.setBoolean("isInversed", isInversed);
nbt.setFloat("torqueRatio", torqueRatio);
} }
} }

View file

@ -41,10 +41,18 @@ public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanicalCo
/** The current rotation of the network */ /** The current rotation of the network */
private float rotation = 0; private float rotation = 0;
private long lastRotateTime; private long lastRotateTime;
private boolean markPacketUpdate = true;
/** The direction in which a conductor is placed relative to a specific conductor. */ /** The direction in which a conductor is placed relative to a specific conductor. */
protected final HashMap<Object, EnumSet<ForgeDirection>> handlerDirectionMap = new LinkedHashMap<Object, EnumSet<ForgeDirection>>(); protected final HashMap<Object, EnumSet<ForgeDirection>> handlerDirectionMap = new LinkedHashMap<Object, EnumSet<ForgeDirection>>();
@Override
public void addConnector(IMechanicalConnector connector)
{
this.markPacketUpdate = true;
super.addConnector(connector);
}
/** /**
* An network update called only server side. * An network update called only server side.
*/ */
@ -76,7 +84,7 @@ public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanicalCo
/** /**
* Update all connectors * Update all connectors
*/ */
if (getPrevTorque() != getTorque() || getPrevAngularVelocity() != getAngularVelocity()) if (markPacketUpdate || getPrevTorque() != getTorque() || getPrevAngularVelocity() != getAngularVelocity())
{ {
/** /**
* Send network update packet for connectors. * Send network update packet for connectors.