Skip to content

Commit

Permalink
增加了炫彩选择框
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxing2005 committed Jul 18, 2024
1 parent efd88ef commit dbd3638
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/xiao_xing/BetterTooltipBox/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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_);
}
}

0 comments on commit dbd3638

Please sign in to comment.