From 18074f15f5bca2660fc51e211b5dccf2bb418fe5 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 5 Mar 2022 18:28:36 -0600 Subject: [PATCH] Rename MinecraftWrapper -> MinecraftClientWrapper closes #150 --- .../lod/common/forge/LodForgeMethodCaller.java | 4 ++-- .../seibel/lod/common/wrappers/DependencySetup.java | 8 ++++---- ...raftWrapper.java => MinecraftClientWrapper.java} | 13 ++++++------- .../wrappers/minecraft/MinecraftRenderWrapper.java | 6 +++--- .../worldGeneration/BatchGenerationEnvironment.java | 4 ++-- .../wrappers/worldGeneration/GlobalParameters.java | 2 +- core | 2 +- .../main/java/com/seibel/lod/forge/ForgeMain.java | 4 ++-- 8 files changed, 21 insertions(+), 22 deletions(-) rename common/src/main/java/com/seibel/lod/common/wrappers/minecraft/{MinecraftWrapper.java => MinecraftClientWrapper.java} (97%) diff --git a/common/src/main/java/com/seibel/lod/common/forge/LodForgeMethodCaller.java b/common/src/main/java/com/seibel/lod/common/forge/LodForgeMethodCaller.java index d2e7d32f7..d88a3d7fe 100644 --- a/common/src/main/java/com/seibel/lod/common/forge/LodForgeMethodCaller.java +++ b/common/src/main/java/com/seibel/lod/common/forge/LodForgeMethodCaller.java @@ -1,6 +1,6 @@ package com.seibel.lod.common.forge; -import com.seibel.lod.common.wrappers.minecraft.MinecraftWrapper; +import com.seibel.lod.common.wrappers.minecraft.MinecraftClientWrapper; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; import net.minecraft.world.level.block.Block; @@ -15,5 +15,5 @@ import java.util.Random; * @author Ran */ public interface LodForgeMethodCaller { - List getQuads(MinecraftWrapper mc, Block block, BlockState blockState, Direction direction, Random random); + List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random); } diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/DependencySetup.java b/common/src/main/java/com/seibel/lod/common/wrappers/DependencySetup.java index 16957a54c..6a53c7c1c 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/DependencySetup.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/DependencySetup.java @@ -2,14 +2,14 @@ package com.seibel.lod.common.wrappers; import com.seibel.lod.common.LodCommonMain; import com.seibel.lod.common.wrappers.minecraft.MinecraftRenderWrapper; -import com.seibel.lod.common.wrappers.minecraft.MinecraftWrapper; +import com.seibel.lod.common.wrappers.minecraft.MinecraftClientWrapper; import com.seibel.lod.core.handlers.IReflectionHandler; import com.seibel.lod.core.handlers.ReflectionHandler; import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; import com.seibel.lod.core.wrapperInterfaces.IVersionConstants; import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory; import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; -import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; +import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; /** * Binds all necessary dependencies, so we @@ -28,9 +28,9 @@ public class DependencySetup { if (!LodCommonMain.serverSided) { - SingletonHandler.bind(IMinecraftWrapper.class, MinecraftWrapper.INSTANCE); + SingletonHandler.bind(IMinecraftClientWrapper.class, MinecraftClientWrapper.INSTANCE); SingletonHandler.bind(IMinecraftRenderWrapper.class, MinecraftRenderWrapper.INSTANCE); - SingletonHandler.bind(IReflectionHandler.class, ReflectionHandler.createSingleton(MinecraftWrapper.INSTANCE.getOptions().getClass().getDeclaredFields(), MinecraftWrapper.INSTANCE.getOptions())); + SingletonHandler.bind(IReflectionHandler.class, ReflectionHandler.createSingleton(MinecraftClientWrapper.INSTANCE.getOptions().getClass().getDeclaredFields(), MinecraftClientWrapper.INSTANCE.getOptions())); } SingletonHandler.bind(IWrapperFactory.class, WrapperFactory.INSTANCE); diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftClientWrapper.java similarity index 97% rename from common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftWrapper.java rename to common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftClientWrapper.java index c6c2a9748..9802ea590 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftClientWrapper.java @@ -30,7 +30,7 @@ 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; -import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; +import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.lod.core.wrapperInterfaces.minecraft.IProfilerWrapper; import com.seibel.lod.core.wrapperInterfaces.misc.ILightMapWrapper; import com.seibel.lod.core.wrapperInterfaces.world.IDimensionTypeWrapper; @@ -64,15 +64,14 @@ import net.minecraft.world.level.dimension.DimensionType; import org.jetbrains.annotations.Nullable; /** - * A singleton that wraps the Minecraft class - * to allow for easier movement between Minecraft versions. + * A singleton that wraps the Minecraft object. * * @author James Seibel - * @version 9-16-2021 + * @version 3-5-2022 */ -public class MinecraftWrapper implements IMinecraftWrapper +public class MinecraftClientWrapper implements IMinecraftClientWrapper { - public static final MinecraftWrapper INSTANCE = new MinecraftWrapper(); + public static final MinecraftClientWrapper INSTANCE = new MinecraftClientWrapper(); public final Minecraft mc = Minecraft.getInstance(); @@ -85,7 +84,7 @@ public class MinecraftWrapper implements IMinecraftWrapper private ProfilerWrapper profilerWrapper; - private MinecraftWrapper() + private MinecraftClientWrapper() { } diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java index 7c7cf3539..ce7e5fcc5 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java @@ -24,7 +24,7 @@ import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory; import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper; import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper; import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; -import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; +import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor; import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor; import com.seibel.lod.common.wrappers.McObjectConverter; @@ -179,10 +179,10 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper }).collect(Collectors.toCollection(HashSet::new))); } catch (LinkageError e) { try { - MinecraftWrapper.INSTANCE.sendChatMessage( + MinecraftClientWrapper.INSTANCE.sendChatMessage( "\u00A7e\u00A7l\u00A7uWARNING: Distant Horizons: getVanillaRenderedChunks method failed." + " Using Backup Method."); - MinecraftWrapper.INSTANCE.sendChatMessage( + MinecraftClientWrapper.INSTANCE.sendChatMessage( "\u00A7eOverdraw prevention will be worse than normal."); } catch (Exception e2) {} ApiShared.LOGGER.error("getVanillaRenderedChunks Error: {}", e); diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java index 2c797b3c5..e120eb8ac 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java @@ -30,7 +30,7 @@ import com.seibel.lod.core.objects.lod.LodDimension; import com.seibel.lod.core.util.GridList; import com.seibel.lod.core.util.LodThreadFactory; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; -import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; +import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.lod.core.wrapperInterfaces.world.IWorldWrapper; import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvionmentWrapper; @@ -227,7 +227,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv public boolean unsafeThreadingRecorded = false; //public boolean safeMode = false; private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class); - private static final IMinecraftWrapper MC = SingletonHandler.get(IMinecraftWrapper.class); + private static final IMinecraftClientWrapper MC = SingletonHandler.get(IMinecraftClientWrapper.class); public static final long EXCEPTION_TIMER_RESET_TIME = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS); public static final int EXCEPTION_COUNTER_TRIGGER = 20; public int unknownExceptionCount = 0; diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/GlobalParameters.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/GlobalParameters.java index 069c0606f..9c0977a13 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/GlobalParameters.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/GlobalParameters.java @@ -5,7 +5,7 @@ import com.mojang.datafixers.DataFixer; import com.seibel.lod.core.builders.lodBuilding.LodBuilder; import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; import com.seibel.lod.core.objects.lod.LodDimension; -import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; +import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; diff --git a/core b/core index 566eb3651..3f091af3f 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 566eb3651fc0207d0f12e42e550feca24d9fc4fb +Subproject commit 3f091af3f8393397670c21d1a93871a8bb1dbf68 diff --git a/forge/src/main/java/com/seibel/lod/forge/ForgeMain.java b/forge/src/main/java/com/seibel/lod/forge/ForgeMain.java index 887983153..72ea391c0 100644 --- a/forge/src/main/java/com/seibel/lod/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/lod/forge/ForgeMain.java @@ -22,7 +22,7 @@ package com.seibel.lod.forge; import com.seibel.lod.common.LodCommonMain; 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.common.wrappers.minecraft.MinecraftClientWrapper; import com.seibel.lod.core.ModInfo; import com.seibel.lod.core.api.ApiShared; import com.seibel.lod.core.handlers.ReflectionHandler; @@ -97,7 +97,7 @@ public class ForgeMain implements LodForgeMethodCaller private final ModelDataMap dataMap = new ModelDataMap.Builder().build(); @Override - public List getQuads(MinecraftWrapper mc, Block block, BlockState blockState, Direction direction, Random random) { + public List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random) { return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, dataMap); } }