From 4f2076b48e6b5eb9d38e64f9fe143435f8f48d92 Mon Sep 17 00:00:00 2001 From: TomTheFurry Date: Mon, 13 Jun 2022 00:02:42 +0800 Subject: [PATCH] Fixs: Config Enum Error not caught, GLLogger not disabled, DimFinder Move crash on colliding with existing files, slience the rendering concurrency error --- .../seibel/lod/core/handlers/LodDimensionFinder.java | 3 ++- .../seibel/lod/core/objects/opengl/RenderRegion.java | 12 ++++++++++++ .../java/com/seibel/lod/core/render/GLProxy.java | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/handlers/LodDimensionFinder.java b/src/main/java/com/seibel/lod/core/handlers/LodDimensionFinder.java index aaf7cf75b..7fce5c325 100644 --- a/src/main/java/com/seibel/lod/core/handlers/LodDimensionFinder.java +++ b/src/main/java/com/seibel/lod/core/handlers/LodDimensionFinder.java @@ -47,6 +47,7 @@ import org.apache.logging.log4j.LogManager; import java.io.File; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import java.util.Arrays; import java.util.Comparator; import java.util.UUID; @@ -532,7 +533,7 @@ public class LodDimensionFinder newDimension.mkdirs(); File oldDataNewPath = new File(newDimension.getPath() + File.separatorChar + folder.getName()); - Files.move(folder.toPath(), oldDataNewPath.toPath()); + Files.move(folder.toPath(), oldDataNewPath.toPath(), StandardCopyOption.REPLACE_EXISTING); } else { diff --git a/src/main/java/com/seibel/lod/core/objects/opengl/RenderRegion.java b/src/main/java/com/seibel/lod/core/objects/opengl/RenderRegion.java index d91bd87fe..d045e2811 100644 --- a/src/main/java/com/seibel/lod/core/objects/opengl/RenderRegion.java +++ b/src/main/java/com/seibel/lod/core/objects/opengl/RenderRegion.java @@ -175,6 +175,15 @@ public class RenderRegion implements AutoCloseable for (LodDirection dir : LodDirection.ADJ_DIRECTIONS) { adjRegions[dir.ordinal() - 2] = lodDim.getRegion(regionPos.x+dir.getNormal().x, regionPos.z+dir.getNormal().z); } + } catch (NullPointerException | ArrayIndexOutOfBoundsException e) { // HOTFIX: Error ignoring for a concurrency caused issue + setNeedRegen(); + if (!backState.compareAndSet(BackState.Building, BackState.Unused)) { + EVENT_LOGGER.error("\"Lod Builder Starter\"" + + " encountered error on catching exceptions and fallback on starting build task: ", + new ConcurrentModificationException("RenderRegion Illegal State")); + } + EVENT_LOGGER.info("\"Lod Builder Starter\" failed due to possible known concurrency issue: ", e); + return CompletableFuture.completedFuture(null); } catch (Throwable t) { setNeedRegen(); if (!backState.compareAndSet(BackState.Building, BackState.Unused)) { @@ -200,6 +209,9 @@ public class RenderRegion implements AutoCloseable buildRun.run(); EVENT_LOGGER.trace("RenderRegion end QuadBuild @ {}", regionPos); return builder; + } catch (NullPointerException | ArrayIndexOutOfBoundsException e) { + EVENT_LOGGER.info("\"LodNodeBufferBuilder\" failed due to possible known concurrency issue: ", e); + throw e; // HOTFIX: Error ignoring for a concurrency caused issue } catch (Throwable e3) { EVENT_LOGGER.error("\"LodNodeBufferBuilder\" was unable to build quads: ", e3); throw e3; diff --git a/src/main/java/com/seibel/lod/core/render/GLProxy.java b/src/main/java/com/seibel/lod/core/render/GLProxy.java index 2de5218ec..7f75c3e93 100644 --- a/src/main/java/com/seibel/lod/core/render/GLProxy.java +++ b/src/main/java/com/seibel/lod/core/render/GLProxy.java @@ -64,7 +64,7 @@ import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; */ public class GLProxy { - public static final boolean OVERWIDE_VANILLA_GL_LOGGER = true; + public static final boolean OVERWIDE_VANILLA_GL_LOGGER = false; private static final IMinecraftClientWrapper MC = SingletonHandler.get(IMinecraftClientWrapper.class);