From 38f3ec2348c0d02d3b2ef682bfbb62aa0a327cec Mon Sep 17 00:00:00 2001 From: Yasin Date: Wed, 18 Oct 2023 02:04:12 +0200 Subject: [PATCH] Change flame height (#370) --- .../skyblocker/config/SkyblockerConfig.java | 11 ++++++++++ .../config/categories/GeneralCategory.java | 20 +++++++++++++++++ .../mixin/InGameOverlayRendererMixin.java | 22 +++++++++++++++++++ .../assets/skyblocker/lang/en_us.json | 3 +++ src/main/resources/skyblocker.mixins.json | 1 + 5 files changed, 57 insertions(+) create mode 100644 src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 107fe26e64..4efcc1df14 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -209,6 +209,9 @@ public static class General { @SerialEntry public TeleportOverlay teleportOverlay = new TeleportOverlay(); + @SerialEntry + public FlameOverlay flameOverlay = new FlameOverlay(); + @SerialEntry public List lockedSlots = new ArrayList<>(); @@ -391,6 +394,14 @@ public static class TeleportOverlay { public boolean enableWitherImpact = true; } + public static class FlameOverlay { + @SerialEntry + public float flameHeight = 0f; + + @SerialEntry + public float flameOpacity = 0f; + } + public enum Direction { HORIZONTAL, VERTICAL; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java index 80792ab941..635d192f8c 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -525,6 +525,26 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig .controller(ConfigUtils::createBooleanController) .build()) .build()) + + //Flame Overlay + .group(OptionGroup.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay")) + .collapsed(true) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay.flameHeight")) + .binding(defaults.general.flameOverlay.flameHeight, + () -> config.general.flameOverlay.flameHeight, + newValue -> config.general.flameOverlay.flameHeight = newValue) + .controller(opt -> FloatSliderControllerBuilder.create(opt).range(0.0f, 0.5f).step(0.01f)) + .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay.flameOpacity")) + .binding(defaults.general.flameOverlay.flameOpacity, + () -> config.general.flameOverlay.flameOpacity, + newValue -> config.general.flameOverlay.flameOpacity = newValue) + .controller(opt -> FloatSliderControllerBuilder.create(opt).range(0.0f, 0.8f).step(0.1f)) + .build()) + .build()) .build(); } } diff --git a/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java b/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java new file mode 100644 index 0000000000..b957603ab6 --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java @@ -0,0 +1,22 @@ +package de.hysky.skyblocker.mixin; + +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import net.minecraft.client.gui.hud.InGameOverlayRenderer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +@Mixin(InGameOverlayRenderer.class) +public class InGameOverlayRendererMixin { + + @ModifyArg(method = "renderFireOverlay", index = 2, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/BufferBuilder;vertex(Lorg/joml/Matrix4f;FFF)Lnet/minecraft/client/render/VertexConsumer;")) + private static float configureFlameHeight(float y) { + return y - SkyblockerConfigManager.get().general.flameOverlay.flameHeight; + } + + @ModifyArg(method = "renderFireOverlay", index = 3, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/VertexConsumer;color(FFFF)Lnet/minecraft/client/render/VertexConsumer;")) + private static float configureFlameOpacity(float opacity) { + return opacity - SkyblockerConfigManager.get().general.flameOverlay.flameOpacity; + } + +} diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 90805b3164..df58136c7f 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -107,6 +107,9 @@ "text.autoconfig.skyblocker.option.general.teleportOverlay.enableEtherTransmission": "Enable Ether Transmission Overlay", "text.autoconfig.skyblocker.option.general.teleportOverlay.enableSinrecallTransmission": "Enable Sinrecall Transmission Overlay", "text.autoconfig.skyblocker.option.general.teleportOverlay.enableWitherImpact": "Enable Wither Impact Overlay", + "text.autoconfig.skyblocker.option.general.flameOverlay": "Flame Overlay", + "text.autoconfig.skyblocker.option.general.flameOverlay.flameHeight": "Flame Height", + "text.autoconfig.skyblocker.option.general.flameOverlay.flameOpacity": "Flame Opacity", "skyblocker.itemTooltip.nullMessage": "§b[§6Skyblocker§b] §cItem price information on tooltip will renew in max 60 seconds. If not, check latest.log", "skyblocker.itemTooltip.noData": "§cNo Data", diff --git a/src/main/resources/skyblocker.mixins.json b/src/main/resources/skyblocker.mixins.json index efca46f732..4e7bfe16ed 100644 --- a/src/main/resources/skyblocker.mixins.json +++ b/src/main/resources/skyblocker.mixins.json @@ -16,6 +16,7 @@ "GenericContainerScreenHandlerMixin", "HandledScreenMixin", "InGameHudMixin", + "InGameOverlayRendererMixin", "InventoryScreenMixin", "ItemMixin", "ItemStackMixin",