Added GameTime uniform value.

This commit is contained in:
Waterpicker 2021-06-16 15:08:00 -05:00
parent 1e26de6a00
commit b294225872

View file

@ -6,6 +6,8 @@ import net.minecraft.client.gl.PostProcessShader;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import com.mojang.blaze3d.systems.RenderSystem;
import org.dimdev.dimdoors.DimensionalDoorsInitializer; import org.dimdev.dimdoors.DimensionalDoorsInitializer;
import org.dimdev.dimdoors.ModConfig; import org.dimdev.dimdoors.ModConfig;
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent; import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
@ -22,9 +24,9 @@ public class PostProcessShaderMixin {
@Shadow @Final private JsonEffectGlShader program; @Shadow @Final private JsonEffectGlShader program;
@Inject(method = "Lnet/minecraft/client/gl/PostProcessShader;render(F)V", at = @At("HEAD"), cancellable = true) @Inject(method = "render(F)V", at = @At("HEAD"), cancellable = true)
public void render(float time, CallbackInfo cir) { public void render(float time, CallbackInfo cir) {
if(program.getName().equals("fray")) { program.getUniformByNameOrDummy("GameTime").set(RenderSystem.getShaderGameTime());
if (PlayerModifiersComponent.getFray(getCameraPlayer()) > config.fray.grayScreenFray) { if (PlayerModifiersComponent.getFray(getCameraPlayer()) > config.fray.grayScreenFray) {
float overlayOpacity = (config.fray.grayScreenFray - PlayerModifiersComponent.getFray(getCameraPlayer())) / (config.fray.grayScreenFray - (float) config.fray.maxFray); float overlayOpacity = (config.fray.grayScreenFray - PlayerModifiersComponent.getFray(getCameraPlayer())) / (config.fray.grayScreenFray - (float) config.fray.maxFray);
@ -32,8 +34,6 @@ public class PostProcessShaderMixin {
} else { } else {
program.getUniformByNameOrDummy("FrayIntensity").set(0.0f); program.getUniformByNameOrDummy("FrayIntensity").set(0.0f);
} }
}
} }
private PlayerEntity getCameraPlayer() { private PlayerEntity getCameraPlayer() {