diff --git a/src/main/java/com/volmit/iris/core/loader/ObjectResourceLoader.java b/src/main/java/com/volmit/iris/core/loader/ObjectResourceLoader.java index c934b486b..6c3b4a302 100644 --- a/src/main/java/com/volmit/iris/core/loader/ObjectResourceLoader.java +++ b/src/main/java/com/volmit/iris/core/loader/ObjectResourceLoader.java @@ -54,7 +54,6 @@ public class ObjectResourceLoader extends ResourceLoader { } protected IrisObject loadFile(File j, String name) { - lock.lock(); try { PrecisionStopwatch p = PrecisionStopwatch.start(); IrisObject t = new IrisObject(0, 0, 0); @@ -63,12 +62,10 @@ public class ObjectResourceLoader extends ResourceLoader { t.setLoader(manager); t.setLoadFile(j); logLoad(j, t); - lock.unlock(); tlt.addAndGet(p.getMilliseconds()); return t; } catch (Throwable e) { Iris.reportError(e); - lock.unlock(); Iris.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + ": " + e.getMessage()); return null; } @@ -108,11 +105,9 @@ public class ObjectResourceLoader extends ResourceLoader { } public File findFile(String name) { - lock.lock(); for (File i : getFolders(name)) { for (File j : i.listFiles()) { if (j.isFile() && j.getName().endsWith(".iob") && j.getName().split("\\Q.\\E")[0].equals(name)) { - lock.unlock(); return j; } } @@ -120,14 +115,12 @@ public class ObjectResourceLoader extends ResourceLoader { File file = new File(i, name + ".iob"); if (file.exists()) { - lock.unlock(); return file; } } Iris.warn("Couldn't find " + resourceTypeName + ": " + name); - lock.unlock(); return null; } @@ -136,11 +129,9 @@ public class ObjectResourceLoader extends ResourceLoader { } private IrisObject loadRaw(String name){ - lock.lock(); for (File i : getFolders(name)) { for (File j : i.listFiles()) { if (j.isFile() && j.getName().endsWith(".iob") && j.getName().split("\\Q.\\E")[0].equals(name)) { - lock.unlock(); return loadFile(j, name); } } @@ -148,14 +139,12 @@ public class ObjectResourceLoader extends ResourceLoader { File file = new File(i, name + ".iob"); if (file.exists()) { - lock.unlock(); return loadFile(file, name); } } Iris.warn("Couldn't find " + resourceTypeName + ": " + name); - lock.unlock(); return null; } diff --git a/src/main/java/com/volmit/iris/core/loader/ResourceLoader.java b/src/main/java/com/volmit/iris/core/loader/ResourceLoader.java index 4153f2811..ce553b5e6 100644 --- a/src/main/java/com/volmit/iris/core/loader/ResourceLoader.java +++ b/src/main/java/com/volmit/iris/core/loader/ResourceLoader.java @@ -56,14 +56,12 @@ public class ResourceLoader implements MeteredCache { protected KList folderCache; protected Class objectClass; protected String cname; - protected IrisLock lock; protected String[] possibleKeys = null; protected IrisData manager; protected AtomicInteger loads; protected ChronoLatch sec; public ResourceLoader(File root, IrisData manager, String folderName, String resourceTypeName, Class objectClass) { - lock = new IrisLock("Res"); this.manager = manager; sec = new ChronoLatch(5000); loads = new AtomicInteger(); @@ -95,11 +93,9 @@ public class ResourceLoader implements MeteredCache { } public File findFile(String name) { - lock.lock(); for (File i : getFolders(name)) { for (File j : i.listFiles()) { if (j.isFile() && j.getName().endsWith(".json") && j.getName().split("\\Q.\\E")[0].equals(name)) { - lock.unlock(); return j; } } @@ -107,14 +103,12 @@ public class ResourceLoader implements MeteredCache { File file = new File(i, name + ".json"); if (file.exists()) { - lock.unlock(); return file; } } Iris.warn("Couldn't find " + resourceTypeName + ": " + name); - lock.unlock(); return null; } @@ -195,12 +189,10 @@ public class ResourceLoader implements MeteredCache { t.setLoader(manager); getManager().preprocessObject(t); logLoad(j, t); - lock.unlock(); tlt.addAndGet(p.getMilliseconds()); return t; } catch (Throwable e) { Iris.reportError(e); - lock.unlock(); failLoad(j, e); return null; } @@ -248,7 +240,6 @@ public class ResourceLoader implements MeteredCache { private T loadRaw(String name) { - lock.lock(); for (File i : getFolders(name)) { //noinspection ConstantConditions for (File j : i.listFiles()) { @@ -264,7 +255,6 @@ public class ResourceLoader implements MeteredCache { } } - lock.unlock(); return null; } @@ -281,7 +271,6 @@ public class ResourceLoader implements MeteredCache { } public KList getFolders() { - lock.lock(); if (folderCache == null) { folderCache = new KList<>(); @@ -295,8 +284,6 @@ public class ResourceLoader implements MeteredCache { } } - lock.unlock(); - if (folderCache == null) { synchronized (this) { return getFolderCache(); @@ -321,11 +308,9 @@ public class ResourceLoader implements MeteredCache { } public void clearCache() { - lock.lock(); possibleKeys = null; loadCache.invalidate(); folderCache = null; - lock.unlock(); } public File fileFor(T b) { @@ -351,10 +336,8 @@ public class ResourceLoader implements MeteredCache { } public void clearList() { - lock.lock(); folderCache = null; possibleKeys = null; - lock.unlock(); } public KList getPossibleKeys(String arg) { diff --git a/src/main/java/com/volmit/iris/core/loader/ScriptResourceLoader.java b/src/main/java/com/volmit/iris/core/loader/ScriptResourceLoader.java index 25fde01e3..816fb3213 100644 --- a/src/main/java/com/volmit/iris/core/loader/ScriptResourceLoader.java +++ b/src/main/java/com/volmit/iris/core/loader/ScriptResourceLoader.java @@ -44,7 +44,6 @@ public class ScriptResourceLoader extends ResourceLoader { } protected IrisScript loadFile(File j, String name) { - lock.lock(); try { PrecisionStopwatch p = PrecisionStopwatch.start(); IrisScript t = new IrisScript(IO.readAll(j)); @@ -52,12 +51,10 @@ public class ScriptResourceLoader extends ResourceLoader { t.setLoader(manager); t.setLoadFile(j); logLoad(j, t); - lock.unlock(); tlt.addAndGet(p.getMilliseconds()); return t; } catch (Throwable e) { Iris.reportError(e); - lock.unlock(); Iris.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + ": " + e.getMessage()); return null; } @@ -97,11 +94,9 @@ public class ScriptResourceLoader extends ResourceLoader { } public File findFile(String name) { - lock.lock(); for (File i : getFolders(name)) { for (File j : i.listFiles()) { if (j.isFile() && j.getName().endsWith(".js") && j.getName().split("\\Q.\\E")[0].equals(name)) { - lock.unlock(); return j; } } @@ -109,24 +104,20 @@ public class ScriptResourceLoader extends ResourceLoader { File file = new File(i, name + ".js"); if (file.exists()) { - lock.unlock(); return file; } } Iris.warn("Couldn't find " + resourceTypeName + ": " + name); - lock.unlock(); return null; } private IrisScript loadRaw(String name) { - lock.lock(); for (File i : getFolders(name)) { for (File j : i.listFiles()) { if (j.isFile() && j.getName().endsWith(".js") && j.getName().split("\\Q.\\E")[0].equals(name)) { - lock.unlock(); return loadFile(j, name); } } @@ -134,14 +125,12 @@ public class ScriptResourceLoader extends ResourceLoader { File file = new File(i, name + ".js"); if (file.exists()) { - lock.unlock(); return loadFile(file, name); } } Iris.warn("Couldn't find " + resourceTypeName + ": " + name); - lock.unlock(); return null; } diff --git a/src/main/java/com/volmit/iris/util/data/B.java b/src/main/java/com/volmit/iris/util/data/B.java index 7ee69973b..8a157a191 100644 --- a/src/main/java/com/volmit/iris/util/data/B.java +++ b/src/main/java/com/volmit/iris/util/data/B.java @@ -399,6 +399,17 @@ public class B { public static BlockData getOrNull(String bdxf) { try { String bd = bdxf.trim(); + + if(bd.startsWith("minecraft:cauldron[level=")) + { + bd = bd.replaceAll("\\Q:cauldron[\\E", ":water_cauldron["); + } + + if(bd.equals("minecraft:grass_path")) + { + return DIRT_PATH.createBlockData(); + } + BlockData bdx = parseBlockData(bd); if (bdx == null) { diff --git a/src/main/java/com/volmit/iris/util/hunk/storage/PaletteOrHunk.java b/src/main/java/com/volmit/iris/util/hunk/storage/PaletteOrHunk.java index 867f3f3b7..92235aac3 100644 --- a/src/main/java/com/volmit/iris/util/hunk/storage/PaletteOrHunk.java +++ b/src/main/java/com/volmit/iris/util/hunk/storage/PaletteOrHunk.java @@ -29,9 +29,9 @@ import java.util.function.Supplier; public class PaletteOrHunk extends StorageHunk implements Hunk { private final Hunk hunk; - public PaletteOrHunk(int width, int height, int depth, Supplier> factory) { + public PaletteOrHunk(int width, int height, int depth, boolean allow, Supplier> factory) { super(width, height, depth); - hunk = width == 16 && height == 16 && depth == 16 ? new PaletteHunk<>() : factory.get(); + hunk = (width == 16 && height == 16 && depth == 16 && allow) ? new PaletteHunk<>() : factory.get(); } public PalettedContainer palette() diff --git a/src/main/java/com/volmit/iris/util/matter/slices/RawMatter.java b/src/main/java/com/volmit/iris/util/matter/slices/RawMatter.java index 78e8433e8..d7f1ccdae 100644 --- a/src/main/java/com/volmit/iris/util/matter/slices/RawMatter.java +++ b/src/main/java/com/volmit/iris/util/matter/slices/RawMatter.java @@ -37,7 +37,7 @@ public abstract class RawMatter extends PaletteOrHunk implements MatterSli private final Class type; public RawMatter(int width, int height, int depth, Class type) { - super(width, height, depth, () -> new MappedHunk<>(width, height, depth)); + super(width, height, depth, true, () -> new MappedHunk<>(width, height, depth)); writers = new KMap<>(); readers = new KMap<>(); this.type = type;