EnergyContainerInputSlot
This commit is contained in:
parent
7d4d718b1e
commit
3ddb4d3d83
@ -7,6 +7,7 @@ import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.inventory.Slot
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
||||
import ru.dbotthepony.mc.otm.capability.FlowDirection
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import ru.dbotthepony.mc.otm.capability.energy
|
||||
@ -129,6 +130,12 @@ open class ChargeSlot(container: Container, index: Int, x: Int = 0, y: Int = 0)
|
||||
}
|
||||
}
|
||||
|
||||
open class EnergyContainerInputSlot(container: Container, index: Int, x: Int = 0, y: Int = 0, val direction: FlowDirection = FlowDirection.BI_DIRECTIONAL) : MatterySlot(container, index, x, y) {
|
||||
override fun mayPlace(itemStack: ItemStack): Boolean {
|
||||
return super.mayPlace(itemStack) && itemStack.getCapability(ForgeCapabilities.ENERGY).map { direction.test(FlowDirection.of(it.canReceive(), it.canExtract())) }.orElse(false)
|
||||
}
|
||||
}
|
||||
|
||||
open class MatterContainerInputSlot(
|
||||
container: Container,
|
||||
index: Int,
|
||||
|
Loading…
Reference in New Issue
Block a user