Multi-block clean up should be cleaner now.

This commit is contained in:
AlgorithmX2 2014-06-13 14:39:36 -05:00
parent ed85b174c6
commit 730200ed8d
6 changed files with 51 additions and 28 deletions

View file

@ -3,10 +3,11 @@ package appeng.me.cluster;
public interface IAEMultiBlock
{
void disconnect();
void disconnect(boolean b);
IAECluster getCluster();
boolean isValid();
}

View file

@ -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

View file

@ -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 );
}
r.updateStatus( null, (byte) -1, updateStatus );
}
center = null;

View file

@ -60,7 +60,7 @@ public class SpatialPylonCalculator extends MBCalculator
@Override
public void disconnect()
{
tqb.disconnect();
tqb.disconnect(true);
}
@Override

View file

@ -130,11 +130,19 @@ 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;
if ( affectWorld )
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
@ -158,10 +166,26 @@ 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 ( affectWorld )
{
if ( xdex != flags )
{
xdex = flags;
@ -175,6 +199,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
else
gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
}
}
public long getQEDest()
{

View file

@ -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 )
{