diff options
author | Jordan Byrne <draknyte1@hotmail.com> | 2018-05-23 05:27:51 +1000 |
---|---|---|
committer | Jordan Byrne <draknyte1@hotmail.com> | 2018-05-23 05:27:51 +1000 |
commit | 68b1c0598ca52f7a5d49f56c3cb55eacd195b115 (patch) | |
tree | 1605c1575a9f704ec71fd265ad6de1f163b0d2e8 /src/Java/gtPlusPlus/xmod/gregtech/common/tileentities | |
parent | 884627caa32082af7e99db2f7d5537499d86d880 (diff) | |
download | GT5-Unofficial-68b1c0598ca52f7a5d49f56c3cb55eacd195b115.tar.gz GT5-Unofficial-68b1c0598ca52f7a5d49f56c3cb55eacd195b115.tar.bz2 GT5-Unofficial-68b1c0598ca52f7a5d49f56c3cb55eacd195b115.zip |
$ More improvements to the Chunk Loader ID system. Should now avoid ID conflicts.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java index b73daf3db6..49901e57bc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java @@ -34,6 +34,7 @@ import gtPlusPlus.api.objects.data.Triplet; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.api.objects.minecraft.ChunkManager; import gtPlusPlus.api.objects.minecraft.DimChunkPos; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Type; @@ -106,7 +107,7 @@ public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_TieredM return; } - if (aTimer % 300 == 0) { + if (aTimer % 20 == 0) { if (!isRegistered() && this.getEUVar() > 0) { registerLoader(); } @@ -263,10 +264,16 @@ public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_TieredM return; } + try { if (this.getBaseMetaTileEntity() != null && this.getBaseMetaTileEntity().getWorld() != null && this.getBaseMetaTileEntity().getWorld().getWorldTime() >= 100) { - if (!mHasID) { + if (mChunkLoaderMapID == -1) { this.mChunkLoaderMapID = ChunkManager.getIdFromUniqueString(getUniqueID()); - mHasID = true; + Logger.INFO("["+getUniqueID()+"] Adjusted Chunk Loaders ID from -1 to "+mChunkLoaderMapID+". This chunk loader is not registered to the global list yet."); + } + else { + Logger.INFO("["+getUniqueID()+"] Found cached ID - "+mChunkLoaderMapID); + ChunkManager.setIdAndUniqueString(this.mChunkLoaderMapID, getUniqueID()); + this.mChunkLoaderMapID = ChunkManager.getIdFromUniqueString(getUniqueID()); // Just Incase the ID gets shifted. } if (this != null && this.getBaseMetaTileEntity() != null) { if (!isRegistered() && !getUniqueID().equalsIgnoreCase("0@0@0@0")) { @@ -279,6 +286,11 @@ public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_TieredM } } } + } + catch (Throwable t) { + t.printStackTrace(); + } + } |