Removed "constantly adding network"
This commit is contained in:
parent
cbec2db9c8
commit
16500fb538
7 changed files with 10 additions and 26 deletions
|
@ -45,7 +45,6 @@ public class TileGutter extends TileFluidNetwork implements IFluidPipe
|
||||||
this.setRenderSide(side, true);
|
this.setRenderSide(side, true);
|
||||||
connectedBlocks[side.ordinal()] = tileEntity;
|
connectedBlocks[side.ordinal()] = tileEntity;
|
||||||
}
|
}
|
||||||
getNetwork().markChanged();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,6 @@ public class PartMultimeter extends PartFace implements IConnector<MultimeterNet
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
this.ticks++;
|
this.ticks++;
|
||||||
getNetwork().addConnector(this);
|
|
||||||
|
|
||||||
if (!world().isRemote)
|
if (!world().isRemote)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,12 +32,16 @@ import universalelectricity.core.net.NetworkTickHandler;
|
||||||
public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanical> implements IMechanicalNetwork, IUpdate
|
public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanical> implements IMechanicalNetwork, IUpdate
|
||||||
{
|
{
|
||||||
public static final float ACCELERATION = 0.2f;
|
public static final float ACCELERATION = 0.2f;
|
||||||
|
|
||||||
/** 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;
|
||||||
|
|
||||||
/** 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>>();
|
* The cached connections of the mechanical network.
|
||||||
|
*/
|
||||||
|
private final HashMap<Object, EnumSet<ForgeDirection>> connectionMap = new LinkedHashMap<Object, EnumSet<ForgeDirection>>();
|
||||||
|
|
||||||
private boolean markUpdateRotation = true;
|
private boolean markUpdateRotation = true;
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
System.out.println("Connected with: " + i + ":" + getNetwork());
|
System.out.println("Connected with: " + i + ":" + getNetwork());
|
||||||
// efresh();
|
// refresh();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -77,9 +76,6 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
// TODO: Fix gear network somehow tick while network is invalid.
|
|
||||||
getNetwork().addConnector(this);
|
|
||||||
|
|
||||||
ticks++;
|
ticks++;
|
||||||
angle += angularVelocity / 20;
|
angle += angularVelocity / 20;
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,6 @@ public class PartPipe extends PartFramedConnection<EnumPipeMaterial, IFluidPipe,
|
||||||
sendFluidUpdate();
|
sendFluidUpdate();
|
||||||
markPacket = false;
|
markPacket = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNetwork().markChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendFluidUpdate()
|
public void sendFluidUpdate()
|
||||||
|
@ -126,7 +124,6 @@ public class PartPipe extends PartFramedConnection<EnumPipeMaterial, IFluidPipe,
|
||||||
if (doFill)
|
if (doFill)
|
||||||
{
|
{
|
||||||
markPacket = true;
|
markPacket = true;
|
||||||
getNetwork().markChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tank.fill(resource, doFill);
|
return tank.fill(resource, doFill);
|
||||||
|
@ -142,7 +139,6 @@ public class PartPipe extends PartFramedConnection<EnumPipeMaterial, IFluidPipe,
|
||||||
if (doDrain)
|
if (doDrain)
|
||||||
{
|
{
|
||||||
markPacket = true;
|
markPacket = true;
|
||||||
getNetwork().markChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tank.drain(resource.amount, doDrain);
|
return tank.drain(resource.amount, doDrain);
|
||||||
|
@ -158,7 +154,6 @@ public class PartPipe extends PartFramedConnection<EnumPipeMaterial, IFluidPipe,
|
||||||
if (doDrain)
|
if (doDrain)
|
||||||
{
|
{
|
||||||
markPacket = true;
|
markPacket = true;
|
||||||
getNetwork().markChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tank.drain(maxDrain, doDrain);
|
return tank.drain(maxDrain, doDrain);
|
||||||
|
|
|
@ -57,6 +57,4 @@ public interface IFluidNetwork extends INodeNetwork<IFluidNetwork, IFluidConnect
|
||||||
/** Information about the network's tank */
|
/** Information about the network's tank */
|
||||||
FluidTankInfo[] getTankInfo();
|
FluidTankInfo[] getTankInfo();
|
||||||
|
|
||||||
void markChanged();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@ public abstract class FluidNetwork extends NodeNetwork<IFluidNetwork, IFluidConn
|
||||||
@Override
|
@Override
|
||||||
public void addConnector(IFluidConnector connector)
|
public void addConnector(IFluidConnector connector)
|
||||||
{
|
{
|
||||||
markChanged();
|
|
||||||
super.addConnector(connector);
|
super.addConnector(connector);
|
||||||
|
NetworkTickHandler.addNetwork(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -106,8 +106,8 @@ public abstract class FluidNetwork extends NodeNetwork<IFluidNetwork, IFluidConn
|
||||||
this.tankInfo[0] = null;
|
this.tankInfo[0] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.distributeConnectors();
|
distributeConnectors();
|
||||||
markChanged();
|
NetworkTickHandler.addNetwork(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -204,11 +204,4 @@ public abstract class FluidNetwork extends NodeNetwork<IFluidNetwork, IFluidConn
|
||||||
{
|
{
|
||||||
return super.toString() + " Vol:" + this.tank.getFluidAmount();
|
return super.toString() + " Vol:" + this.tank.getFluidAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void markChanged()
|
|
||||||
{
|
|
||||||
NetworkTickHandler.addNetwork(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue