Skip to content

Commit 0224137

Browse files
authored
mixin jei to stop "delete" when in excluded area (#100)
1 parent 53f305e commit 0224137

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.cleanroommc.modularui.core.mixin.jei;
2+
3+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
5+
import mezz.jei.gui.GuiScreenHelper;
6+
import mezz.jei.gui.overlay.IngredientGrid;
7+
import mezz.jei.gui.overlay.IngredientGridWithNavigation;
8+
9+
import net.minecraft.client.Minecraft;
10+
11+
import org.spongepowered.asm.mixin.Final;
12+
import org.spongepowered.asm.mixin.Mixin;
13+
import org.spongepowered.asm.mixin.Shadow;
14+
import org.spongepowered.asm.mixin.injection.At;
15+
16+
@Mixin(value = IngredientGridWithNavigation.class, remap = false)
17+
public abstract class IngredientGridMixin {
18+
19+
@Shadow
20+
@Final
21+
private GuiScreenHelper guiScreenHelper;
22+
23+
@WrapOperation(method = "drawTooltips",
24+
at = @At(value = "INVOKE",
25+
target = "Lmezz/jei/gui/overlay/IngredientGrid;drawTooltips(Lnet/minecraft/client/Minecraft;II)V"))
26+
private void considerExclusions(IngredientGrid instance, Minecraft minecraft, int mouseX, int mouseY, Operation<Void> original) {
27+
if (!guiScreenHelper.isInGuiExclusionArea(mouseX, mouseY))
28+
original.call(instance, minecraft, mouseX, mouseY);
29+
}
30+
}

src/main/resources/mixin.modularui.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
],
1616
"mixins": [
1717
"ContainerAccessor",
18-
"FontRendererAccessor"
18+
"FontRendererAccessor",
19+
"jei.IngredientGridMixin"
1920
]
2021
}

0 commit comments

Comments
 (0)