From 527bf8e1ceb45bd97a91ab988cba94d651daf5c4 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 12 May 2024 20:12:38 +0400 Subject: [PATCH] Prefix accessor names with mod ID To avoid conflicts with other mods overriding them. Fixes https://github.com/YaLTeR/MouseTweaks/issues/131 --- .../handlers/GuiContainerHandler.java | 10 ++++---- .../AbstractContainerScreenAccessor.java | 24 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/yalter/mousetweaks/handlers/GuiContainerHandler.java b/src/main/java/yalter/mousetweaks/handlers/GuiContainerHandler.java index 55afa6e..7897274 100644 --- a/src/main/java/yalter/mousetweaks/handlers/GuiContainerHandler.java +++ b/src/main/java/yalter/mousetweaks/handlers/GuiContainerHandler.java @@ -39,15 +39,15 @@ public List getSlots() { @Override public Slot getSlotUnderMouse(double mouseX, double mouseY) { - return screenAccessor.invokeFindSlot(mouseX, mouseY); + return screenAccessor.mousetweaks$invokeFindSlot(mouseX, mouseY); } @Override public boolean disableRMBDraggingFunctionality() { - screenAccessor.setSkipNextRelease(true); + screenAccessor.mousetweaks$setSkipNextRelease(true); - if (screenAccessor.getIsQuickCrafting() && screenAccessor.getQuickCraftingButton() == 1) { - screenAccessor.setIsQuickCrafting(false); + if (screenAccessor.mousetweaks$getIsQuickCrafting() && screenAccessor.mousetweaks$getQuickCraftingButton() == 1) { + screenAccessor.mousetweaks$setIsQuickCrafting(false); return true; } @@ -56,7 +56,7 @@ public boolean disableRMBDraggingFunctionality() { @Override public void clickSlot(Slot slot, MouseButton mouseButton, boolean shiftPressed) { - screenAccessor.invokeSlotClicked( + screenAccessor.mousetweaks$invokeSlotClicked( slot, slot.index, mouseButton.getValue(), diff --git a/src/main/java/yalter/mousetweaks/mixin/AbstractContainerScreenAccessor.java b/src/main/java/yalter/mousetweaks/mixin/AbstractContainerScreenAccessor.java index 80053f9..03eaeed 100644 --- a/src/main/java/yalter/mousetweaks/mixin/AbstractContainerScreenAccessor.java +++ b/src/main/java/yalter/mousetweaks/mixin/AbstractContainerScreenAccessor.java @@ -9,21 +9,21 @@ @Mixin(AbstractContainerScreen.class) public interface AbstractContainerScreenAccessor { - @Invoker - Slot invokeFindSlot(double x, double y); + @Invoker("findSlot") + Slot mousetweaks$invokeFindSlot(double x, double y); - @Invoker - void invokeSlotClicked(Slot slot, int index, int button, ClickType clickType); + @Invoker("slotClicked") + void mousetweaks$invokeSlotClicked(Slot slot, int index, int button, ClickType clickType); - @Accessor - boolean getIsQuickCrafting(); + @Accessor("isQuickCrafting") + boolean mousetweaks$getIsQuickCrafting(); - @Accessor - void setIsQuickCrafting(boolean value); + @Accessor("isQuickCrafting") + void mousetweaks$setIsQuickCrafting(boolean value); - @Accessor - int getQuickCraftingButton(); + @Accessor("quickCraftingButton") + int mousetweaks$getQuickCraftingButton(); - @Accessor - void setSkipNextRelease(boolean value); + @Accessor("skipNextRelease") + void mousetweaks$setSkipNextRelease(boolean value); }