Skip to content

Commit

Permalink
is_hurt, is_sneaking
Browse files Browse the repository at this point in the history
Co-Authored-By: IMS <[email protected]>
  • Loading branch information
Asek3 and IMS212 committed Nov 21, 2023
1 parent e0e6565 commit 619bb4a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/net/coderbot/iris/uniforms/CommonUniforms.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public static void generalCommonUniforms(UniformHolder uniforms, FrameUpdateNoti
.uniform1i(PER_FRAME, "isEyeInWater", CommonUniforms::isEyeInWater)
.uniform1f(PER_FRAME, "blindness", CommonUniforms::getBlindness)
.uniform1f(PER_FRAME, "nightVision", CommonUniforms::getNightVision)
.uniform1b(PER_FRAME, "is_sneaking", CommonUniforms::isSneaking)
.uniform1b(PER_FRAME, "is_hurt", CommonUniforms::isHurt)
// TODO: Do we need to clamp this to avoid fullbright breaking shaders? Or should shaders be able to detect
// that the player is trying to turn on fullbright?
.uniform1f(PER_FRAME, "screenBrightness", () -> client.options.gamma)
Expand All @@ -133,6 +135,22 @@ public static void generalCommonUniforms(UniformHolder uniforms, FrameUpdateNoti
.uniform3d(PER_FRAME, "fogColor", CapturedRenderingState.INSTANCE::getFogColor);
}

private static boolean isHurt() {
if (client.player != null) {
return client.player.isHurt();
} else {
return false;
}
}

private static boolean isSneaking() {
if (client.player != null) {
return client.player.isCrouching();
} else {
return false;
}
}

private static Vector3d getSkyColor() {
if (client.level == null || client.cameraEntity == null) {
return ZERO_VECTOR_3d;
Expand Down

0 comments on commit 619bb4a

Please sign in to comment.