From d9289e3e1bf71a3d656053e9d989af4c004cf0a1 Mon Sep 17 00:00:00 2001 From: DarkholmeTenk Date: Sat, 22 Feb 2014 13:29:07 +0000 Subject: [PATCH] Another chunk loading fix attempt --- .../WarpDrive/machines/TileEntityMiningLaser.java | 7 +++++-- src/cr0s/WarpDrive/machines/WarpChunkTE.java | 14 ++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/cr0s/WarpDrive/machines/TileEntityMiningLaser.java b/src/cr0s/WarpDrive/machines/TileEntityMiningLaser.java index 941bede4..e82e16cf 100644 --- a/src/cr0s/WarpDrive/machines/TileEntityMiningLaser.java +++ b/src/cr0s/WarpDrive/machines/TileEntityMiningLaser.java @@ -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++) diff --git a/src/cr0s/WarpDrive/machines/WarpChunkTE.java b/src/cr0s/WarpDrive/machines/WarpChunkTE.java index b3b0787c..1d8dcfd2 100644 --- a/src/cr0s/WarpDrive/machines/WarpChunkTE.java +++ b/src/cr0s/WarpDrive/machines/WarpChunkTE.java @@ -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 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);