Removed most cases of LodConfigWrapperSingleton

This commit is contained in:
coolGi
2022-06-11 22:27:16 +09:30
parent 7555073c14
commit c1c80f1000
11 changed files with 18 additions and 42 deletions
@@ -19,14 +19,13 @@
package com.seibel.lod.forge.mixins;
import com.seibel.lod.core.config.Config;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.mojang.blaze3d.systems.RenderSystem;
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.FogRenderer;
@@ -55,16 +54,6 @@ public class MixinFogRenderer
remap = #if MC_1_16_5 true #else false #endif) // Remap messiness due to this being added by forge.
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback)
{
ILodConfigWrapperSingleton CONFIG;
try
{
CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
}
catch (NullPointerException e)
{
return; // May happen due to forge for some reason haven't inited out thingy yet.
}
#if PRE_MC_1_17_1
FluidState fluidState = camera.getFluidInCamera();
boolean cameraNotInFluid = fluidState.isEmpty();
@@ -76,7 +65,7 @@ public class MixinFogRenderer
Entity entity = camera.getEntity();
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
if (!isSpecialFog && cameraNotInFluid && fogMode == FogMode.FOG_TERRAIN
&& CONFIG.client().graphics().fogQuality().getDisableVanillaFog())
&& Config.Client.Graphics.FogQuality.disableVanillaFog.get())
{
#if PRE_MC_1_17_1
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
@@ -22,8 +22,7 @@ package com.seibel.lod.forge.mixins;
import com.seibel.lod.common.wrappers.config.GetConfigScreen;
import com.seibel.lod.common.wrappers.config.TexturedButtonWidget;
import com.seibel.lod.core.ModInfo;
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.config.Config;
import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
@@ -52,7 +51,7 @@ public class MixinOptionsScreen extends Screen {
@Inject(at = @At("HEAD"),method = "init")
private void lodconfig$init(CallbackInfo ci) {
if (SingletonHandler.get(ILodConfigWrapperSingleton.class).client().getOptionsButton())
if (Config.Client.optionsButton.get())
this. #if PRE_MC_1_17_1 addButton #else addRenderableWidget #endif
(new TexturedButtonWidget(
// Where the button is on the screen
@@ -21,8 +21,6 @@ package com.seibel.lod.forge.wrappers;
import com.seibel.lod.common.LodCommonMain;
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.config.LodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import com.seibel.lod.forge.wrappers.modAccessor.ModChecker;
@@ -41,8 +39,6 @@ public class ForgeDependencySetup
public static void createInitialBindings()
{
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);
}
public static void finishBinding()