Prevent block updates while loading parts; Should fix http://openeye.openmods.info/crashes/baf3e72a51ad8a5b8680ec24a819bc86
This commit is contained in:
parent
5c0ac30bf9
commit
dd9c85e43e
3 changed files with 14 additions and 6 deletions
|
@ -551,7 +551,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
||||||
if ( tile() instanceof TIInventoryTile )
|
if ( tile() instanceof TIInventoryTile )
|
||||||
((TIInventoryTile) tile()).rebuildSlotMap();
|
((TIInventoryTile) tile()).rebuildSlotMap();
|
||||||
|
|
||||||
if ( world() != null && world().blockExists( x(), y(), z() ) )
|
if ( world() != null && world().blockExists( x(), y(), z() ) && ! CableBusContainer.isLoading() )
|
||||||
world().notifyBlocksOfNeighborChange( x(), y(), z(), Platform.air );
|
world().notifyBlocksOfNeighborChange( x(), y(), z(), Platform.air );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,11 +320,20 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final ThreadLocal<Boolean> isLoading = new ThreadLocal();
|
||||||
|
|
||||||
|
public static boolean isLoading() {
|
||||||
|
Boolean is = isLoading.get();
|
||||||
|
return is != null && is == true;
|
||||||
|
}
|
||||||
|
|
||||||
public void addToWorld()
|
public void addToWorld()
|
||||||
{
|
{
|
||||||
if ( inWorld )
|
if ( inWorld )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inWorld = true;
|
inWorld = true;
|
||||||
|
isLoading.set( true );
|
||||||
|
|
||||||
TileEntity te = getTile();
|
TileEntity te = getTile();
|
||||||
hasRedstone = te.getWorldObj().isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord );
|
hasRedstone = te.getWorldObj().isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord );
|
||||||
|
@ -372,6 +381,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
partChanged();
|
partChanged();
|
||||||
|
|
||||||
|
isLoading.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFromWorld()
|
public void removeFromWorld()
|
||||||
|
|
|
@ -126,10 +126,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||||
if ( cb.isEmpty() )
|
if ( cb.isEmpty() )
|
||||||
{
|
{
|
||||||
if ( worldObj.getTileEntity( xCoord, yCoord, zCoord ) == this )
|
if ( worldObj.getTileEntity( xCoord, yCoord, zCoord ) == this )
|
||||||
{
|
|
||||||
worldObj.func_147480_a( xCoord, yCoord, zCoord, true );
|
worldObj.func_147480_a( xCoord, yCoord, zCoord, true );
|
||||||
// worldObj.destroyBlock( xCoord, yCoord, zCoord, true );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cb.addToWorld();
|
cb.addToWorld();
|
||||||
|
@ -295,7 +292,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||||
@Override
|
@Override
|
||||||
public void notifyNeighbors()
|
public void notifyNeighbors()
|
||||||
{
|
{
|
||||||
if ( worldObj != null && worldObj.blockExists( xCoord, yCoord, zCoord ) )
|
if ( worldObj != null && worldObj.blockExists( xCoord, yCoord, zCoord ) && ! CableBusContainer.isLoading() )
|
||||||
worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, Platform.air );
|
worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, Platform.air );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue