Fix a few 1.16.5 compiler errors
This commit is contained in:
@@ -51,6 +51,8 @@ import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.client.ConfigGuiHandler;
|
||||
#elif MC_VERSION_1_17_1
|
||||
import net.minecraftforge.fmlclient.ConfigGuiHandler;
|
||||
#elif MC_VERSION_1_16_5
|
||||
import net.minecraftforge.fml.ExtensionPoint;
|
||||
#endif
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
package com.seibel.lod.forge.mixins;
|
||||
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -34,33 +35,59 @@ 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_VERSION_1_18_1 || MC_VERSION_1_18_2 || MC_VERSION_1_17_1
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
#endif
|
||||
|
||||
|
||||
@Mixin(FogRenderer.class)
|
||||
public class MixinFogRenderer {
|
||||
public class MixinFogRenderer
|
||||
{
|
||||
|
||||
// Using this instead of Float.MAX_VALUE because Sodium don't like it. (and copy paste in case someone in forge 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",
|
||||
method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V",
|
||||
remap = false) // Remap = false due to this being added by forge.
|
||||
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback) {
|
||||
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback)
|
||||
{
|
||||
ILodConfigWrapperSingleton CONFIG;
|
||||
try {
|
||||
try
|
||||
{
|
||||
CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
return; // May happen due to forge for some reason haven't inited out thingy yet.
|
||||
}
|
||||
FogType fogTypes = camera.getFluidInCamera();
|
||||
Entity entity = camera.getEntity();
|
||||
boolean isUnderWater = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
|
||||
if (!isUnderWater) {
|
||||
if (fogMode == FogMode.FOG_TERRAIN && fogTypes == FogType.NONE && CONFIG.client().graphics().fogQuality().getDisableVanillaFog()) {
|
||||
RenderSystem.setShaderFogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||
RenderSystem.setShaderFogEnd(A_EVEN_LARGER_VALUE);
|
||||
|
||||
|
||||
|
||||
#if MC_VERSION_1_18_1 || MC_VERSION_1_18_2 || MC_VERSION_1_17_1
|
||||
FogType fogTypes = camera.getFluidInCamera();
|
||||
boolean cameraNotInFluid = fogTypes == FogType.NONE;
|
||||
#else
|
||||
FluidState fluidState = camera.getFluidInCamera();
|
||||
boolean cameraNotInFluid = !fluidState.isEmpty();
|
||||
#endif
|
||||
|
||||
Entity entity = camera.getEntity();
|
||||
boolean isUnderWater = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
||||
if (!isUnderWater)
|
||||
{
|
||||
if (fogMode == FogMode.FOG_TERRAIN && cameraNotInFluid && CONFIG.client().graphics().fogQuality().getDisableVanillaFog())
|
||||
{
|
||||
#if MC_VERSION_1_18_1 || MC_VERSION_1_18_2 || MC_VERSION_1_17_1
|
||||
RenderSystem.setShaderFogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||
RenderSystem.setShaderFogEnd(A_EVEN_LARGER_VALUE);
|
||||
#else
|
||||
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ public class MixinOptionsScreen extends Screen {
|
||||
|
||||
@Inject(at = @At("HEAD"),method = "init")
|
||||
private void lodconfig$init(CallbackInfo ci) {
|
||||
if (SingletonHandler.get(ILodConfigWrapperSingleton.class).client().getOptionsButton())
|
||||
this.addRenderableWidget(new TexturedButtonWidget(
|
||||
if (SingletonHandler.get(ILodConfigWrapperSingleton.class).client().getOptionsButton()) {
|
||||
TexturedButtonWidget widget = new TexturedButtonWidget(
|
||||
// Where the button is on the screen
|
||||
this.width / 2 - 180, this.height / 6 - 12,
|
||||
// Width and height of the button
|
||||
@@ -66,6 +66,13 @@ public class MixinOptionsScreen extends Screen {
|
||||
// For now it goes to the client option by default
|
||||
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")),
|
||||
// Add a title to the screen
|
||||
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
|
||||
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title"));
|
||||
|
||||
#if MC_VERSION_1_18_1 || MC_VERSION_1_18_2
|
||||
this.addRenderableWidget(widget);
|
||||
#else
|
||||
this.addWidget(widget);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +19,10 @@
|
||||
|
||||
package com.seibel.lod.forge.mixins.unsafe;
|
||||
|
||||
import net.minecraft.util.ThreadingDetector;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
#if MC_VERSION_1_18_1 || MC_VERSION_1_18_2
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import net.minecraft.util.ThreadingDetector;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -46,7 +45,9 @@ public class MixinThreadingDectector {
|
||||
this.lock = new Semaphore(2);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
@Mixin(ThreadingDetector.class)
|
||||
public class MixinThreadingDectector {} //FIXME: Is there some way to make this file just not be added?
|
||||
|
||||
public class MixinThreadingDectector {}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user