diff options
Diffstat (limited to 'src/main/java')
8 files changed, 114 insertions, 35 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java b/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java index 13c31b54..d8d3615d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java @@ -22,11 +22,12 @@ package io.github.moulberry.notenoughupdates.events; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Slot; import net.minecraftforge.fml.common.eventhandler.Cancelable; +import org.jetbrains.annotations.NotNull; @Cancelable public class SlotClickEvent extends NEUEvent { - public final GuiContainer guiContainer; - public final Slot slot; + public final @NotNull GuiContainer guiContainer; + public final @NotNull Slot slot; public final int slotId; public int clickedButton; public int clickType; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java index 82c9b3b6..bd923157 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java @@ -31,6 +31,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.AuctionBINWarning; import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers; import io.github.moulberry.notenoughupdates.miscfeatures.CrystalMetalDetectorSolver; import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers; +import io.github.moulberry.notenoughupdates.miscfeatures.HexPriceWarning; import io.github.moulberry.notenoughupdates.miscfeatures.PresetWarning; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; import io.github.moulberry.notenoughupdates.miscfeatures.dev.RepoExporters; @@ -54,6 +55,7 @@ import io.github.moulberry.notenoughupdates.util.ItemUtils; import io.github.moulberry.notenoughupdates.util.NotificationHandler; import io.github.moulberry.notenoughupdates.util.Rectangle; import io.github.moulberry.notenoughupdates.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.ScreenReplacer; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -402,6 +404,8 @@ public class RenderListener { if (GuiCustomHex.getInstance().shouldOverride(containerName)) { GuiCustomHex.getInstance().render(event.renderPartialTicks, containerName); + if (HexPriceWarning.INSTANCE.shouldShow()) + HexPriceWarning.INSTANCE.render(); event.setCanceled(true); return; } @@ -594,6 +598,12 @@ public class RenderListener { } if (!hoveringButton[0]) buttonHovered = null; + for (ScreenReplacer allScreenReplacer : ScreenReplacer.Companion.getAllScreenReplacers()) { + if (allScreenReplacer.shouldShow()) { + allScreenReplacer.render(); + } + } + if (AuctionBINWarning.getInstance().shouldShow()) { AuctionBINWarning.getInstance().render(); } @@ -768,7 +778,8 @@ public class RenderListener { } } JsonObject kismetBazaar = neu.manager.auctionManager.getBazaarInfo("KISMET_FEATHER"); - double kismetPrice = (kismetBazaar != null && kismetBazaar.has("curr_buy")) ? kismetBazaar.get("curr_buy").getAsFloat() : 0; + double kismetPrice = + (kismetBazaar != null && kismetBazaar.has("curr_buy")) ? kismetBazaar.get("curr_buy").getAsFloat() : 0; String kismetStr = EnumChatFormatting.RED + formatCoins(kismetPrice) + " coins"; if (neu.config.dungeons.useKismetOnDungeonProfit) profitLossBIN = kismetUsed ? profitLossBIN - kismetPrice : profitLossBIN; @@ -872,6 +883,14 @@ public class RenderListener { int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth; int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1; + for (ScreenReplacer allScreenReplacer : ScreenReplacer.Companion.getAllScreenReplacers()) { + if (allScreenReplacer.shouldShow()) { + allScreenReplacer.mouseInput(mouseX, mouseY); + event.setCanceled(true); + return; + } + } + if (AuctionBINWarning.getInstance().shouldShow()) { AuctionBINWarning.getInstance().mouseInput(mouseX, mouseY); event.setCanceled(true); @@ -1038,6 +1057,14 @@ public class RenderListener { return; } + for (ScreenReplacer allScreenReplacer : ScreenReplacer.Companion.getAllScreenReplacers()) { + if (allScreenReplacer.shouldShow()) { + allScreenReplacer.keyboardInput(); + event.setCanceled(true); + return; + } + } + if (AuctionBINWarning.getInstance().shouldShow()) { AuctionBINWarning.getInstance().keyboardInput(); event.setCanceled(true); @@ -1093,12 +1120,12 @@ public class RenderListener { } if (tradeWindowActive) { - TradeWindow.keyboardInput(); - if (Keyboard.getEventKey() != Keyboard.KEY_ESCAPE) { - event.setCanceled(true); - Minecraft.getMinecraft().dispatchKeypresses(); - neu.overlay.keyboardInput(focusInv); - } + TradeWindow.keyboardInput(); + if (Keyboard.getEventKey() != Keyboard.KEY_ESCAPE) { + event.setCanceled(true); + Minecraft.getMinecraft().dispatchKeypresses(); + neu.overlay.keyboardInput(focusInv); + } return; } @@ -1220,6 +1247,7 @@ public class RenderListener { /** * Support for switching between different pages in the RecipeView gui via right and left arrow key + * * @param event */ //Because GuiScreen.keyTyped does not fire the KEY_LEFT and KEY_RIGHT keys. Maybe some event cancelled it? diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java index a3af232f..1da81605 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java @@ -28,6 +28,8 @@ import io.github.moulberry.notenoughupdates.core.GuiElementTextField; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingFloat; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; +import io.github.moulberry.notenoughupdates.events.SlotClickEvent; +import io.github.moulberry.notenoughupdates.miscfeatures.HexPriceWarning; import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.miscgui.CalendarOverlay; import io.github.moulberry.notenoughupdates.miscgui.util.OrbDisplay; @@ -36,6 +38,7 @@ import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.ItemUtils; import io.github.moulberry.notenoughupdates.util.Utils; +import lombok.var; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -3377,7 +3380,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID)); cancelButtonAnimTime = System.currentTimeMillis(); @@ -3389,7 +3392,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(click); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, click, 0, 0, stack, transactionID)); } return true; @@ -3414,7 +3417,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID)); if (isInGemstones()) { currentState = EnchantState.HAS_ITEM_IN_GEMSTONE; @@ -3457,7 +3460,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID)); cancelButtonAnimTime = System.currentTimeMillis(); @@ -3473,7 +3476,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot( enchanterCurrentEnch.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, enchanterCurrentEnch.slotIndex, 0, 0, stack, transactionID )); @@ -3556,7 +3559,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID));*/ cancelButtonAnimTime = System.currentTimeMillis(); @@ -3574,7 +3577,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot( enchanterCurrentItem.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, enchanterCurrentItem.slotIndex, 0, 0, stack, transactionID )); @@ -3656,7 +3659,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID)); cancelButtonAnimTime = System.currentTimeMillis(); @@ -3674,7 +3677,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot( enchanterCurrentItem.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, enchanterCurrentItem.slotIndex, 0, 0, stack, transactionID )); @@ -3757,7 +3760,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID)); cancelButtonAnimTime = System.currentTimeMillis(); @@ -3779,7 +3782,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot( enchanterCurrentItem.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, enchanterCurrentItem.slotIndex, 0, 0, stack, transactionID )); @@ -3993,7 +3996,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(ench.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, ench.slotIndex, 0, 0, stack, transactionID )); @@ -4001,7 +4004,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID)); cancelButtonAnimTime = System.currentTimeMillis(); @@ -4032,7 +4035,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(item.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, item.slotIndex, 0, 0, stack, transactionID )); @@ -4064,7 +4067,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(item.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, item.slotIndex, 0, 0, stack, transactionID )); @@ -4096,7 +4099,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(item.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, item.slotIndex, 0, 0, stack, transactionID )); @@ -4129,7 +4132,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(item.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, item.slotIndex, 0, 0, stack, transactionID )); @@ -4166,7 +4169,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(ench.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, ench.slotIndex, 0, 0, stack, transactionID )); @@ -4174,7 +4177,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID)); cancelButtonAnimTime = System.currentTimeMillis(); @@ -4205,7 +4208,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(item.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, item.slotIndex, 0, 0, stack, transactionID )); @@ -4242,7 +4245,7 @@ public class GuiCustomHex extends Gui { short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(item.slotIndex); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, item.slotIndex, 0, 0, stack, transactionID )); @@ -4299,7 +4302,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID)); cancelButtonAnimTime = System.currentTimeMillis(); @@ -4320,7 +4323,7 @@ public class GuiCustomHex extends Gui { EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer; short transactionID = playerIn.openContainer.getNextTransactionID(playerIn.inventory); ItemStack stack = ((ContainerChest) chest.inventorySlots).getLowerChestInventory().getStackInSlot(45); - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow( + onClick(new C0EPacketClickWindow( chest.inventorySlots.windowId, 45, 0, 0, stack, transactionID)); cancelButtonAnimTime = System.currentTimeMillis(); @@ -4333,6 +4336,20 @@ public class GuiCustomHex extends Gui { return true; } + public void onClick(C0EPacketClickWindow packet) { + var cont = Minecraft.getMinecraft().thePlayer.openContainer; + var clickEvent = new SlotClickEvent( + (GuiContainer) Minecraft.getMinecraft().currentScreen, + cont.getSlot(packet.getSlotId()), + packet.getSlotId(), + packet.getUsedButton(), + packet.getMode() + ); + HexPriceWarning.INSTANCE.onClick(clickEvent); + if (!clickEvent.isCanceled()) + Minecraft.getMinecraft().getNetHandler().addToSendQueue(packet); + } + public boolean keyboardInput() { if (currentState == EnchantState.HAS_ITEM && searchField.getFocus()) { if (Keyboard.getEventKeyState()) { 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 41ae6e66..ebc362ac 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -23,6 +23,7 @@ import io.github.moulberry.notenoughupdates.NEUOverlay; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.events.DrawSlotReturnEvent; import io.github.moulberry.notenoughupdates.events.GuiContainerBackgroundDrawnEvent; +import io.github.moulberry.notenoughupdates.events.IsSlotBeingHoveredEvent; import io.github.moulberry.notenoughupdates.events.SlotClickEvent; import io.github.moulberry.notenoughupdates.listener.RenderListener; import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneFavourites; @@ -37,6 +38,7 @@ import io.github.moulberry.notenoughupdates.miscgui.GuiCustomEnchant; import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay; import io.github.moulberry.notenoughupdates.miscgui.hex.GuiCustomHex; import io.github.moulberry.notenoughupdates.util.Utils; +import lombok.var; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; @@ -53,6 +55,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.MinecraftForge; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -203,6 +206,18 @@ public abstract class MixinGuiContainer extends GuiScreen { GuiCustomHex.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir); AuctionBINWarning.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir); PresetWarning.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir); + var event = new IsSlotBeingHoveredEvent(); + MinecraftForge.EVENT_BUS.post(event); + switch (event.getOverride()) { + case DEFER_TO_DEFAULT: + break; + case IS_HOVERED: + cir.setReturnValue(true); + break; + case IS_NOT_HOVERED: + cir.setReturnValue(false); + break; + } } @Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawGradientRect(IIIIII)V")) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/BazaarTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/BazaarTweaks.java index 254d0c2e..f29cc97c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/BazaarTweaks.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/BazaarTweaks.java @@ -23,6 +23,7 @@ import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigAccordionId; import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; import io.github.moulberry.moulconfig.annotations.ConfigOption; public class BazaarTweaks { @@ -70,4 +71,12 @@ public class BazaarTweaks { @ConfigEditorBoolean @ConfigAccordionId(id = 0) public boolean escFullClose = true; + + @Expose + @ConfigOption( + name = "Bazaar Overpay Warning", + desc = "Warns you before you would pay more than this amount of coins for an item in the /bz" + ) + @ConfigEditorSlider(minValue = 0, maxValue = 500_000_000, minStep = 1) + public double bazaarOverpayWarning = 1_000_000; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Enchanting.java b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Enchanting.java index b7c45c0c..a692586d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Enchanting.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Enchanting.java @@ -24,6 +24,7 @@ import io.github.moulberry.moulconfig.annotations.ConfigAccordionId; import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; import io.github.moulberry.moulconfig.annotations.ConfigOption; public class Enchanting { @@ -239,4 +240,12 @@ public class Enchanting { ) @ConfigAccordionId(id = 0) public int supPower = 11; + + @Expose + @ConfigOption( + name = "Hex Overpay Warning", + desc = "Warns you before you would pay more than this amount of coins for an item in the /hex" + ) + @ConfigEditorSlider(minValue = 0, maxValue = 500_000_000, minStep = 1) + public double hexOverpayWarning = 10_000_000; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java index eb6a5696..cc974841 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java @@ -158,8 +158,7 @@ public class ItemUtils { } public static @Nullable String getDisplayName(@Nullable ItemStack itemStack) { - if (itemStack == null) - return null; + if (null == itemStack) return null; return getDisplayName(itemStack.getTagCompound()); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 2878406e..6b597ebe 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -66,6 +66,7 @@ import net.minecraft.util.Matrix4f; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.fml.common.Loader; +import org.jetbrains.annotations.NotNull; import org.lwjgl.BufferUtils; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -2316,7 +2317,7 @@ public class Utils { return new UUID(most.longValue(), least.longValue()); } - public static String getOpenChestName() { + public static @NotNull String getOpenChestName() { return SBInfo.getInstance().currentlyOpenChestName; } |