Make IAutomatedContainer implement IItemHandlerModifiable
This commit is contained in:
parent
861b94a30a
commit
efbc93e16a
@ -1,14 +1,16 @@
|
|||||||
package ru.dbotthepony.mc.otm.container
|
package ru.dbotthepony.mc.otm.container
|
||||||
|
|
||||||
import net.minecraft.world.Container
|
import net.minecraft.world.Container
|
||||||
|
import net.minecraft.world.entity.player.Player
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.neoforged.neoforge.items.IItemHandler
|
import net.neoforged.neoforge.items.IItemHandler
|
||||||
|
import net.neoforged.neoforge.items.IItemHandlerModifiable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reinforced [ISlottedContainer] which slots are [IAutomatedContainerSlot]s, which
|
* Reinforced [ISlottedContainer] which slots are [IAutomatedContainerSlot]s, which
|
||||||
* subsequently allow this container to implement [IItemHandler]
|
* subsequently allow this container to implement [IItemHandler]
|
||||||
*/
|
*/
|
||||||
interface IAutomatedContainer : ISlottedContainer, IItemHandler {
|
interface IAutomatedContainer : ISlottedContainer, IItemHandlerModifiable {
|
||||||
override fun containerSlot(slot: Int): IAutomatedContainerSlot
|
override fun containerSlot(slot: Int): IAutomatedContainerSlot
|
||||||
|
|
||||||
override fun canPlaceItem(slot: Int, itemStack: ItemStack): Boolean {
|
override fun canPlaceItem(slot: Int, itemStack: ItemStack): Boolean {
|
||||||
@ -34,6 +36,10 @@ interface IAutomatedContainer : ISlottedContainer, IItemHandler {
|
|||||||
return containerSlot(slot).maxStackSize
|
return containerSlot(slot).maxStackSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setStackInSlot(slot: Int, stack: ItemStack) {
|
||||||
|
setItem(slot, stack)
|
||||||
|
}
|
||||||
|
|
||||||
override fun isItemValid(slot: Int, stack: ItemStack): Boolean {
|
override fun isItemValid(slot: Int, stack: ItemStack): Boolean {
|
||||||
return canPlaceItem(slot, stack)
|
return canPlaceItem(slot, stack)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user