Make battery slot be filterable
This commit is contained in:
parent
d88da8f244
commit
51be2c89f4
@ -12,7 +12,7 @@ import ru.dbotthepony.mc.otm.container.slotted.SlottedContainer
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
|
||||
abstract class MatteryPoweredBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: BlockPos, p_155230_: BlockState) : MatteryDeviceBlockEntity(p_155228_, p_155229_, p_155230_) {
|
||||
val batteryContainer = SlottedContainer.simple(1, AutomationFilters.DISCHARGABLE.simpleProvider, ::markDirtyFast).also(::addDroppableContainer)
|
||||
val batteryContainer = SlottedContainer.simple(1, AutomationFilters.DISCHARGABLE.filteredProvider, ::markDirtyFast).also(::addDroppableContainer)
|
||||
open val energy: IMatteryEnergyStorage?
|
||||
get() = null
|
||||
|
||||
|
@ -16,7 +16,7 @@ abstract class MatteryPoweredMenu protected constructor(
|
||||
tile: MatteryPoweredBlockEntity? = null
|
||||
) : MatteryMenu(menuType, containerID, inventory, tile) {
|
||||
val energyWidget = LevelGaugeWidget(this, tile?.energy)
|
||||
val batterySlot = BatteryMenuSlot(tile?.batteryContainer ?: SlottedContainer.simple(1), 0)
|
||||
val batterySlot = BatteryMenuSlot(tile?.batteryContainer ?: SlottedContainer.filtered(1), 0)
|
||||
val redstoneConfig = EnumInputWithFeedback<RedstoneSetting>(this)
|
||||
|
||||
init {
|
||||
|
@ -140,7 +140,7 @@ open class OutputMenuSlot(container: Container, index: Int, x: Int = 0, y: Int =
|
||||
}
|
||||
}
|
||||
|
||||
open class BatteryMenuSlot(container: Container, index: Int, x: Int = 0, y: Int = 0) : MatteryMenuSlot(container, index, x, y) {
|
||||
open class BatteryMenuSlot(container: Container, index: Int, x: Int = 0, y: Int = 0) : UserFilteredMenuSlot(container, index, x, y) {
|
||||
override fun mayPlace(itemStack: ItemStack): Boolean {
|
||||
return super.mayPlace(itemStack) && (itemStack.energy?.canExtract() ?: false)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user