diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/container/IEnhancedCraftingContainer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/container/IEnhancedCraftingContainer.kt new file mode 100644 index 000000000..61dc89142 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/container/IEnhancedCraftingContainer.kt @@ -0,0 +1,33 @@ +package ru.dbotthepony.mc.otm.container + +import net.minecraft.world.entity.player.StackedContents +import net.minecraft.world.inventory.CraftingContainer +import net.minecraft.world.item.ItemStack + +interface IEnhancedCraftingContainer : IEnhancedContainer, CraftingContainer { + override fun getItems(): MutableList { + return toList() + } + + override fun fillStackedContents(contents: StackedContents) { + forEach { contents.accountSimpleStack(it) } + } + + class Wrapper(val parent: C, private val width: Int, private val height: Int) : IEnhancedCraftingContainer, IEnhancedContainer by parent { + init { + require(width * height == parent.containerSize) { "Crafting container dimensions ($width x $height) do not match container size provided (${parent.containerSize})" } + } + + override fun getWidth(): Int { + return width + } + + override fun getHeight(): Int { + return height + } + + override fun fillStackedContents(contents: StackedContents) { + super.fillStackedContents(contents) + } + } +}