From 1135464d9b05fc87281a649b34fd1b78c61047be Mon Sep 17 00:00:00 2001 From: Luligabi1 <33578169+Luligabi1@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:18:42 -0300 Subject: [PATCH] Use LibGUI's non-deprecated setInputFilter --- .../dml/screen/handler/LootFabricatorScreenHandler.kt | 4 ++-- .../modular_armor/screen/MatterCondenserScreenHandler.kt | 4 ++-- .../dml/modular_armor/screen/ModularArmorScreenHandler.kt | 6 +----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/base/src/main/kotlin/dev/nathanpb/dml/screen/handler/LootFabricatorScreenHandler.kt b/base/src/main/kotlin/dev/nathanpb/dml/screen/handler/LootFabricatorScreenHandler.kt index fd39d269..49cbab8d 100644 --- a/base/src/main/kotlin/dev/nathanpb/dml/screen/handler/LootFabricatorScreenHandler.kt +++ b/base/src/main/kotlin/dev/nathanpb/dml/screen/handler/LootFabricatorScreenHandler.kt @@ -51,7 +51,7 @@ class LootFabricatorScreenHandler( setRootPanel(root) val inputSlot = WItemSlot(blockInventory, 0, 1, 1, false).apply { - setFilter { stack -> + setInputFilter { stack -> world.recipeManager.values().filterIsInstance() .any { it.input.test(stack) } } @@ -67,7 +67,7 @@ class LootFabricatorScreenHandler( (0 until 9).forEach { val x = (it % 3) val y = (it / 3) - val slot = WItemSlot.of(blockInventory, it + 1).setFilter { false } + val slot = WItemSlot.of(blockInventory, it + 1).setInputFilter { false } root.add(slot, (x + 6) * 18, (y + 1) * 18) } diff --git a/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/screen/MatterCondenserScreenHandler.kt b/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/screen/MatterCondenserScreenHandler.kt index 00e24264..c7444c34 100644 --- a/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/screen/MatterCondenserScreenHandler.kt +++ b/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/screen/MatterCondenserScreenHandler.kt @@ -65,7 +65,7 @@ class MatterCondenserScreenHandler( val slots = WPlainPanel() val armorSlot = WTooltippedItemSlot.of(blockInventory, 0, true, Text.translatable("gui.${MOD_ID}.glitch_armor_only")).apply { - setFilter { + setInputFilter { it.item is ItemModularGlitchArmor && !ModularArmorData(it).tier().isMaxTier() } } @@ -74,7 +74,7 @@ class MatterCondenserScreenHandler( val matterSlots = (1..6).map { WItemSlot(blockInventory, it, 1, 1, false).apply { - setFilter { stack -> + setInputFilter { stack -> stack.item is ItemPristineMatter } diff --git a/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/screen/ModularArmorScreenHandler.kt b/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/screen/ModularArmorScreenHandler.kt index 233c8319..f2735a38 100644 --- a/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/screen/ModularArmorScreenHandler.kt +++ b/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/screen/ModularArmorScreenHandler.kt @@ -20,8 +20,6 @@ package dev.nathanpb.dml.modular_armor.screen -import com.sun.java.accessibility.util.SwingEventMonitor.addChangeListener -import dev.nathanpb.dml.MOD_ID import dev.nathanpb.dml.data.dataModel import dev.nathanpb.dml.identifier import dev.nathanpb.dml.item.ItemDataModel @@ -30,7 +28,6 @@ import dev.nathanpb.dml.modular_armor.core.ModularEffectRegistry import dev.nathanpb.dml.modular_armor.data.ModularArmorData import dev.nathanpb.dml.modular_armor.net.C2S_MODULAR_EFFECT_TOGGLE import dev.nathanpb.dml.screen.handler.registerScreenHandlerForItemStack -import dev.nathanpb.dml.screen.handler.slot.WTooltippedItemSlot import dev.nathanpb.dml.utils.RenderUtils import dev.nathanpb.dml.utils.takeOrNull import io.github.cottonmc.cotton.gui.SyncedGuiDescription @@ -46,7 +43,6 @@ import net.minecraft.inventory.SimpleInventory import net.minecraft.item.ItemStack import net.minecraft.network.PacketByteBuf import net.minecraft.screen.ArrayPropertyDelegate -import net.minecraft.text.Text import net.minecraft.util.Hand import net.minecraft.util.Identifier @@ -102,7 +98,7 @@ class ModularArmorScreenHandler( } val dataModelSlot = WItemSlot(blockInventory, 0, 1, 1, false).apply { - setFilter { + setInputFilter { it.isEmpty || ( (it.item as? ItemDataModel)?.category != null && data.tier().ordinal >= it.dataModel.tier().ordinal