Fixed clouds for immersive portals

This commit is contained in:
coolGi2007
2022-01-11 08:39:09 +00:00
parent 5e0b63347e
commit e262dfa14a
7 changed files with 48 additions and 5 deletions
+1 -1
Submodule core updated: ee2c6e2a06...3ebdfd6e87
@@ -23,12 +23,14 @@ import com.seibel.lod.common.LodCommonMain;
import com.seibel.lod.core.ModInfo;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.api.ModAccessorApi;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
import com.seibel.lod.fabric.modAccessor.ModChecker;
import com.seibel.lod.fabric.modAccessor.SodiumAccessor;
import com.seibel.lod.fabric.wrappers.DependencySetup;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.loader.api.FabricLoader;
/**
* Initialize and setup the Mod. <br>
@@ -59,12 +61,13 @@ public class Main implements ClientModInitializer
LodCommonMain.initConfig();
LodCommonMain.startup(null, false);
DependencySetup.createInitialBindings();
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
ClientApi.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
// Check if this works
client_proxy = new ClientProxy();
client_proxy.registerEvents();
if (FabricLoader.getInstance().isModLoaded("sodium")) {
if (SingletonHandler.get(IModChecker.class).isModLoaded("sodium")) {
ModAccessorApi.bind(ISodiumAccessor.class, new SodiumAccessor());
}
}
@@ -29,6 +29,7 @@ import com.seibel.lod.common.wrappers.config.LodConfigWrapperSingleton;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import net.minecraft.client.renderer.LevelRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -221,7 +222,11 @@ public class MixinWorldRenderer
this.cloudBuffer.upload(bufferBuilder);
}
RenderSystem.setShaderTexture(0, resourceLocation);
if (SingletonHandler.get(IModChecker.class).isModLoaded("immersive_portals")) {
RenderSystem.setShaderTexture(0, CLOUDS_LOCATION);
} else {
RenderSystem.setShaderTexture(0, resourceLocation);
}
FogRenderer.levelFogColor();
poseStack.pushPose();
poseStack.scale(scale, cloudScale, scale);
@@ -0,0 +1,13 @@
package com.seibel.lod.fabric.modAccessor;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import net.fabricmc.loader.api.FabricLoader;
public class ModChecker implements IModChecker {
public static final ModChecker INSTANCE = new ModChecker();
@Override
public boolean isModLoaded(String modid) {
return FabricLoader.getInstance().isModLoaded(modid);
}
}
@@ -24,8 +24,11 @@ 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.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import com.seibel.lod.forge.wrappers.ForgeDependencySetup;
import com.seibel.lod.forge.wrappers.modAccessor.ModChecker;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Block;
@@ -62,6 +65,7 @@ public class ForgeMain implements LodForgeMethodCaller
LodCommonMain.initConfig();
LodCommonMain.startup(this, !FMLLoader.getDist().isClient());
ForgeDependencySetup.createInitialBindings();
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
}
@@ -29,6 +29,7 @@ import com.seibel.lod.common.wrappers.config.LodConfigWrapperSingleton;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import net.minecraft.client.renderer.LevelRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -221,7 +222,11 @@ public class MixinWorldRenderer
this.cloudBuffer.upload(bufferBuilder);
}
RenderSystem.setShaderTexture(0, resourceLocation);
if (SingletonHandler.get(IModChecker.class).isModLoaded("immersive_portals")) {
RenderSystem.setShaderTexture(0, CLOUDS_LOCATION);
} else {
RenderSystem.setShaderTexture(0, resourceLocation);
}
FogRenderer.levelFogColor();
poseStack.pushPose();
poseStack.scale(scale, cloudScale, scale);
@@ -0,0 +1,13 @@
package com.seibel.lod.forge.wrappers.modAccessor;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import net.minecraftforge.fml.ModList;
public class ModChecker implements IModChecker {
public static final ModChecker INSTANCE = new ModChecker();
@Override
public boolean isModLoaded(String modid) {
return ModList.get().isLoaded(modid);
}
}