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