From 96f199ffcecf358357a7bef065b258f860f68135 Mon Sep 17 00:00:00 2001 From: Luligabi1 <33578169+Luligabi1@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:15:58 -0300 Subject: [PATCH] You no longer can drop your Deep Learner while its screen is open (part of #88) --- .../handler/DeepLearnerScreenHandler.kt | 23 ++++++++++++++++--- gradle.properties | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/base/src/main/kotlin/dev/nathanpb/dml/screen/handler/DeepLearnerScreenHandler.kt b/base/src/main/kotlin/dev/nathanpb/dml/screen/handler/DeepLearnerScreenHandler.kt index e9504cdb..fe69282a 100644 --- a/base/src/main/kotlin/dev/nathanpb/dml/screen/handler/DeepLearnerScreenHandler.kt +++ b/base/src/main/kotlin/dev/nathanpb/dml/screen/handler/DeepLearnerScreenHandler.kt @@ -25,6 +25,7 @@ import dev.nathanpb.dml.data.DataModelData import dev.nathanpb.dml.data.DeepLearnerData import dev.nathanpb.dml.data.dataModel import dev.nathanpb.dml.identifier +import dev.nathanpb.dml.item.ITEM_DEEP_LEARNER import dev.nathanpb.dml.item.ItemDataModel import dev.nathanpb.dml.screen.handler.widget.WEntityShowcase import dev.nathanpb.dml.screen.handler.widget.WStylizedButton @@ -35,7 +36,6 @@ import dev.nathanpb.dml.utils.setStacks import io.github.cottonmc.cotton.gui.SyncedGuiDescription import io.github.cottonmc.cotton.gui.widget.* import io.github.cottonmc.cotton.gui.widget.data.Insets -import io.github.cottonmc.cotton.gui.widget.icon.Icon import io.github.cottonmc.cotton.gui.widget.icon.TextureIcon import net.fabricmc.api.EnvType import net.fabricmc.loader.api.FabricLoader @@ -243,7 +243,7 @@ class DeepLearnerScreenHandler ( update() } - root.add(createPlayerInventoryPanel(), 0, 5*18+6) + root.add(DeepLearnerPlayerInv(playerInventory), 0, 5*18+6) root.validate(this) update() } @@ -263,7 +263,7 @@ class DeepLearnerScreenHandler ( ): WItemSlot(inventory, 0, 2, 2, false) { init { - setFilter { stack -> + setInputFilter { stack -> stack.item is ItemDataModel && stack.dataModel.category != null } @@ -278,4 +278,21 @@ class DeepLearnerScreenHandler ( } } + + + // Prevent dropping your Deep Learner while it's up, duping it and all data models inside + class DeepLearnerPlayerInv( + playerInventory: PlayerInventory + ): WPlayerInvPanel(playerInventory) { + + init { + inventory.setOutputFilter { + !it.isOf(ITEM_DEEP_LEARNER) + } + hotbar.setOutputFilter { + !it.isOf(ITEM_DEEP_LEARNER) + } + } + + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index b0ddc3eb..2949de51 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,7 +26,7 @@ fabric_kotlin_version=1.9.5+kotlin.1.8.22 # Other Dependencies ktdatataglib_version=1.6.7+1.20.1 -libguiVersion=8.0.0-beta.1+1.20-rc1 +libguiVersion=8.1.0+1.20.1 palVersion=1.8.0 reiVersion=12.0.625 energyVersion=2.3.0