diff --git a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/gui/cable/ItemCableConfigMenu.kt b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/gui/cable/ItemCableConfigMenu.kt index 42305ff..f3fedce 100644 --- a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/gui/cable/ItemCableConfigMenu.kt +++ b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/gui/cable/ItemCableConfigMenu.kt @@ -36,9 +36,9 @@ class ItemCableConfigMenu( updateValues() insertFilterInventory = VirtualInventory(null, 1, arrayOf(insertFilter), intArrayOf(1)) - insertFilterInventory.setPreUpdateHandler(::validateIsItemFilter) + insertFilterInventory.addPreUpdateHandler(::validateIsItemFilter) extractFilterInventory = VirtualInventory(null, 1, arrayOf(extractFilter), intArrayOf(1)) - extractFilterInventory.setPreUpdateHandler(::validateIsItemFilter) + extractFilterInventory.addPreUpdateHandler(::validateIsItemFilter) gui = Gui.normal() .setStructure( diff --git a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/gui/itemfilter/ItemFilterMenu.kt b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/gui/itemfilter/ItemFilterMenu.kt index 00fcf5f..45872c2 100644 --- a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/gui/itemfilter/ItemFilterMenu.kt +++ b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/gui/itemfilter/ItemFilterMenu.kt @@ -31,12 +31,12 @@ class ItemFilterMenu( ) { private val filterInventory = VirtualInventory(null, items.size, items, IntArray(items.size) {1}).apply { - setPreUpdateHandler { event -> + addPreUpdateHandler { event -> event.isCancelled = true // disallow item filters in item filters if (event.newItem?.isItemFilter() == true) - return@setPreUpdateHandler + return@addPreUpdateHandler if (event.isAdd || event.isSwap) { putItem(UpdateReason.SUPPRESSED, event.slot, event.newItem!!.clone().apply { amount = 1} ) diff --git a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/StorageUnit.kt b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/StorageUnit.kt index 24a7e90..bb20c9e 100644 --- a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/StorageUnit.kt +++ b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/StorageUnit.kt @@ -34,8 +34,8 @@ private val MAX_ITEMS by STORAGE_UNIT.config.entry("max_items") class StorageUnit(pos: BlockPos, state: NovaBlockState, data: Compound) : NetworkedTileEntity(pos, state, data) { private val inventory = StorageUnitInventory(storedValue("type", true, ItemStack::empty), storedValue("amount", true) { 0 }) - private val inputInventory = VirtualInventory(null, 1).apply { setPreUpdateHandler(::handleInputInventoryUpdate) } - private val outputInventory = VirtualInventory(null, 1).apply { setPreUpdateHandler(::handlePreOutputInventoryUpdate); setPostUpdateHandler(::handlePostOutputInventoryUpdate) } + private val inputInventory = VirtualInventory(null, 1).apply { addPreUpdateHandler(::handleInputInventoryUpdate) } + private val outputInventory = VirtualInventory(null, 1).apply { addPreUpdateHandler(::handlePreOutputInventoryUpdate); addPostUpdateHandler(::handlePostOutputInventoryUpdate) } init { storedItemHolder(inventory to NetworkConnectionType.BUFFER) diff --git a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/TrashCan.kt b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/TrashCan.kt index 04c4e03..bccf12f 100644 --- a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/TrashCan.kt +++ b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/TrashCan.kt @@ -19,7 +19,7 @@ import java.util.* class TrashCan(pos: BlockPos, state: NovaBlockState, data: Compound) : NetworkedTileEntity(pos, state, data) { - private val inventory = VirtualInventory(1).apply { setPostUpdateHandler { setItem(UpdateReason.SUPPRESSED, 0, null) } } + private val inventory = VirtualInventory(1).apply { addPostUpdateHandler { setItem(UpdateReason.SUPPRESSED, 0, null) } } private val itemHolder = storedItemHolder(inventory to NetworkConnectionType.INSERT) private val fluidHolder = storedFluidHolder(VoidingFluidContainer to NetworkConnectionType.INSERT) diff --git a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/VacuumChest.kt b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/VacuumChest.kt index 9e8dcbe..766494a 100644 --- a/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/VacuumChest.kt +++ b/logistics/src/main/kotlin/xyz/xenondevs/nova/addon/logistics/tileentity/VacuumChest.kt @@ -63,7 +63,7 @@ class VacuumChest(pos: BlockPos, state: NovaBlockState, data: Compound) : Networ if (filter != null) filterInventory.setItem(SELF_UPDATE_REASON, 0, filter!!.toItemStack()) - filterInventory.setPreUpdateHandler(::handleFilterInventoryUpdate) + filterInventory.addPreUpdateHandler(::handleFilterInventoryUpdate) filterInventory.guiPriority = 1 } diff --git a/simple-upgrades/src/main/kotlin/xyz/xenondevs/nova/addon/simpleupgrades/gui/UpgradesGui.kt b/simple-upgrades/src/main/kotlin/xyz/xenondevs/nova/addon/simpleupgrades/gui/UpgradesGui.kt index 91ec510..569949e 100644 --- a/simple-upgrades/src/main/kotlin/xyz/xenondevs/nova/addon/simpleupgrades/gui/UpgradesGui.kt +++ b/simple-upgrades/src/main/kotlin/xyz/xenondevs/nova/addon/simpleupgrades/gui/UpgradesGui.kt @@ -34,7 +34,7 @@ private fun ItemStack.getUpgradeType(): UpgradeType<*>? = internal class UpgradesGui(val upgradeHolder: UpgradeHolder, openPrevious: (Player) -> Unit) { - private val input = VirtualInventory(null, 1).apply { setPreUpdateHandler(::handlePreInvUpdate); setPostUpdateHandler(::handlePostInvUpdate) } + private val input = VirtualInventory(null, 1).apply { addPreUpdateHandler(::handlePreInvUpdate); addPostUpdateHandler(::handlePostInvUpdate) } private val upgradeItems = ArrayList()