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/miscfeatures/AbiphoneWarning.java | |
| 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/miscfeatures/AbiphoneWarning.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java index 254c891a..67ac4f4c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java @@ -23,6 +23,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.GuiElement; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils; +import io.github.moulberry.notenoughupdates.events.SlotClickEvent; import io.github.moulberry.notenoughupdates.util.ItemUtils; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -33,6 +34,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -68,29 +70,28 @@ public class AbiphoneWarning extends GuiElement { return shouldPerformCheck() && showWarning; } - public boolean onMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) { - if (!shouldPerformCheck()) return false; - if (!NotEnoughUpdates.INSTANCE.config.misc.abiphoneWarning) return false; - if (slotId == -999) return false; - if (clickedButton == 0) return false; + @SubscribeEvent + public void onMouseClick(SlotClickEvent event) { + if (!shouldPerformCheck()) return; + if (!NotEnoughUpdates.INSTANCE.config.misc.abiphoneWarning) return; + if (event.slotId == -999) return; + if (event.clickedButton == 0) return; GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; - ItemStack clickedContact = chest.inventorySlots.getSlot(slotId).getStack(); - if (clickedContact == null) return false; + ItemStack clickedContact = chest.inventorySlots.getSlot(event.slotId).getStack(); + if (clickedContact == null) return; List<String> list = ItemUtils.getLore(clickedContact); - if (list.isEmpty()) return false; + if (list.isEmpty()) return; String last = list.get(list.size() - 1); if (last.contains("Right-click to remove contact!")) { showWarning = true; contactName = clickedContact.getDisplayName(); - contactSlot = slotId; - return true; + contactSlot = event.slotId; + event.setCanceled(true); } - - return false; } public void overrideIsMouseOverSlot(Slot slot, int mouseX, int mouseY, CallbackInfoReturnable<Boolean> cir) { |
