Another chunk loading fix attempt

This commit is contained in:
DarkholmeTenk 2014-02-22 13:29:07 +00:00
parent b029908028
commit d9289e3e1b
2 changed files with 15 additions and 6 deletions

View file

@ -114,6 +114,9 @@ public class TileEntityMiningLaser extends WarpChunkTE implements IPeripheral, I
@Override
public void updateEntity()
{
if(shouldChunkLoad() != areChunksLoaded)
refreshLoading();
if(minLayer > yCoord - 1)
minLayer = yCoord - 1;
if(currentLayer > yCoord - 1)
@ -157,8 +160,8 @@ public class TileEntityMiningLaser extends WarpChunkTE implements IPeripheral, I
}
if (currentLayer < minLayer)
{
refreshLoading();
isMining = false;
refreshLoading();
}
}
}
@ -462,7 +465,7 @@ public class TileEntityMiningLaser extends WarpChunkTE implements IPeripheral, I
minChunk = worldObj.getChunkFromBlockCoords(xmin,zmin).getChunkCoordIntPair();
maxChunk = worldObj.getChunkFromBlockCoords(xmax,zmax).getChunkCoordIntPair();
refreshLoading();
refreshLoading(true);
// Search for valuable blocks
for (int x = xmin; x <= xmax; x++)

View file

@ -22,11 +22,12 @@ public abstract class WarpChunkTE extends TileEntity
boolean areChunksLoaded = false;
public void refreshLoading()
public void refreshLoading(boolean force)
{
boolean load = shouldChunkLoad();
if(ticketList.size() != 0)
{
if(shouldChunkLoad() && !areChunksLoaded)
if(load && (!areChunksLoaded || force))
{
int ticketSize = ticketList.get(0).getMaxChunkListDepth();
ArrayList<ChunkCoordIntPair> chunkList = getChunksToLoad();
@ -56,7 +57,7 @@ public abstract class WarpChunkTE extends TileEntity
}
areChunksLoaded = true;
}
else if(areChunksLoaded)
else if(!load)
{
for(Ticket ticket:ticketList)
{
@ -71,12 +72,17 @@ public abstract class WarpChunkTE extends TileEntity
areChunksLoaded = false;
}
}
else
else if(load)
{
WarpDrive.instance.registerChunkLoadTE(this);
}
}
public void refreshLoading()
{
refreshLoading(false);
}
public void giveTicket(Ticket t)
{
ticketList.add(t);