aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2021-01-18 18:19:29 -0800
committerJason Mitchell <mitchej@gmail.com>2021-01-18 18:19:29 -0800
commit6d58f65939261a915761c11ecf01848c2cef451c (patch)
tree37fb5cbad97505d4954169d1cc59b98eb9eb89c3 /src/main/java/gregtech/api
parent94c98540f8a6044aa3e27722218f8eeb395e9cb1 (diff)
downloadGT5-Unofficial-6d58f65939261a915761c11ecf01848c2cef451c.tar.gz
GT5-Unofficial-6d58f65939261a915761c11ecf01848c2cef451c.tar.bz2
GT5-Unofficial-6d58f65939261a915761c11ecf01848c2cef451c.zip
try/finally
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
index 09b2801c79..e46d63cdff 100644
--- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
+++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
@@ -117,13 +117,18 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable {
try {
while (!tQueue.isEmpty()) {
final ChunkCoordinates aCoords = tQueue.poll();
+ final TileEntity tTileEntity;
+ final boolean isMachineBlock;
// This might load a chunk... which might load a TileEntity... which might get added to `loadedTileEntityList`... which might be in the process
// of being iterated over during `UpdateEntities()`... which might cause a ConcurrentModificationException. So, lock that shit.
lock.lock();
- final TileEntity tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ);
- final boolean isMachineBlock = GregTech_API.isMachineBlock(world.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ), world.getBlockMetadata(aCoords.posX, aCoords.posY, aCoords.posZ));
- lock.unlock();
+ try {
+ tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ);
+ isMachineBlock = GregTech_API.isMachineBlock(world.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ), world.getBlockMetadata(aCoords.posX, aCoords.posY, aCoords.posZ));
+ } finally {
+ lock.unlock();
+ }
// See if the block itself needs an update
if (tTileEntity instanceof IMachineBlockUpdateable)