Skip to content

Commit

Permalink
You no longer can drop your Deep Learner while its screen is open (pa…
Browse files Browse the repository at this point in the history
…rt of #88)
  • Loading branch information
Luligabi1 committed Nov 1, 2023
1 parent 94bfc00 commit 96f199f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()
}
Expand All @@ -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
}

Expand All @@ -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)
}
}

}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 96f199f

Please sign in to comment.