From dbd3638606cd0205268fbdf4e50d2149b3826b68 Mon Sep 17 00:00:00 2001 From: xiaoxing2005 Date: Thu, 18 Jul 2024 20:14:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=82=AB=E5=BD=A9?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiao_xing/BetterTooltipBox/Config.java | 6 ++-- .../Mixins/drawSelectionBoxMixin.java | 28 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/xiao_xing/BetterTooltipBox/Config.java b/src/main/java/com/xiao_xing/BetterTooltipBox/Config.java index cfacd44..94d9588 100644 --- a/src/main/java/com/xiao_xing/BetterTooltipBox/Config.java +++ b/src/main/java/com/xiao_xing/BetterTooltipBox/Config.java @@ -19,10 +19,10 @@ public static void synchronizeConfiguration(File configFile) { "Enable BetterTooltipBox"); Enable_SelectionBox = configuration.getBoolean( - "Enable SelectionBox", + "Enable SelectionBox", Configuration.CATEGORY_GENERAL, - Enable_SelectionBox, - "Enable SelectionBox"); + Enable_SelectionBox, + "Enable SelectionBox"); if (configuration.hasChanged()) { configuration.save(); diff --git a/src/main/java/com/xiao_xing/BetterTooltipBox/Mixins/drawSelectionBoxMixin.java b/src/main/java/com/xiao_xing/BetterTooltipBox/Mixins/drawSelectionBoxMixin.java index 7558bff..20e693c 100644 --- a/src/main/java/com/xiao_xing/BetterTooltipBox/Mixins/drawSelectionBoxMixin.java +++ b/src/main/java/com/xiao_xing/BetterTooltipBox/Mixins/drawSelectionBoxMixin.java @@ -1,30 +1,30 @@ package com.xiao_xing.BetterTooltipBox.Mixins; -import net.minecraft.client.renderer.OpenGlHelper; +import static com.xiao_xing.BetterTooltipBox.Config.Enable_SelectionBox; + import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.MovingObjectPosition; -import org.lwjgl.opengl.GL11; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import static com.xiao_xing.BetterTooltipBox.Config.Enable_SelectionBox; - @Mixin(RenderGlobal.class) public class drawSelectionBoxMixin { + @Redirect( - method = "drawSelectionBox", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/RenderGlobal;drawOutlinedBoundingBox(Lnet/minecraft/util/AxisAlignedBB;I)V")) + method = "drawSelectionBox", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/RenderGlobal;drawOutlinedBoundingBox(Lnet/minecraft/util/AxisAlignedBB;I)V")) public void drawOutlinedBoundingBox(AxisAlignedBB p_147590_0_, int p_147590_1_) { - if(Enable_SelectionBox){ + if (Enable_SelectionBox) { float time = (System.currentTimeMillis() % 5000L) / 5000.0f * (float) (2 * Math.PI); - int color = (int) ((Math.sin(time) * 0.5f + 0.5f) * 255) << 16 | - (int) ((Math.cos(time) * 0.5f + 0.5f) * 255) << 8 | - 128; + int color = (int) ((Math.sin(time) * 0.5f + 0.5f) * 255) << 16 + | (int) ((Math.cos(time) * 0.5f + 0.5f) * 255) << 8 + | 128; RenderGlobal.drawOutlinedBoundingBox(p_147590_0_, color); - }RenderGlobal.drawOutlinedBoundingBox(p_147590_0_, p_147590_1_); + } + RenderGlobal.drawOutlinedBoundingBox(p_147590_0_, p_147590_1_); } }