Added disable vanilla fog to forge
This commit is contained in:
@@ -102,7 +102,7 @@ public class MixinWorldRenderer
|
||||
|
||||
if (minecraft.level.dimension() == ClientLevel.OVERWORLD) {
|
||||
CloudTexture cloudTexture = NoiseCloudHandler.cloudTextures.get(NoiseCloudHandler.cloudTextures.size() - 1);
|
||||
renderCloudLayer(poseStack, projectionMatrix, tickDelta, cameraX, cameraY, cameraZ, (float) (CONFIG.client().graphics().cloudQuality().getCloudHeight() + 0.01 /* Make clouds a bit higher so it dosnt do janky stuff */), 0, 1, 1, cloudTexture.resourceLocation);
|
||||
renderCloudLayer(poseStack, projectionMatrix, tickDelta, cameraX, cameraY, cameraZ, (float) (CONFIG.client().graphics().cloudQuality().getCloudHeight() + 0.01 /* Make clouds a bit higher so it dosnt do janky stuff */), 1, 1, cloudTexture.resourceLocation);
|
||||
}
|
||||
|
||||
ci.cancel();
|
||||
@@ -155,7 +155,7 @@ public class MixinWorldRenderer
|
||||
}
|
||||
}
|
||||
|
||||
private void renderCloudLayer(PoseStack poseStack, Matrix4f projectionMatrix, float tickDelta, double cameraX, double cameraY, double cameraZ, float cloudHeight, float cloudOffset, float cloudScale, float speedMod, ResourceLocation resourceLocation) {
|
||||
private void renderCloudLayer(PoseStack poseStack, Matrix4f projectionMatrix, float tickDelta, double cameraX, double cameraY, double cameraZ, float cloudHeight, float cloudScale, float speedMod, ResourceLocation resourceLocation) {
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableDepthTest();
|
||||
@@ -164,7 +164,7 @@ public class MixinWorldRenderer
|
||||
float scale = 12.0F * cloudScale;
|
||||
double speed = ((this.ticks + tickDelta) * (0.03F * speedMod));
|
||||
double posX = (cameraX + speed) / scale;
|
||||
double posY = (cloudHeight - (float) cameraY + cloudOffset) / cloudScale;
|
||||
double posY = (cloudHeight - (float) cameraY) / cloudScale;
|
||||
double posZ = cameraZ / scale + 0.33000001311302185D;
|
||||
posX -= Math.floor(posX / 2048.0D) * 2048;
|
||||
posZ -= Math.floor(posZ / 2048.0D) * 2048;
|
||||
@@ -215,7 +215,7 @@ public class MixinWorldRenderer
|
||||
if (this.cloudBuffer != null) this.cloudBuffer.close();
|
||||
|
||||
this.cloudBuffer = new VertexBuffer();
|
||||
this.buildCloudLayer(bufferBuilder, posX, posY, posZ, cloudOffset, cloudScale, cloudColor);
|
||||
this.buildCloudLayer(bufferBuilder, posX, posY, posZ, cloudScale, cloudColor);
|
||||
bufferBuilder.end();
|
||||
this.cloudBuffer.upload(bufferBuilder);
|
||||
}
|
||||
@@ -247,7 +247,7 @@ public class MixinWorldRenderer
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
private void buildCloudLayer(BufferBuilder bufferBuilder, double cloudX, double cloudY, double cloudZ, float offset, float scale, Vec3 color) {
|
||||
private void buildCloudLayer(BufferBuilder bufferBuilder, double cloudX, double cloudY, double cloudZ, float scale, Vec3 color) {
|
||||
float lowpFracAccur = (float) Math.pow(2.0, -8);
|
||||
float mediumpFracAccur = (float) Math.pow(2.0, -10);
|
||||
float viewDistance = 8;
|
||||
@@ -269,6 +269,7 @@ public class MixinWorldRenderer
|
||||
bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR_NORMAL);
|
||||
float adjustedCloudY = (float)Math.floor(cloudY / cloudThickness) * cloudThickness;
|
||||
|
||||
// Where the actual rendering happens
|
||||
ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
if (this.prevCloudsType == CloudStatus.FANCY) {
|
||||
int scaledViewDistance = (int) (((CONFIG.client().graphics().cloudQuality().getExtendClouds() ? CONFIG.client().graphics().quality().getLodChunkRenderDistance() : minecraft.options.renderDistance) / 2) / scale) / 2;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.seibel.lod.forge.mixins;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
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;
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
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;
|
||||
|
||||
@Mixin(FogRenderer.class)
|
||||
public class MixinFogRenderer {
|
||||
private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZ)V")
|
||||
private static final void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) {
|
||||
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(Float.MAX_VALUE);
|
||||
RenderSystem.setShaderFogEnd(Float.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,13 @@
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.seibel.lod.forge.mixins",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"MixinOptionsScreen",
|
||||
"MixinWorldRenderer"
|
||||
"MixinWorldRenderer",
|
||||
"MixinFogRenderer"
|
||||
],
|
||||
"server": []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user