Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a5b669245 |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
package com.seibel.distanthorizons.common.mixins.client;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||||
import net.minecraft.client.gui.components.DebugScreenOverlay;
|
import net.minecraft.client.gui.components.DebugScreenOverlay;
|
||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
package com.seibel.distanthorizons.common.mixins.client;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
package com.seibel.distanthorizons.common.mixins.client;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.DependencySetupDoneCheck;
|
import com.seibel.distanthorizons.common.wrappers.DependencySetupDoneCheck;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
package com.seibel.distanthorizons.common.mixins.client;
|
||||||
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.NativeImage;
|
import com.mojang.blaze3d.platform.NativeImage;
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"package": "com.seibel.distanthorizons.common.mixins",
|
||||||
|
"mixins": [
|
||||||
|
],
|
||||||
|
"client": [
|
||||||
|
"client.MixinDebugScreenOverlay",
|
||||||
|
"client.MixinFogRenderer",
|
||||||
|
"client.MixinGameRenderer",
|
||||||
|
"client.MixinLightTexture"
|
||||||
|
],
|
||||||
|
"server": []
|
||||||
|
}
|
||||||
@@ -10,11 +10,7 @@
|
|||||||
"client": [
|
"client": [
|
||||||
"client.MixinClientLevel",
|
"client.MixinClientLevel",
|
||||||
"client.MixinClientPacketListener",
|
"client.MixinClientPacketListener",
|
||||||
"client.MixinDebugScreenOverlay",
|
|
||||||
"client.MixinFogRenderer",
|
|
||||||
"client.MixinGameRenderer",
|
|
||||||
"client.MixinLevelRenderer",
|
"client.MixinLevelRenderer",
|
||||||
"client.MixinLightTexture",
|
|
||||||
"client.MixinOptionsScreen",
|
"client.MixinOptionsScreen",
|
||||||
"client.MixinMinecraft",
|
"client.MixinMinecraft",
|
||||||
"client.MixinTextureUtil"
|
"client.MixinTextureUtil"
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
"DistantHorizons.common.mixins.json",
|
||||||
"DistantHorizons.fabric.mixins.json"
|
"DistantHorizons.fabric.mixins.json"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ loom {
|
|||||||
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
|
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
|
||||||
|
|
||||||
mixinConfigs = [
|
mixinConfigs = [
|
||||||
|
"DistantHorizons.common.mixins.json",
|
||||||
"DistantHorizons.forge.mixins.json"
|
"DistantHorizons.forge.mixins.json"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
package com.seibel.distanthorizons.forge.mixins.client;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
|
||||||
import net.minecraft.client.gui.components.DebugScreenOverlay;
|
|
||||||
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.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mixin(DebugScreenOverlay.class)
|
|
||||||
public class MixinDebugScreenOverlay
|
|
||||||
{
|
|
||||||
|
|
||||||
@Inject(method = "getSystemInformation", at = @At("RETURN"))
|
|
||||||
private void addCustomF3(CallbackInfoReturnable<List<String>> cir)
|
|
||||||
{
|
|
||||||
List<String> messages = cir.getReturnValue();
|
|
||||||
F3Screen.addStringToDisplay(messages);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-84
@@ -1,84 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.forge.mixins.client;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
|
||||||
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 net.minecraft.client.Camera;
|
|
||||||
import net.minecraft.client.renderer.FogRenderer;
|
|
||||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
|
||||||
import net.minecraft.world.effect.MobEffects;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
import net.minecraft.world.level.material.FluidState;
|
|
||||||
#else
|
|
||||||
import net.minecraft.world.level.material.FogType;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Mixin(FogRenderer.class)
|
|
||||||
public class MixinFogRenderer
|
|
||||||
{
|
|
||||||
|
|
||||||
// Using this instead of Float.MAX_VALUE because Sodium don't like it.
|
|
||||||
private static final float A_REALLY_REALLY_BIG_VALUE = 420694206942069.F;
|
|
||||||
private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F;
|
|
||||||
|
|
||||||
@Inject(at = @At("RETURN"),
|
|
||||||
method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V",
|
|
||||||
remap = #if MC_VER == MC_1_17_1 || MC_VER == MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge
|
|
||||||
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback)
|
|
||||||
{
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
FluidState fluidState = camera.getFluidInCamera();
|
|
||||||
boolean cameraNotInFluid = fluidState.isEmpty();
|
|
||||||
#else
|
|
||||||
FogType fogTypes = camera.getFluidInCamera();
|
|
||||||
boolean cameraNotInFluid = fogTypes == FogType.NONE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
Entity entity = camera.getEntity();
|
|
||||||
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
|
||||||
if (!isSpecialFog && cameraNotInFluid && fogMode == FogMode.FOG_TERRAIN
|
|
||||||
&& !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial()
|
|
||||||
&& Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get())
|
|
||||||
{
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
|
||||||
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
|
|
||||||
#else
|
|
||||||
RenderSystem.setShaderFogStart(A_REALLY_REALLY_BIG_VALUE);
|
|
||||||
RenderSystem.setShaderFogEnd(A_EVEN_LARGER_VALUE);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-58
@@ -1,58 +0,0 @@
|
|||||||
package com.seibel.distanthorizons.forge.mixins.client;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.DependencySetupDoneCheck;
|
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
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;
|
|
||||||
|
|
||||||
// TODO: Check if this port from fabric works
|
|
||||||
@Mixin(GameRenderer.class)
|
|
||||||
public class MixinGameRenderer
|
|
||||||
{
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName());
|
|
||||||
|
|
||||||
#if MC_VER >= MC_1_17_1
|
|
||||||
// FIXME: This I think will dup multiple renderStartupEvent calls...
|
|
||||||
@Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL"))
|
|
||||||
public void onStartupShaders(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
LOGGER.info("Starting up renderer (forge)");
|
|
||||||
if (!DependencySetupDoneCheck.isDone)
|
|
||||||
{
|
|
||||||
LOGGER.warn("Dependency setup is not done yet, skipping renderer this startup event!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ClientApi.INSTANCE.rendererStartupEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "shutdownShaders", at = @At("HEAD"))
|
|
||||||
public void onShutdownShaders(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
LOGGER.info("Shutting down renderer (forge)");
|
|
||||||
if (!DependencySetupDoneCheck.isDone)
|
|
||||||
{
|
|
||||||
LOGGER.warn("Dependency setup is not done yet, skipping renderer this shutdown event!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ClientApi.INSTANCE.rendererShutdownEvent();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
|
|
||||||
@Inject(method = {"loadEffect"}, at = @At("TAIL"))
|
|
||||||
public void onStartupShaders(CallbackInfo ci) {
|
|
||||||
ClientApi.INSTANCE.rendererStartupEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "shutdownEffect", at = @At("HEAD"))
|
|
||||||
public void onShutdownShaders(CallbackInfo ci) {
|
|
||||||
ClientApi.INSTANCE.rendererShutdownEvent();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
-59
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.forge.mixins.client;
|
|
||||||
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.NativeImage;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
|
||||||
import net.minecraft.client.renderer.LightTexture;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
@Mixin(LightTexture.class)
|
|
||||||
public class MixinLightTexture
|
|
||||||
{
|
|
||||||
@Shadow //# if MC_VER >= MC_1_20_4 (remap = false) # endif
|
|
||||||
@Final
|
|
||||||
private NativeImage lightPixels;
|
|
||||||
|
|
||||||
|
|
||||||
@Inject(method = "updateLightTexture(F)V", at = @At("RETURN"))
|
|
||||||
public void updateLightTexture(float partialTicks, CallbackInfo ci)
|
|
||||||
{
|
|
||||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
|
||||||
if (mc == null || mc.getWrappedClientLevel() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
|
||||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,11 +9,7 @@
|
|||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"client.MixinClientPacketListener",
|
"client.MixinClientPacketListener",
|
||||||
"client.MixinDebugScreenOverlay",
|
|
||||||
"client.MixinFogRenderer",
|
|
||||||
"client.MixinGameRenderer",
|
|
||||||
"client.MixinLevelRenderer",
|
"client.MixinLevelRenderer",
|
||||||
"client.MixinLightTexture",
|
|
||||||
"client.MixinOptionsScreen",
|
"client.MixinOptionsScreen",
|
||||||
"client.MixinTextureUtil"
|
"client.MixinTextureUtil"
|
||||||
],
|
],
|
||||||
|
|||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
|
||||||
import net.minecraft.client.gui.components.DebugScreenOverlay;
|
|
||||||
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.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mixin(DebugScreenOverlay.class)
|
|
||||||
public class MixinDebugScreenOverlay
|
|
||||||
{
|
|
||||||
|
|
||||||
@Inject(method = "getSystemInformation", at = @At("RETURN"))
|
|
||||||
private void addCustomF3(CallbackInfoReturnable<List<String>> cir)
|
|
||||||
{
|
|
||||||
List<String> messages = cir.getReturnValue();
|
|
||||||
F3Screen.addStringToDisplay(messages);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-84
@@ -1,84 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
|
||||||
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 net.minecraft.client.Camera;
|
|
||||||
import net.minecraft.client.renderer.FogRenderer;
|
|
||||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
|
||||||
import net.minecraft.world.effect.MobEffects;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
import net.minecraft.world.level.material.FluidState;
|
|
||||||
#else
|
|
||||||
import net.minecraft.world.level.material.FogType;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Mixin(FogRenderer.class)
|
|
||||||
public class MixinFogRenderer
|
|
||||||
{
|
|
||||||
|
|
||||||
// Using this instead of Float.MAX_VALUE because Sodium don't like it.
|
|
||||||
private static final float A_REALLY_REALLY_BIG_VALUE = 420694206942069.F;
|
|
||||||
private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F;
|
|
||||||
|
|
||||||
@Inject(at = @At("RETURN"),
|
|
||||||
method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V",
|
|
||||||
remap = #if MC_VER == MC_1_17_1 || MC_VER == MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge
|
|
||||||
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback)
|
|
||||||
{
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
FluidState fluidState = camera.getFluidInCamera();
|
|
||||||
boolean cameraNotInFluid = fluidState.isEmpty();
|
|
||||||
#else
|
|
||||||
FogType fogTypes = camera.getFluidInCamera();
|
|
||||||
boolean cameraNotInFluid = fogTypes == FogType.NONE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
Entity entity = camera.getEntity();
|
|
||||||
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
|
||||||
if (!isSpecialFog && cameraNotInFluid && fogMode == FogMode.FOG_TERRAIN
|
|
||||||
&& !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial()
|
|
||||||
&& Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get())
|
|
||||||
{
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
|
||||||
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
|
|
||||||
#else
|
|
||||||
RenderSystem.setShaderFogStart(A_REALLY_REALLY_BIG_VALUE);
|
|
||||||
RenderSystem.setShaderFogEnd(A_EVEN_LARGER_VALUE);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-58
@@ -1,58 +0,0 @@
|
|||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.DependencySetupDoneCheck;
|
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
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;
|
|
||||||
|
|
||||||
// TODO: Check if this port from fabric works
|
|
||||||
@Mixin(GameRenderer.class)
|
|
||||||
public class MixinGameRenderer
|
|
||||||
{
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName());
|
|
||||||
|
|
||||||
#if MC_VER >= MC_1_17_1
|
|
||||||
// FIXME: This I think will dup multiple renderStartupEvent calls...
|
|
||||||
@Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL"))
|
|
||||||
public void onStartupShaders(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
LOGGER.info("Starting up renderer (forge)");
|
|
||||||
if (!DependencySetupDoneCheck.isDone)
|
|
||||||
{
|
|
||||||
LOGGER.warn("Dependency setup is not done yet, skipping renderer this startup event!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ClientApi.INSTANCE.rendererStartupEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "shutdownShaders", at = @At("HEAD"))
|
|
||||||
public void onShutdownShaders(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
LOGGER.info("Shutting down renderer (forge)");
|
|
||||||
if (!DependencySetupDoneCheck.isDone)
|
|
||||||
{
|
|
||||||
LOGGER.warn("Dependency setup is not done yet, skipping renderer this shutdown event!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ClientApi.INSTANCE.rendererShutdownEvent();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
|
|
||||||
@Inject(method = {"loadEffect"}, at = @At("TAIL"))
|
|
||||||
public void onStartupShaders(CallbackInfo ci) {
|
|
||||||
ClientApi.INSTANCE.rendererStartupEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "shutdownEffect", at = @At("HEAD"))
|
|
||||||
public void onShutdownShaders(CallbackInfo ci) {
|
|
||||||
ClientApi.INSTANCE.rendererShutdownEvent();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
-59
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Distant Horizons mod
|
|
||||||
* licensed under the GNU LGPL v3 License.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020-2023 James Seibel
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
|
||||||
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.NativeImage;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
|
||||||
import net.minecraft.client.renderer.LightTexture;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
@Mixin(LightTexture.class)
|
|
||||||
public class MixinLightTexture
|
|
||||||
{
|
|
||||||
@Shadow
|
|
||||||
@Final
|
|
||||||
private NativeImage lightPixels;
|
|
||||||
|
|
||||||
|
|
||||||
@Inject(method = "updateLightTexture(F)V", at = @At("RETURN"))
|
|
||||||
public void updateLightTexture(float partialTicks, CallbackInfo ci)
|
|
||||||
{
|
|
||||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
|
||||||
if (mc == null || mc.getWrappedClientLevel() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IClientLevelWrapper clientLevel = mc.getWrappedClientLevel();
|
|
||||||
MinecraftRenderWrapper.INSTANCE.updateLightmap(this.lightPixels, clientLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,11 +9,7 @@
|
|||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"client.MixinClientPacketListener",
|
"client.MixinClientPacketListener",
|
||||||
"client.MixinDebugScreenOverlay",
|
|
||||||
"client.MixinFogRenderer",
|
|
||||||
"client.MixinGameRenderer",
|
|
||||||
"client.MixinLevelRenderer",
|
"client.MixinLevelRenderer",
|
||||||
"client.MixinLightTexture",
|
|
||||||
"client.MixinOptionsScreen",
|
"client.MixinOptionsScreen",
|
||||||
"client.MixinTextureUtil"
|
"client.MixinTextureUtil"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ issueTrackerURL = "${issues}"
|
|||||||
acceptableRemoteVersions = "*"
|
acceptableRemoteVersions = "*"
|
||||||
|
|
||||||
# We may need this to make forge (lexforge) & neoforge work together
|
# We may need this to make forge (lexforge) & neoforge work together
|
||||||
|
[[mixins]]
|
||||||
|
config = "DistantHorizons.common.mixins.json"
|
||||||
[[mixins]]
|
[[mixins]]
|
||||||
config = "DistantHorizons.neoforge.mixins.json"
|
config = "DistantHorizons.neoforge.mixins.json"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user