diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt index 55b269ea3..cc597834f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt @@ -128,13 +128,19 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) } }.also(::addDroppableContainer) - val itemConfig = ConfigurableItemHandler(input = container.handler(object : HandlerFilter { + val itemConfig = ConfigurableItemHandler(inputOutput = container.handler(object : HandlerFilter { override fun canInsert(slot: Int, stack: ItemStack): Boolean { return stack.getCapability(MatteryCapability.MATTER).isPresent } override fun canExtract(slot: Int, amount: Int, stack: ItemStack): Boolean { - return false + stack.getCapability(MatteryCapability.MATTER).ifPresentK { + if (it.storedMatter.isPositive) { + return false + } + } + + return true } })) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/BatteryBankBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/BatteryBankBlockEntity.kt index ad1a054a4..dbb5c6cc2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/BatteryBankBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/BatteryBankBlockEntity.kt @@ -57,7 +57,7 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte private var lastTickDischarged = false init { - savetable(::container, INVENTORY_KEY) + savetables.stateful(::container, INVENTORY_KEY) savetables.int(::currentChangeSlot) savetables.int(::currentDischangeSlot) savetables.bool(::lastTickCharged)