Skip to content

Commit

Permalink
Fixed bug with side fire and added better third person fire customiza…
Browse files Browse the repository at this point in the history
…tion support
  • Loading branch information
LordEnder-Kitty committed May 18, 2024
1 parent 48b5275 commit 99658c5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.20.6+build.1
loader_version=0.15.11

# Mod Properties
mod_version=1.0.0-1.20.5-6
mod_version=1.1.0-1.20.5-6
maven_group=net.enderkitty
archives_base_name=firehud

Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/enderkitty/config/FireHudConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class FireHudConfig implements ConfigData {
@ConfigEntry.Gui.PrefixText
@ConfigEntry.Gui.Tooltip
public boolean renderFireInLava = true;
public boolean renderThirdPersonFireInLava = true;
@ConfigEntry.Gui.Tooltip
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
public LavaFogOptions renderLavaFog = LavaFogOptions.VANILLA;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.enderkitty.config.FireHudConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.texture.Sprite;
Expand Down Expand Up @@ -32,10 +33,12 @@ public class EntityRendererDispatcherMixin {

@Inject(method = "renderFire", at = @At(value = "HEAD"), cancellable = true)
private void renderThirdPersonFire(MatrixStack matrices, VertexConsumerProvider vertexConsumers, Entity entity, Quaternionf rotation, CallbackInfo ci) {
if ((!config.renderVanillaHud && !config.sideFire && config.fireVignette == FireHudConfig.VignetteOptions.OFF && !config.fireScreenTint && (!config.renderFireInLava && entity.isOnFire()) &&
(!config.renderWithFireResistance && ((LivingEntity) entity).hasStatusEffect(StatusEffects.FIRE_RESISTANCE))) || !config.renderThirdPersonFire) {

ci.cancel();
MinecraftClient client = MinecraftClient.getInstance();

if (client.player != null && client.player.isOnFire()) {
if ((!config.renderThirdPersonFireInLava && client.player.isInLava())) ci.cancel();
if ((!config.renderWithFireResistance && client.player.hasStatusEffect(StatusEffects.FIRE_RESISTANCE))) ci.cancel();
if (!config.renderThirdPersonFire) ci.cancel();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class InGameOverlayRendererMixin {

@Inject(method = "renderOverlays", at = @At("TAIL"))
private static void renderOverlays(MinecraftClient client, MatrixStack matrices, CallbackInfo ci) {
if (client.player != null && !client.player.isSpectator() && client.player.isOnFire() && config.sideFire) {
if (client.player != null && !client.player.isSpectator() && client.player.isOnFire() && config.sideFire &&
!(!config.renderFireInLava && client.player.isInLava()) && !(!config.renderWithFireResistance && client.player.hasStatusEffect(StatusEffects.FIRE_RESISTANCE))) {
renderSideFireOverlay(client, matrices);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/firehud/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"text.autoconfig.firehud.option.renderFireInLava.@PrefixText": "Lava",
"text.autoconfig.firehud.option.renderFireInLava.@Tooltip": "Toggles rendering the fire hud when in lava",
"text.autoconfig.firehud.option.renderFireInLava": "Render Fire In Lava",
"text.autoconfig.firehud.option.renderThirdPersonFireInLava": "Third Person Fire In Lava",
"text.autoconfig.firehud.option.renderLavaFog.@Tooltip": "Toggles rendering the fog effect when in lava, making it easier to see",
"text.autoconfig.firehud.option.renderLavaFog": "Render Lava Fog",

Expand Down

0 comments on commit 99658c5

Please sign in to comment.