aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2023-05-31 13:05:36 +0200
committerGitHub <noreply@github.com>2023-05-31 13:05:36 +0200
commitb40c37b653ba43d9603c578c440092c9f464935f (patch)
tree4a519fe477c183d55aa5143291b622c18e4f8be9
parent631cfec46220df2be3ae677f8f58a128303502e7 (diff)
downloadNotEnoughUpdates-b40c37b653ba43d9603c578c440092c9f464935f.tar.gz
NotEnoughUpdates-b40c37b653ba43d9603c578c440092c9f464935f.tar.bz2
NotEnoughUpdates-b40c37b653ba43d9603c578c440092c9f464935f.zip
Change `@Redirect` to `@ModifyArg` (#693)
* Change @Redirect to @ModifyArg * Make it compile --------- Co-authored-by: xef5000 <64156533+xef5000@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
index 04f3ba93..f9e0a132 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
@@ -67,7 +67,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.Set;
-@Mixin(GuiContainer.class)
+@Mixin(value = GuiContainer.class, priority = 500)
public abstract class MixinGuiContainer extends GuiScreen {
private static boolean hasProfileViewerStack = false;
private static final ItemStack profileViewerStack = Utils.createItemStack(
@@ -172,14 +172,12 @@ public abstract class MixinGuiContainer extends GuiScreen {
}
}
- @Redirect(method = "drawScreen", at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/gui/inventory/GuiContainer;renderToolTip(Lnet/minecraft/item/ItemStack;II)V"))
- public void drawScreen_renderTooltip(GuiContainer guiContainer, ItemStack stack, int x, int y) {
+ @ModifyArg(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;renderToolTip(Lnet/minecraft/item/ItemStack;II)V"), index = 0)
+ public ItemStack adjustItemStack(ItemStack itemStack) {
if (theSlot.slotNumber == BetterContainers.profileViewerStackIndex) {
- this.renderToolTip(profileViewerStack, x, y);
+ return profileViewerStack;
} else {
- this.renderToolTip(stack, x, y);
+ return itemStack;
}
}
@@ -302,7 +300,8 @@ public abstract class MixinGuiContainer extends GuiScreen {
public boolean drawScreen_canBeHovered(Slot slot) {
if ((NotEnoughUpdates.INSTANCE.config.improvedSBMenu.hideEmptyPanes &&
BetterContainers.isOverriding() && BetterContainers.isBlankStack(slot.slotNumber, slot.getStack())) ||
- slot.getStack() != null && slot.getStack().hasTagCompound() && slot.getStack().getTagCompound().getBoolean("NEUHIDETOOLIP")) {
+ slot.getStack() != null &&
+ slot.getStack().hasTagCompound() && slot.getStack().getTagCompound().getBoolean("NEUHIDETOOLIP")) {
return false;
}
return slot.canBeHovered();