Skip to content

Commit b1d9262

Browse files
committed
WrapOperation-ify
1 parent f46d4d6 commit b1d9262

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ public void register(IModRegistry registry) {
249249
if (material.hasProperty(PropertyKey.DUST)) {
250250
materialTreeList.add(new MaterialTree(material));
251251
}
252-
if (material.hasFlag(GENERATE_BOLT_SCREW) && material.hasFlag(GENERATE_RING)) {
252+
if (material.hasFlag(GENERATE_BOLT_SCREW) && material.hasFlag(GENERATE_RING) &&
253+
material.hasProperty(PropertyKey.TOOL)) {
253254
registry.addIngredientInfo(ToolItems.TOOLBELT.get(material), VanillaTypes.ITEM,
254255
"item.gt.tool.toolbelt.tooltip", "item.gt.tool.toolbelt.paint", "item.gt.tool.toolbelt.dye",
255256
"item.gt.tool.toolbelt.maintenance");

src/main/java/gregtech/mixins/forge/GuiIngameForgeMixin.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
import net.minecraft.client.gui.ScaledResolution;
99
import net.minecraftforge.client.GuiIngameForge;
1010

11+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
12+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
1113
import org.spongepowered.asm.mixin.Mixin;
1214
import org.spongepowered.asm.mixin.injection.At;
13-
import org.spongepowered.asm.mixin.injection.Redirect;
1415

1516
@Mixin(GuiIngameForge.class)
1617
public class GuiIngameForgeMixin extends GuiIngame {
@@ -19,13 +20,13 @@ private GuiIngameForgeMixin(Minecraft mcIn) {
1920
super(mcIn);
2021
}
2122

22-
@Redirect(method = "renderToolHighlight",
23-
at = @At(value = "INVOKE",
24-
target = "Lnet/minecraft/client/gui/ScaledResolution;getScaledHeight()I"))
25-
private int shiftToolHighlightText(ScaledResolution res) {
23+
@WrapOperation(method = "renderToolHighlight",
24+
at = @At(value = "INVOKE",
25+
target = "Lnet/minecraft/client/gui/ScaledResolution;getScaledHeight()I"))
26+
private int shiftToolHighlightText(ScaledResolution resolution, Operation<Integer> op) {
2627
if (ConfigHolder.client.toolbeltConfig.enableToolbeltHotbarDisplay &&
2728
highlightingItemStack.getItem() instanceof ItemGTToolbelt)
28-
return res.getScaledHeight() - 31 + 6;
29-
else return res.getScaledHeight();
29+
return op.call(resolution) - 31 + 6;
30+
else return op.call(resolution);
3031
}
3132
}

0 commit comments

Comments
 (0)