diff options
| author | Roman / Linnea Gräf <roman.graef@gmail.com> | 2022-10-05 04:46:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-04 22:46:26 -0400 |
| commit | 61513e20063d8997ba8a6d0cd7f34ef4ca29cdb6 (patch) | |
| tree | f6a219b5a914b21722bb0c0eb26190db2e69256c /src/main/java/io/github/moulberry/notenoughupdates/mixins | |
| parent | 7b647deee3d37847f2ca2a6895d837748800c6b6 (diff) | |
| download | notenoughupdates-61513e20063d8997ba8a6d0cd7f34ef4ca29cdb6.tar.gz notenoughupdates-61513e20063d8997ba8a6d0cd7f34ef4ca29cdb6.tar.bz2 notenoughupdates-61513e20063d8997ba8a6d0cd7f34ef4ca29cdb6.zip | |
EnchantingSolvers.java (#341)
* EnchantingSolvers.java
* remove println
* register bin overlay
Co-authored-by: nopo <nopotheemail@gmail.com>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/mixins')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java | 2 | ||||
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java | 82 |
2 files changed, 15 insertions, 69 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java index 1b6b5c61..94b1c704 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java @@ -60,7 +60,7 @@ public class MixinGuiChest { private static final String TARGET_SBADRAWSTRING = "Lcodes/biscuit/skyblockaddons/asm/hooks/GuiChestHook;" + "drawString(Lnet/minecraft/client/gui/FontRenderer;Ljava/lang/String;III)I"; - @Redirect(method = "drawGuiContainerForegroundLayer", at = @At(value = "INVOKE", target = TARGET_SBADRAWSTRING, remap = false)) + @Redirect(method = "drawGuiContainerForegroundLayer", at = @At(value = "INVOKE", target = TARGET_SBADRAWSTRING, remap = false), expect = 0) public int drawGuiContainerForegroundLayer_SBA_drawString( FontRenderer fontRenderer, String text, 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 a24f4c84..81918939 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -21,14 +21,13 @@ package io.github.moulberry.notenoughupdates.mixins; import io.github.moulberry.notenoughupdates.NEUOverlay; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.events.SlotClickEvent; import io.github.moulberry.notenoughupdates.listener.RenderListener; import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneWarning; -import io.github.moulberry.notenoughupdates.miscfeatures.AntiCoopAdd; import io.github.moulberry.notenoughupdates.miscfeatures.AuctionBINWarning; import io.github.moulberry.notenoughupdates.miscfeatures.AuctionSortModeWarning; import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers; import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers; -import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay; import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.miscgui.GuiCustomEnchant; import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay; @@ -60,7 +59,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; @Mixin(GuiContainer.class) public abstract class MixinGuiContainer extends GuiScreen { @@ -98,7 +96,8 @@ public abstract class MixinGuiContainer extends GuiScreen { if (tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")) { String tagName = tag.getCompoundTag("SkullOwner").getString("Name"); String displayName = Utils.cleanColour(cc.inventorySlots.get(22).getStack().getDisplayName()); - if (displayName.length() - tagName.length() >= 0 && tagName.equals(displayName.substring(displayName.length() - tagName.length()))) { + if (displayName.length() - tagName.length() >= 0 && tagName.equals(displayName.substring( + displayName.length() - tagName.length()))) { ci.cancel(); this.zLevel = 100.0F; @@ -127,7 +126,8 @@ public abstract class MixinGuiContainer extends GuiScreen { else if (!($this instanceof GuiChest)) BetterContainers.profileViewerStackIndex = -1; - if (slot.getStack() == null && NotEnoughUpdates.INSTANCE.overlay.searchMode && RenderListener.drawingGuiScreen && NotEnoughUpdates.INSTANCE.isOnSkyblock()) { + if (slot.getStack() == null && NotEnoughUpdates.INSTANCE.overlay.searchMode && RenderListener.drawingGuiScreen && + NotEnoughUpdates.INSTANCE.isOnSkyblock()) { GlStateManager.pushMatrix(); GlStateManager.translate(0, 0, 100 + Minecraft.getMinecraft().getRenderItem().zLevel); GlStateManager.depthMask(false); @@ -303,74 +303,20 @@ public abstract class MixinGuiContainer extends GuiScreen { @Inject(method = "handleMouseClick", at = @At(value = "HEAD"), cancellable = true) public void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, CallbackInfo ci) { + if (slotIn == null) return; GuiContainer $this = (GuiContainer) (Object) this; - - if (AuctionBINWarning.getInstance().onMouseClick(slotIn, slotId, clickedButton, clickType)) { - ci.cancel(); - return; - } - - if (AbiphoneWarning.getInstance().onMouseClick(slotIn, slotId, clickedButton, clickType)) { + SlotClickEvent event = new SlotClickEvent($this, slotIn, slotId, clickedButton, clickType); + event.post(); + if (event.isCanceled()) { ci.cancel(); return; } - - if (AntiCoopAdd.onMouseClick(slotIn, slotId, clickedButton, clickType)) { - ci.cancel(); - return; - } - - AtomicBoolean ret = new AtomicBoolean(false); - SlotLocking.getInstance().onWindowClick(slotIn, slotId, clickedButton, clickType, (tuple) -> { + if (event.usePickblockInstead) { + $this.mc.playerController.windowClick( + $this.inventorySlots.windowId, + slotId, 2, 3, $this.mc.thePlayer + ); ci.cancel(); - - if (tuple == null) { - ret.set(true); - } else { - int newSlotId = tuple.getLeft(); - int newClickedButton = tuple.getMiddle(); - int newClickedType = tuple.getRight(); - - ret.set(true); - $this.mc.playerController.windowClick( - $this.inventorySlots.windowId, - newSlotId, - newClickedButton, - newClickedType, - $this.mc.thePlayer - ); - } - }); - if (ret.get()) return; - - if (slotIn != null && slotIn.getStack() != null) { - if (EnchantingSolvers.onStackClick(slotIn.getStack(), $this.inventorySlots.windowId, - slotId, clickedButton, clickType - )) { - ci.cancel(); - } else { - PetInfoOverlay.onStackClick(slotIn.getStack(), $this.inventorySlots.windowId, - slotId, clickedButton, clickType - ); - } - } - if (slotIn != null && BetterContainers.isOverriding() && (BetterContainers.isBlankStack( - slotIn.slotNumber, - slotIn.getStack() - ) || - BetterContainers.isButtonStack(slotIn.slotNumber, slotIn.getStack()))) { - BetterContainers.clickSlot(slotIn.getSlotIndex()); - - if (BetterContainers.isBlankStack(slotIn.slotNumber, slotIn.getStack())) { - GuiContainer chest = ((GuiContainer) Minecraft.getMinecraft().currentScreen); - Minecraft.getMinecraft().playerController.windowClick( - chest.inventorySlots.windowId, - slotId, 2, 3, Minecraft.getMinecraft().thePlayer - ); - ci.cancel(); - } else { - Utils.playPressSound(); - } } } } |
