Added GameTime uniform value.
This commit is contained in:
parent
1e26de6a00
commit
b294225872
1 changed files with 9 additions and 9 deletions
|
@ -6,6 +6,8 @@ import net.minecraft.client.gl.PostProcessShader;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||
import org.dimdev.dimdoors.ModConfig;
|
||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
||||
|
@ -22,17 +24,15 @@ public class PostProcessShaderMixin {
|
|||
|
||||
@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) {
|
||||
if(program.getName().equals("fray")) {
|
||||
|
||||
if (PlayerModifiersComponent.getFray(getCameraPlayer()) > config.fray.grayScreenFray) {
|
||||
float overlayOpacity = (config.fray.grayScreenFray - PlayerModifiersComponent.getFray(getCameraPlayer())) / (config.fray.grayScreenFray - (float) config.fray.maxFray);
|
||||
program.getUniformByNameOrDummy("FrayIntensity").set(overlayOpacity);
|
||||
} else {
|
||||
program.getUniformByNameOrDummy("FrayIntensity").set(0.0f);
|
||||
}
|
||||
program.getUniformByNameOrDummy("GameTime").set(RenderSystem.getShaderGameTime());
|
||||
|
||||
if (PlayerModifiersComponent.getFray(getCameraPlayer()) > config.fray.grayScreenFray) {
|
||||
float overlayOpacity = (config.fray.grayScreenFray - PlayerModifiersComponent.getFray(getCameraPlayer())) / (config.fray.grayScreenFray - (float) config.fray.maxFray);
|
||||
program.getUniformByNameOrDummy("FrayIntensity").set(overlayOpacity);
|
||||
} else {
|
||||
program.getUniformByNameOrDummy("FrayIntensity").set(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue