Multi-block clean up should be cleaner now.
This commit is contained in:
parent
ed85b174c6
commit
730200ed8d
6 changed files with 51 additions and 28 deletions
|
@ -3,10 +3,11 @@ package appeng.me.cluster;
|
|||
public interface IAEMultiBlock
|
||||
{
|
||||
|
||||
void disconnect();
|
||||
void disconnect(boolean b);
|
||||
|
||||
IAECluster getCluster();
|
||||
|
||||
boolean isValid();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class QuantumCalculator extends MBCalculator
|
|||
c.Ring[ringNum++] = te;
|
||||
}
|
||||
|
||||
te.updateStatus( c, flags );
|
||||
te.updateStatus( c, flags, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class QuantumCalculator extends MBCalculator
|
|||
@Override
|
||||
public void disconnect()
|
||||
{
|
||||
tqb.disconnect();
|
||||
tqb.disconnect(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,7 @@ public class QuantumCluster implements ILocatable, IAECluster
|
|||
public WorldCoord min;
|
||||
public WorldCoord max;
|
||||
public boolean isDestroyed = false;
|
||||
private boolean updateStatus = true;
|
||||
public boolean updateStatus = true;
|
||||
|
||||
boolean registered = false;
|
||||
private long thisSide;
|
||||
|
@ -211,14 +211,11 @@ public class QuantumCluster implements ILocatable, IAECluster
|
|||
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Unregister ) );
|
||||
}
|
||||
|
||||
if ( updateStatus )
|
||||
{
|
||||
center.updateStatus( null, (byte) -1 );
|
||||
center.updateStatus( null, (byte) -1, updateStatus );
|
||||
|
||||
for (TileQuantumBridge r : Ring)
|
||||
{
|
||||
r.updateStatus( null, (byte) -1 );
|
||||
}
|
||||
for (TileQuantumBridge r : Ring)
|
||||
{
|
||||
r.updateStatus( null, (byte) -1, updateStatus );
|
||||
}
|
||||
|
||||
center = null;
|
||||
|
|
|
@ -60,7 +60,7 @@ public class SpatialPylonCalculator extends MBCalculator
|
|||
@Override
|
||||
public void disconnect()
|
||||
{
|
||||
tqb.disconnect();
|
||||
tqb.disconnect(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -130,12 +130,20 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void disconnect()
|
||||
public void disconnect(boolean affectWorld)
|
||||
{
|
||||
if ( clust != null )
|
||||
{
|
||||
if ( ! affectWorld )
|
||||
clust.updateStatus = false;
|
||||
|
||||
clust.destroy();
|
||||
}
|
||||
|
||||
clust = null;
|
||||
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
|
||||
if ( affectWorld )
|
||||
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -158,22 +166,39 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
|||
gridProxy.setVisualRepresentation( ring );
|
||||
}
|
||||
|
||||
public void updateStatus(QuantumCluster c, byte flags)
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
disconnect(false);
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
disconnect(false);
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
public void updateStatus(QuantumCluster c, byte flags, boolean affectWorld)
|
||||
{
|
||||
clust = c;
|
||||
|
||||
if ( xdex != flags )
|
||||
if ( affectWorld )
|
||||
{
|
||||
xdex = flags;
|
||||
markForUpdate();
|
||||
if ( xdex != flags )
|
||||
{
|
||||
xdex = flags;
|
||||
markForUpdate();
|
||||
}
|
||||
|
||||
if ( isCorner() || isCenter() )
|
||||
{
|
||||
gridProxy.setValidSides( getConnections() );
|
||||
}
|
||||
else
|
||||
gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
|
||||
}
|
||||
|
||||
if ( isCorner() || isCenter() )
|
||||
{
|
||||
gridProxy.setValidSides( getConnections() );
|
||||
}
|
||||
else
|
||||
gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
|
||||
}
|
||||
|
||||
public long getQEDest()
|
||||
|
|
|
@ -127,15 +127,15 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
|||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
disconnect(false);
|
||||
super.invalidate();
|
||||
disconnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
disconnect(false);
|
||||
super.onChunkUnload();
|
||||
disconnect();
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange()
|
||||
|
@ -207,7 +207,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void disconnect()
|
||||
public void disconnect(boolean b)
|
||||
{
|
||||
if ( clust != null )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue