Update Energy Interface to use SlottedContainer
This commit is contained in:
parent
1455e12da3
commit
55c3c16172
@ -20,6 +20,8 @@ import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.moveEnergy
|
||||
import ru.dbotthepony.mc.otm.container.HandlerFilter
|
||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||
import ru.dbotthepony.mc.otm.container.slotted.AutomationFilters
|
||||
import ru.dbotthepony.mc.otm.container.slotted.SlottedContainer
|
||||
import ru.dbotthepony.mc.otm.core.math.RelativeSide
|
||||
import ru.dbotthepony.mc.otm.core.multiblock.BlockEntityTag
|
||||
import ru.dbotthepony.mc.otm.core.multiblock.IMultiblockAccess
|
||||
@ -56,13 +58,11 @@ class EnergyInterfaceBlockEntity(
|
||||
targets.invalidate()
|
||||
}
|
||||
|
||||
val container = object : MatteryContainer(::markDirtyFast, CAPACITY) {
|
||||
override fun getMaxStackSize(slot: Int, itemStack: ItemStack): Int {
|
||||
return 1
|
||||
}
|
||||
}.also(::addDroppableContainer)
|
||||
val container = SlottedContainer.simple(
|
||||
CAPACITY,
|
||||
if (isInput) AutomationFilters.DISCHARGABLE.limitedFilteredProvider else AutomationFilters.CHARGEABLE.limitedFilteredProvider,
|
||||
::markDirtyFast).also(::addDroppableContainer)
|
||||
|
||||
val itemHandler = container.handler(if (isInput) HandlerFilter.Dischargeable else HandlerFilter.Chargeable)
|
||||
private val neighbours = ArrayList<CapabilityCache<IEnergyStorage>>()
|
||||
|
||||
override fun setRemoved() {
|
||||
@ -75,7 +75,7 @@ class EnergyInterfaceBlockEntity(
|
||||
|
||||
// it would cause a lot of frustration if hatches accept stuff only though one face
|
||||
exposeEnergyGlobally(energy)
|
||||
exposeGlobally(Capabilities.ItemHandler.BLOCK, itemHandler)
|
||||
exposeGlobally(Capabilities.ItemHandler.BLOCK, container)
|
||||
|
||||
if (!isInput) {
|
||||
for (side in RelativeSide.entries) {
|
||||
|
Loading…
Reference in New Issue
Block a user