Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.18.2' into 1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Dec 26, 2023
2 parents af6897c + 70c55db commit 044c915
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ public static void addIrisExclusiveUniforms(UniformHolder uniforms) {
uniforms.uniform1f(UniformUpdateFrequency.PER_FRAME, "thunderStrength", IrisExclusiveUniforms::getThunderStrength);
uniforms.uniform1f(UniformUpdateFrequency.PER_TICK, "currentPlayerHealth", IrisExclusiveUniforms::getCurrentHealth);
uniforms.uniform1f(UniformUpdateFrequency.PER_TICK, "maxPlayerHealth", IrisExclusiveUniforms::getMaxHealth);
uniforms.uniform1f(UniformUpdateFrequency.PER_TICK, "currentPlayerHunger", IrisExclusiveUniforms::getCurrentHunger);
uniforms.uniform1f(UniformUpdateFrequency.PER_TICK, "currentPlayerHunger", IrisExclusiveUniforms::getCurrentHunger);
uniforms.uniform1f(UniformUpdateFrequency.PER_TICK, "maxPlayerHunger", () -> 20);
uniforms.uniform1f(UniformUpdateFrequency.PER_TICK, "currentPlayerArmor", IrisExclusiveUniforms::getCurrentArmor);
uniforms.uniform1f(UniformUpdateFrequency.PER_TICK, "maxPlayerArmor", () -> 50);
uniforms.uniform1f(UniformUpdateFrequency.PER_TICK, "currentPlayerAir", IrisExclusiveUniforms::getCurrentAir);
uniforms.uniform1f(UniformUpdateFrequency.PER_TICK, "maxPlayerAir", IrisExclusiveUniforms::getMaxAir);
uniforms.uniform1b(UniformUpdateFrequency.PER_FRAME, "firstPersonCamera", IrisExclusiveUniforms::isFirstPersonCamera);
Expand Down Expand Up @@ -91,6 +93,14 @@ private static float getCurrentAir() {
return (float) Minecraft.getInstance().player.getAirSupply() / (float) Minecraft.getInstance().player.getMaxAirSupply();
}

private static float getCurrentArmor() {
if (Minecraft.getInstance().player == null || !Minecraft.getInstance().gameMode.getPlayerMode().isSurvival()) {
return -1;
}

return (float) Minecraft.getInstance().player.getArmor() / (float) 50.0);
}

private static float getMaxAir() {
if (Minecraft.getInstance().player == null || !Minecraft.getInstance().gameMode.getPlayerMode().isSurvival()) {
return -1;
Expand All @@ -107,6 +117,8 @@ private static float getMaxHealth() {
return Minecraft.getInstance().player.getMaxHealth();
}



private static boolean isFirstPersonCamera() {
// If camera type is not explicitly third-person, assume it's first-person.
switch (Minecraft.getInstance().options.getCameraType()) {
Expand Down

0 comments on commit 044c915

Please sign in to comment.