From fe598949ca5ee7d3308eb600bba5d9ac030ac410 Mon Sep 17 00:00:00 2001 From: MicrocontrollersDev Date: Fri, 23 Aug 2024 22:23:55 -0700 Subject: [PATCH] clean up code --- .../dev/microcontrollers/overlaytweaks/OverlayTweaks.java | 8 ++++---- .../overlaytweaks/config/OverlayTweaksConfig.java | 4 ++-- .../mixin/BuiltinItemModelRendererMixin.java | 8 ++++---- .../overlaytweaks/mixin/InGameHudMixin.java | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/dev/microcontrollers/overlaytweaks/OverlayTweaks.java b/src/main/java/dev/microcontrollers/overlaytweaks/OverlayTweaks.java index a471007..5e043c8 100644 --- a/src/main/java/dev/microcontrollers/overlaytweaks/OverlayTweaks.java +++ b/src/main/java/dev/microcontrollers/overlaytweaks/OverlayTweaks.java @@ -4,8 +4,8 @@ import net.fabricmc.api.ModInitializer; public class OverlayTweaks implements ModInitializer { - @Override - public void onInitialize() { - OverlayTweaksConfig.CONFIG.load(); - } + @Override + public void onInitialize() { + OverlayTweaksConfig.CONFIG.load(); + } } \ No newline at end of file diff --git a/src/main/java/dev/microcontrollers/overlaytweaks/config/OverlayTweaksConfig.java b/src/main/java/dev/microcontrollers/overlaytweaks/config/OverlayTweaksConfig.java index 89345e4..93f99d0 100644 --- a/src/main/java/dev/microcontrollers/overlaytweaks/config/OverlayTweaksConfig.java +++ b/src/main/java/dev/microcontrollers/overlaytweaks/config/OverlayTweaksConfig.java @@ -39,7 +39,7 @@ public class OverlayTweaksConfig { @SerialEntry public double fireOverlayHeight = 0.0; @SerialEntry public float customFireOverlayOpacity = 100F; @SerialEntry public boolean removeItemTooltip = false; - //#if MC <= 1.20.1 + //#if MC == 1.20.1 //$$ @SerialEntry public boolean hideScoreboardInDebug = false; //#endif @SerialEntry public boolean classicDebugStyle = false; @@ -198,7 +198,7 @@ public static Screen configScreen(Screen parent) { .binding(defaults.removeItemTooltip, () -> config.removeItemTooltip, newVal -> config.removeItemTooltip = newVal) .controller(TickBoxControllerBuilder::create) .build()) - //#if MC <= 1.20.1 + //#if MC == 1.20.1 //$$ .option(Option.createBuilder() //$$ .name(Text.translatable("overlay-tweaks.hide-scoreboard-in-debug-hud")) //$$ .description(OptionDescription.of(Text.translatable("overlay-tweaks.hide-scoreboard-in-debug-hud.description"))) diff --git a/src/main/java/dev/microcontrollers/overlaytweaks/mixin/BuiltinItemModelRendererMixin.java b/src/main/java/dev/microcontrollers/overlaytweaks/mixin/BuiltinItemModelRendererMixin.java index 2dc8eac..cee601a 100644 --- a/src/main/java/dev/microcontrollers/overlaytweaks/mixin/BuiltinItemModelRendererMixin.java +++ b/src/main/java/dev/microcontrollers/overlaytweaks/mixin/BuiltinItemModelRendererMixin.java @@ -7,7 +7,7 @@ import dev.microcontrollers.overlaytweaks.config.OverlayTweaksConfig; import net.minecraft.client.MinecraftClient; import net.minecraft.client.model.ModelPart; -//#if MC < 1.21 +//#if MC <= 1.20.6 //$$ import net.minecraft.client.network.ClientPlayerEntity; //#endif import net.minecraft.client.render.RenderLayer; @@ -24,11 +24,11 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -//#if MC < 1.21 +//#if MC <= 1.20.6 //$$ import org.spongepowered.asm.mixin.injection.ModifyArgs; //#endif import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -//#if MC < 1.21 +//#if MC <= 1.20.6 //$$ import org.spongepowered.asm.mixin.injection.invoke.arg.Args; //#endif @@ -55,7 +55,7 @@ private void cancelShieldRendering(ItemStack stack, ModelTransformationMode mode } // We need to get the parent method parameters for mode, so we need to use @ModifyArgs. - //#if MC < 1.21 + //#if MC <= 1.20.6 //$$ @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;IIFFFF)V")) //$$ private void changeShieldColorAndTransparency(Args args, ItemStack stack, ModelTransformationMode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { //$$ if (MinecraftClient.getInstance().player == null) return; diff --git a/src/main/java/dev/microcontrollers/overlaytweaks/mixin/InGameHudMixin.java b/src/main/java/dev/microcontrollers/overlaytweaks/mixin/InGameHudMixin.java index 6a93902..ae6413a 100644 --- a/src/main/java/dev/microcontrollers/overlaytweaks/mixin/InGameHudMixin.java +++ b/src/main/java/dev/microcontrollers/overlaytweaks/mixin/InGameHudMixin.java @@ -2,7 +2,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import dev.microcontrollers.overlaytweaks.config.OverlayTweaksConfig; -//#if MC <= 1.20.1 +//#if MC == 1.20.1 //$$ import net.minecraft.client.MinecraftClient; //#endif import net.minecraft.client.gui.DrawContext; @@ -53,7 +53,7 @@ private float changeFreezingOpacity(float opacity) { return opacity * OverlayTweaksConfig.CONFIG.instance().freezingOpacity / 100F; } - @Inject(method = "renderSpyglassOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIFFIIII)V", shift = At.Shift.BEFORE)) + @Inject(method = "renderSpyglassOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIFFIIII)V")) private void changeSpyglassOpacityPre(DrawContext context, float scale, CallbackInfo ci) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, OverlayTweaksConfig.CONFIG.instance().spyglassOpacity / 100F); } @@ -72,7 +72,7 @@ private void removeItemTooltip(DrawContext context, CallbackInfo ci) { if (OverlayTweaksConfig.CONFIG.instance().removeItemTooltip) ci.cancel(); } - //#if MC <= 1.20.1 + //#if MC == 1.20.1 //$$ @Inject(method = "renderScoreboardSidebar(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/scoreboard/ScoreboardObjective;)V", at = @At("HEAD"), cancellable = true) //$$ private void removeScoreboardInDebug(CallbackInfo ci) { //$$ if (OverlayTweaksConfig.CONFIG.instance().hideScoreboardInDebug && MinecraftClient.getInstance().options.debugEnabled) {