aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/threads
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
commit0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a (patch)
tree1e2c649f3a6ce3f6b2babd0098a5f4819e9cd0b6 /src/main/java/gregtech/api/threads
parentf8cc82edeb9810c45cba762d733a2c909a302faa (diff)
downloadGT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.gz
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.bz2
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gregtech/api/threads')
-rw-r--r--src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java21
-rw-r--r--src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java25
-rw-r--r--src/main/java/gregtech/api/threads/GT_Runnable_Sound.java28
3 files changed, 38 insertions, 36 deletions
diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java b/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java
index 3a2406dfde..ee555c2492 100644
--- a/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java
+++ b/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java
@@ -2,17 +2,19 @@ package gregtech.api.threads;
import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
import gregtech.GT_Mod;
import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable;
import gregtech.common.GT_Proxy;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ChunkCoordinates;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate {
+
protected GT_Runnable_Cable_Update(World aWorld, ChunkCoordinates aCoords) {
super(aWorld, aCoords);
}
@@ -60,15 +62,20 @@ public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate {
tCoords = new ChunkCoordinates(
aCoords.posX + offset.offsetX,
aCoords.posY + offset.offsetY,
- aCoords.posZ + offset.offsetZ))) tQueue.add(tCoords);
+ aCoords.posZ + offset.offsetZ)))
+ tQueue.add(tCoords);
}
}
}
}
} catch (Exception e) {
GT_Mod.GT_FML_LOGGER.error(
- "Well this update was broken... " + mCoords + ", mWorld={" + world.getProviderName() + " @dimId "
- + world.provider.dimensionId + "}",
+ "Well this update was broken... " + mCoords
+ + ", mWorld={"
+ + world.getProviderName()
+ + " @dimId "
+ + world.provider.dimensionId
+ + "}",
e);
}
}
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 5e2cc08475..06553730da 100644
--- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
+++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
@@ -1,9 +1,5 @@
package gregtech.api.threads;
-import gregtech.GT_Mod;
-import gregtech.api.GregTech_API;
-import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable;
-import gregtech.common.GT_Proxy;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
@@ -12,11 +8,18 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
+
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable;
+import gregtech.common.GT_Proxy;
+
public class GT_Runnable_MachineBlockUpdate implements Runnable {
+
// used by runner thread
protected final ChunkCoordinates mCoords;
protected final World world;
@@ -73,8 +76,8 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable {
}
public static void initExecutorService() {
- EXECUTOR_SERVICE = Executors.newFixedThreadPool(
- Math.max(1, (Runtime.getRuntime().availableProcessors() * 2 / 3)), THREAD_FACTORY);
+ EXECUTOR_SERVICE = Executors
+ .newFixedThreadPool(Math.max(1, (Runtime.getRuntime().availableProcessors() * 2 / 3)), THREAD_FACTORY);
}
public static void shutdownExecutorService() {
@@ -116,7 +119,7 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable {
// 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.
+ // ConcurrentModificationException. So, lock that shit.
GT_Proxy.TICK_LOCK.lock();
try {
tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ);
@@ -157,8 +160,12 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable {
}
} catch (Exception e) {
GT_Mod.GT_FML_LOGGER.error(
- "Well this update was broken... " + mCoords + ", mWorld={" + world.getProviderName() + " @dimId "
- + world.provider.dimensionId + "}",
+ "Well this update was broken... " + mCoords
+ + ", mWorld={"
+ + world.getProviderName()
+ + " @dimId "
+ + world.provider.dimensionId
+ + "}",
e);
}
}
diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java b/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java
index 99aa638f87..9d6de7df83 100644
--- a/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java
+++ b/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java
@@ -1,25 +1,20 @@
package gregtech.api.threads;
-import gregtech.api.util.GT_PlayedSound;
-import gregtech.api.util.GT_Utility;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
+import gregtech.api.util.GT_PlayedSound;
+import gregtech.api.util.GT_Utility;
+
public class GT_Runnable_Sound implements Runnable {
+
private final int mX, mY, mZ, mTimeUntilNextSound;
private final World mWorld;
private final ResourceLocation mSoundResourceLocation;
private final float mSoundStrength, mSoundModulation;
- public GT_Runnable_Sound(
- World aWorld,
- int aX,
- int aY,
- int aZ,
- int aTimeUntilNextSound,
- ResourceLocation aSoundResourceLocation,
- float aSoundStrength,
- float aSoundModulation) {
+ public GT_Runnable_Sound(World aWorld, int aX, int aY, int aZ, int aTimeUntilNextSound,
+ ResourceLocation aSoundResourceLocation, float aSoundStrength, float aSoundModulation) {
mWorld = aWorld;
mX = aX;
mY = aY;
@@ -34,15 +29,8 @@ public class GT_Runnable_Sound implements Runnable {
* @deprecated Use {@link #GT_Runnable_Sound(World, int, int, int, int, ResourceLocation, float, float)}
*/
@Deprecated
- public GT_Runnable_Sound(
- World aWorld,
- int aX,
- int aY,
- int aZ,
- int aTimeUntilNextSound,
- String aSoundName,
- float aSoundStrength,
- float aSoundModulation) {
+ public GT_Runnable_Sound(World aWorld, int aX, int aY, int aZ, int aTimeUntilNextSound, String aSoundName,
+ float aSoundStrength, float aSoundModulation) {
this(
aWorld,
aX,