Start updating for changed core

This commit is contained in:
James Seibel
2022-03-03 19:41:31 -06:00
parent 88497593c4
commit fa325b2eb8
13 changed files with 48 additions and 34 deletions
@@ -5,7 +5,7 @@ import com.seibel.lod.core.wrapperInterfaces.IVersionConstants;
/**
* @author James Seibel
* @version 12-11-2021
* @version 3-3-2022
*/
public class VersionConstants implements IVersionConstants {
public static final VersionConstants INSTANCE = new VersionConstants();
@@ -52,4 +52,11 @@ public class VersionConstants implements IVersionConstants {
public boolean hasBatchGenerationImplementation() {
return true;
}
@Override
public boolean isVanillaRenderedChunkSquare()
{
return false;
}
}
@@ -92,7 +92,7 @@ public abstract class ConfigGui
// Change these to your own mod
private static final String MOD_NAME = ModInfo.NAME; // For file saving and identifying
private static final String MOD_NAME_READABLE = ModInfo.READABLE_NAME; // For logs
// private static final Logger LOGGER = ClientApi.LOGGER; // For logs
// private static final Logger LOGGER = ApiShared.LOGGER; // For logs
private static final Logger LOGGER = LogManager.getLogger(ModInfo.NAME); // For logs (this inits before ClientAPI so this is a temp fix)
@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.systems.RenderSystem;
import com.seibel.lod.common.wrappers.misc.LightMapWrapper;
import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler;
@@ -181,7 +182,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
MinecraftWrapper.INSTANCE.sendChatMessage(
"\u00A7eOverdraw prevention will be worse than normal.");
} catch (Exception e2) {}
ClientApi.LOGGER.error("getVanillaRenderedChunks Error: {}", e);
ApiShared.LOGGER.error("getVanillaRenderedChunks Error: {}", e);
usingBackupGetVanillaRenderedChunks = true;
}
}
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.platform.Window;
import com.seibel.lod.core.ModInfo;
import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.enums.LodDirection;
import com.seibel.lod.core.util.LodUtil;
@@ -418,7 +419,7 @@ public class MinecraftWrapper implements IMinecraftWrapper
@Override
public void crashMinecraft(String errorMessage, Throwable exception)
{
ClientApi.LOGGER.error(ModInfo.READABLE_NAME + " had the following error: [" + errorMessage + "]. Crashing Minecraft...");
ApiShared.LOGGER.error(ModInfo.READABLE_NAME + " had the following error: [" + errorMessage + "]. Crashing Minecraft...");
CrashReport report = new CrashReport(errorMessage, exception);
Minecraft.crash(report);
}
@@ -19,6 +19,7 @@
package com.seibel.lod.common.wrappers.worldGeneration;
import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
import com.seibel.lod.core.builders.lodBuilding.LodBuilderConfig;
@@ -251,7 +252,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
if (!unsafeThreadingRecorded && !f.isDone()) {
MC.sendChatMessage("\u00A74\u00A7l\u00A7uERROR: Distant Horizons: Unsafe Threading in Chunk Generator Detected!");
MC.sendChatMessage("\u00A7eTo increase stability, it is recommended to set world generation threads count to 1.");
ClientApi.LOGGER.error("Unsafe Threading in Chunk Generator: ", new RuntimeException("Concurrent future"));
ApiShared.LOGGER.error("Unsafe Threading in Chunk Generator: ", new RuntimeException("Concurrent future"));
unsafeThreadingRecorded = true;
}
return f.join();
@@ -299,8 +300,8 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
}
catch (Throwable e)
{
ClientApi.LOGGER.error("Batching World Generator: Event {} gotten an exception", event);
ClientApi.LOGGER.error("Exception: ", e);
ApiShared.LOGGER.error("Batching World Generator: Event {} gotten an exception", event);
ApiShared.LOGGER.error("Exception: ", e);
unknownExceptionCount++;
lastExceptionTriggerTime = System.nanoTime();
}
@@ -311,12 +312,12 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
}
else if (event.hasTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS))
{
ClientApi.LOGGER.error("Batching World Generator: " + event + " timed out and terminated!");
ClientApi.LOGGER.info("Dump PrefEvent: " + event.pEvent);
ApiShared.LOGGER.error("Batching World Generator: " + event + " timed out and terminated!");
ApiShared.LOGGER.info("Dump PrefEvent: " + event.pEvent);
try
{
if (!event.terminate())
ClientApi.LOGGER.error("Failed to terminate the stuck generation event!");
ApiShared.LOGGER.error("Failed to terminate the stuck generation event!");
}
finally
{
@@ -328,7 +329,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
try {
MC.sendChatMessage("\u00A74\u00A7l\u00A7uERROR: Distant Horizons: Too many exceptions in Batching World Generator! Disabling the generator.");
} catch (Exception e) {}
ClientApi.LOGGER.error("Too many exceptions in Batching World Generator! Now disabling.");
ApiShared.LOGGER.error("Too many exceptions in Batching World Generator! Now disabling.");
unknownExceptionCount = 0;
CONFIG.client().worldGenerator().setEnableDistantGeneration(false);
}
@@ -337,14 +338,14 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
public BatchGenerationEnvironment(IWorldWrapper serverlevel, LodBuilder lodBuilder, LodDimension lodDim)
{
super(serverlevel, lodBuilder, lodDim);
ClientApi.LOGGER.info("================WORLD_GEN_STEP_INITING=============");
ApiShared.LOGGER.info("================WORLD_GEN_STEP_INITING=============");
ChunkGenerator generator = ((WorldWrapper) serverlevel).getServerWorld().getChunkSource().getGenerator();
if (!(generator instanceof NoiseBasedChunkGenerator ||
generator instanceof DebugLevelSource ||
generator instanceof FlatLevelSource)) {
MC.sendChatMessage("\u00A74\u00A7l\u00A7uWARNING: Distant Horizons: Unknown Chunk Generator Detected! Distant Generation May Fail!");
MC.sendChatMessage("\u00A7eIf it does crash, set Distant Generation to OFF or Generation Mode to None.");
ClientApi.LOGGER.warn("Unknown Chunk Generator detected: {}", generator.getClass());
ApiShared.LOGGER.warn("Unknown Chunk Generator detected: {}", generator.getClass());
}
params = new GlobalParameters((ServerLevel) ((WorldWrapper) serverlevel).getWorld(), lodBuilder, lodDim);
}
@@ -359,7 +360,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
}
catch (Exception e)
{
ClientApi.LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e);
ApiShared.LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e);
}
if (chunkData == null)
{
@@ -370,7 +371,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
try {
return ChunkLoader.read(level, lightEngine, chunkPos, chunkData);
} catch (Exception e) {
ClientApi.LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e);
ApiShared.LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e);
return new ProtoChunk(chunkPos, UpgradeData.EMPTY, level);
}
}
@@ -380,7 +381,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
public void generateLodFromList(GenerationEvent e)
{
if (ENABLE_EVENT_LOGGING)
ClientApi.LOGGER.info("Lod Generate Event: " + e.pos);
ApiShared.LOGGER.info("Lod Generate Event: " + e.pos);
e.pEvent.beginNano = System.nanoTime();
GridList<ChunkAccess> referencedChunks;
DistanceGenerationMode generationMode;
@@ -479,7 +480,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
if (isFull)
{
if (ENABLE_LOAD_EVENT_LOGGING)
ClientApi.LOGGER.info("Detected full existing chunk at {}", target.getPos());
ApiShared.LOGGER.info("Detected full existing chunk at {}", target.getPos());
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, new ChunkWrapper(target, region),
new LodBuilderConfig(DistanceGenerationMode.FULL), true, e.genAllDetails);
}
@@ -505,7 +506,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
if (ENABLE_PERF_LOGGING)
{
e.tParam.perf.recordEvent(e.pEvent);
ClientApi.LOGGER.info(e.tParam.perf);
ApiShared.LOGGER.info(e.tParam.perf);
}
}
@@ -588,14 +589,14 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
@Override
public void stop(boolean blocking) {
ClientApi.LOGGER.info("Batch Chunk Generator shutting down...");
ApiShared.LOGGER.info("Batch Chunk Generator shutting down...");
executors.shutdownNow();
if (blocking) try {
if (!executors.awaitTermination(10, TimeUnit.SECONDS)) {
ClientApi.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...");
ApiShared.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...");
}
} catch (InterruptedException e) {
ClientApi.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...", e);
ApiShared.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...", e);
}
}
}
@@ -6,6 +6,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment.PrefEvent;
import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.enums.config.LightGenerationMode;
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
@@ -70,7 +71,7 @@ public final class GenerationEvent
public boolean terminate()
{
future.cancel(true);
ClientApi.LOGGER.info("======================DUMPING ALL THREADS FOR WORLD GEN=======================");
ApiShared.LOGGER.info("======================DUMPING ALL THREADS FOR WORLD GEN=======================");
BatchGenerationEnvironment.threadFactory.dumpAllThreadStacks();
return future.isCancelled();
}
@@ -1,7 +1,7 @@
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.api.ApiShared;
import java.util.Objects;
@@ -30,7 +30,7 @@ import net.minecraft.world.level.material.Fluids;
import org.apache.logging.log4j.Logger;
public class ChunkLoader {
private static final Logger LOGGER = ClientApi.LOGGER;
private static final Logger LOGGER = ApiShared.LOGGER;
private static LevelChunkSection[] readSections(WorldGenLevel level, LevelLightEngine lightEngine,
ChunkPos chunkPos, CompoundTag tagLevel) {
@@ -142,7 +142,7 @@ public class ChunkLoader {
chunk.setLightCorrect(tagLevel.getBoolean("isLightOn"));
readHeightmaps(chunk, tagLevel);
readPostPocessings(chunk, tagLevel);
// ClientApi.LOGGER.info("Loaded chunk @ "+chunk.getPos());
// ApiShared.LOGGER.info("Loaded chunk @ "+chunk.getPos());
return chunk;
}
}
@@ -6,6 +6,7 @@ import java.util.stream.Stream;
import org.jetbrains.annotations.Nullable;
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment.EmptyChunkGenerator;
import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.enums.config.LightGenerationMode;
@@ -183,7 +184,7 @@ public class LightedWorldGenRegion extends WorldGenRegion {
}
}
if (chunkStatus != ChunkStatus.EMPTY && chunkStatus != debugTriggeredForStatus) {
ClientApi.LOGGER.info("WorldGen requiring " + chunkStatus
ApiShared.LOGGER.info("WorldGen requiring " + chunkStatus
+ " outside expected range detected. Force passing EMPTY chunk and seeing if it works.");
debugTriggeredForStatus = chunkStatus;
}
+1 -1
Submodule core updated: d84d535896...2149da59df
@@ -21,6 +21,7 @@ package com.seibel.lod.fabric;
import com.seibel.lod.common.LodCommonMain;
import com.seibel.lod.core.ModInfo;
import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler;
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
@@ -64,7 +65,7 @@ public class Main implements ClientModInitializer
LodCommonMain.startup(null, false);
DependencySetup.createInitialBindings();
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
ClientApi.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
ApiShared.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
// Check if this works
client_proxy = new ClientProxy();
@@ -81,6 +82,6 @@ public class Main implements ClientModInitializer
LodCommonMain.initConfig();
LodCommonMain.startup(null, true);
DependencySetup.createInitialBindings();
ClientApi.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
ApiShared.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
}
}
@@ -31,7 +31,7 @@ public class MixinUtilBackgroudThread
{
if (DependencySetupDoneCheck.isDone && doTriggerOverride())
{
// ClientApi.LOGGER.info("util wrapThreadWithTaskName(Runnable) triggered");
// ApiShared.LOGGER.info("util wrapThreadWithTaskName(Runnable) triggered");
ci.setReturnValue(r);
}
}
@@ -41,7 +41,7 @@ public class MixinUtilBackgroudThread
{
if (DependencySetupDoneCheck.isDone && doTriggerOverride())
{
// ClientApi.LOGGER.info("util backgroundExecutor triggered");
// ApiShared.LOGGER.info("util backgroundExecutor triggered");
ci.setReturnValue(Runnable::run);
}
}
@@ -24,6 +24,7 @@ import com.seibel.lod.common.forge.LodForgeMethodCaller;
import com.seibel.lod.common.wrappers.config.ConfigGui;
import com.seibel.lod.common.wrappers.minecraft.MinecraftWrapper;
import com.seibel.lod.core.ModInfo;
import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler;
import com.seibel.lod.core.handlers.ReflectionHandler;
@@ -71,7 +72,7 @@ public class ForgeMain implements LodForgeMethodCaller
LodCommonMain.initConfig();
LodCommonMain.startup(this, !FMLLoader.getDist().isClient());
ForgeDependencySetup.createInitialBindings();
ClientApi.LOGGER.info("Distant Horizons initializing...");
ApiShared.LOGGER.info("Distant Horizons initializing...");
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
if (ReflectionHandler.instance.optifinePresent()) {
@@ -31,7 +31,7 @@ public class MixinUtilBackgroudThread
{
if (DependencySetupDoneCheck.isDone && doTriggerOverride())
{
// ClientApi.LOGGER.info("util wrapThreadWithTaskName(Runnable) triggered");
// ApiShared.LOGGER.info("util wrapThreadWithTaskName(Runnable) triggered");
ci.setReturnValue(r);
}
}
@@ -41,7 +41,7 @@ public class MixinUtilBackgroudThread
{
if (DependencySetupDoneCheck.isDone && doTriggerOverride())
{
// ClientApi.LOGGER.info("util backgroundExecutor triggered");
// ApiShared.LOGGER.info("util backgroundExecutor triggered");
ci.setReturnValue(Runnable::run);
}
}