From df6142e099152d5c1ab12c0901bdb74dc2df3f1e Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Tue, 20 Aug 2024 11:57:59 +0100 Subject: [PATCH] Search options screen: don't hold on to item search screen instance Also, allow search item to be updated even if search upgrade isn't currently switched on --- .../client/gui/pneumatic_armor/options/SearchOptions.java | 1 + .../pneumaticcraft/common/network/PacketUpdateSearchItem.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/desht/pneumaticcraft/client/gui/pneumatic_armor/options/SearchOptions.java b/src/main/java/me/desht/pneumaticcraft/client/gui/pneumatic_armor/options/SearchOptions.java index 27a580ffb..81d143a03 100644 --- a/src/main/java/me/desht/pneumaticcraft/client/gui/pneumatic_armor/options/SearchOptions.java +++ b/src/main/java/me/desht/pneumaticcraft/client/gui/pneumatic_armor/options/SearchOptions.java @@ -60,6 +60,7 @@ public void populateGui(IGuiScreen gui) { PneumaticArmorItem.setSearchedItem(helmetStack, newSearchedItem); NetworkHandler.sendToServer(new PacketUpdateSearchItem(newSearchedItem)); } + searchGui = null; } } diff --git a/src/main/java/me/desht/pneumaticcraft/common/network/PacketUpdateSearchItem.java b/src/main/java/me/desht/pneumaticcraft/common/network/PacketUpdateSearchItem.java index 9a54f879d..6a7692d4b 100644 --- a/src/main/java/me/desht/pneumaticcraft/common/network/PacketUpdateSearchItem.java +++ b/src/main/java/me/desht/pneumaticcraft/common/network/PacketUpdateSearchItem.java @@ -53,7 +53,7 @@ public Type type() { public static void handle(PacketUpdateSearchItem message, IPayloadContext ctx) { if (message.item() != null && message.item() != Items.AIR) { CommonArmorHandler handler = CommonArmorHandler.getHandlerForPlayer(ctx.player()); - if (handler.upgradeUsable(CommonUpgradeHandlers.searchHandler, true)) { + if (handler.upgradeUsable(CommonUpgradeHandlers.searchHandler, false)) { ItemStack helmetStack = handler.getPlayer().getItemBySlot(EquipmentSlot.HEAD); if (helmetStack.getItem() instanceof PneumaticArmorItem) { // should be, but let's be paranoid... PneumaticArmorItem.setSearchedItem(helmetStack, message.item());