diff --git a/src/main/java/com/volmit/iris/core/IrisSettings.java b/src/main/java/com/volmit/iris/core/IrisSettings.java
index b9df38381..f0d68e658 100644
--- a/src/main/java/com/volmit/iris/core/IrisSettings.java
+++ b/src/main/java/com/volmit/iris/core/IrisSettings.java
@@ -88,6 +88,7 @@ public class IrisSettings {
public int pregenThreadPriority = 8;
public int miscThreadCount = -4;
public int miscThreadPriority = 3;
+ public boolean unstableLockingHeuristics = false;
}
@Data
diff --git a/src/main/java/com/volmit/iris/engine/parallax/ParallaxRegion.java b/src/main/java/com/volmit/iris/engine/parallax/ParallaxRegion.java
index 8426737ec..e28b5a63f 100644
--- a/src/main/java/com/volmit/iris/engine/parallax/ParallaxRegion.java
+++ b/src/main/java/com/volmit/iris/engine/parallax/ParallaxRegion.java
@@ -19,6 +19,7 @@
package com.volmit.iris.engine.parallax;
import com.volmit.iris.Iris;
+import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.engine.hunk.Hunk;
import com.volmit.iris.engine.hunk.io.HunkIOAdapter;
import com.volmit.iris.engine.hunk.io.HunkRegion;
@@ -26,6 +27,7 @@ import com.volmit.iris.engine.hunk.io.HunkRegionSlice;
import com.volmit.iris.engine.object.tile.TileData;
import com.volmit.iris.engine.parallel.GridLock;
import com.volmit.iris.engine.parallel.MultiBurst;
+import com.volmit.iris.engine.parallel.NOOPGridLock;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.math.M;
import com.volmit.iris.util.oldnbt.ByteArrayTag;
@@ -56,7 +58,7 @@ public class ParallaxRegion extends HunkRegion {
this.burst = burst;
this.height = height;
setupSlices();
- lock = new GridLock(32, 32);
+ lock = newGridLock();
}
public ParallaxRegion(MultiBurst burst, int height, File folder, int x, int z) {
@@ -64,7 +66,11 @@ public class ParallaxRegion extends HunkRegion {
this.burst = burst;
this.height = height;
setupSlices();
- lock = new GridLock(32, 32);
+ lock = newGridLock();
+ }
+
+ private GridLock newGridLock() {
+ return IrisSettings.get().getConcurrency().isUnstableLockingHeuristics() ? new NOOPGridLock(1, 1) : new GridLock(32, 32);
}
private void setupSlices() {
diff --git a/src/main/java/com/volmit/iris/engine/parallel/NOOPGridLock.java b/src/main/java/com/volmit/iris/engine/parallel/NOOPGridLock.java
new file mode 100644
index 000000000..f1eae66d0
--- /dev/null
+++ b/src/main/java/com/volmit/iris/engine/parallel/NOOPGridLock.java
@@ -0,0 +1,81 @@
+/*
+ * Iris is a World Generator for Minecraft Bukkit Servers
+ * Copyright (c) 2021 Arcane Arts (Volmit Software)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.volmit.iris.engine.parallel;
+
+import com.volmit.iris.util.function.NastyRunnable;
+import com.volmit.iris.util.io.IORunnable;
+
+import java.io.IOException;
+import java.util.function.Supplier;
+
+public class NOOPGridLock extends GridLock{
+ public NOOPGridLock(int x, int z) {
+ super(x, z);
+ }
+
+ @Override
+ public void with(int x, int z, Runnable r) {
+ r.run();
+ }
+
+ @Override
+ public void withNasty(int x, int z, NastyRunnable r) throws Throwable {
+ r.run();
+ }
+
+ @Override
+ public void withIO(int x, int z, IORunnable r) throws IOException {
+ r.run();
+ }
+
+ @Override
+ public T withResult(int x, int z, Supplier r) {
+ return r.get();
+ }
+
+ @Override
+ public void withAll(Runnable r) {
+ r.run();
+ }
+
+ @Override
+ public T withAllResult(Supplier r) {
+ return r.get();
+ }
+
+ @Override
+ public boolean tryLock(int x, int z) {
+ return true;
+ }
+
+ @Override
+ public boolean tryLock(int x, int z, long timeout) {
+ return true;
+ }
+
+ @Override
+ public void lock(int x, int z) {
+
+ }
+
+ @Override
+ public void unlock(int x, int z) {
+
+ }
+}