Skip to content

Commit f46d4d6

Browse files
committed
mixin to relocate tool highlight text
1 parent 531f868 commit f46d4d6

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package gregtech.mixins.forge;
2+
3+
import gregtech.api.items.toolitem.ItemGTToolbelt;
4+
import gregtech.common.ConfigHolder;
5+
6+
import net.minecraft.client.Minecraft;
7+
import net.minecraft.client.gui.GuiIngame;
8+
import net.minecraft.client.gui.ScaledResolution;
9+
import net.minecraftforge.client.GuiIngameForge;
10+
11+
import org.spongepowered.asm.mixin.Mixin;
12+
import org.spongepowered.asm.mixin.injection.At;
13+
import org.spongepowered.asm.mixin.injection.Redirect;
14+
15+
@Mixin(GuiIngameForge.class)
16+
public class GuiIngameForgeMixin extends GuiIngame {
17+
18+
private GuiIngameForgeMixin(Minecraft mcIn) {
19+
super(mcIn);
20+
}
21+
22+
@Redirect(method = "renderToolHighlight",
23+
at = @At(value = "INVOKE",
24+
target = "Lnet/minecraft/client/gui/ScaledResolution;getScaledHeight()I"))
25+
private int shiftToolHighlightText(ScaledResolution res) {
26+
if (ConfigHolder.client.toolbeltConfig.enableToolbeltHotbarDisplay &&
27+
highlightingItemStack.getItem() instanceof ItemGTToolbelt)
28+
return res.getScaledHeight() - 31 + 6;
29+
else return res.getScaledHeight();
30+
}
31+
}

src/main/resources/mixins.gregtech.forge.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"minVersion": "0.8",
66
"compatibilityLevel": "JAVA_8",
77
"mixins": [
8+
"GuiIngameForgeMixin",
89
"ModelLoaderRegistryMixin",
910
"OreIngredientMixin",
1011
"SpecialArmorPropertiesMixin"

0 commit comments

Comments
 (0)