Inline container.set/get

This commit is contained in:
DBotThePony 2023-07-30 10:39:32 +07:00
parent c4e7b8ff15
commit 7053769e26
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -17,10 +17,14 @@ import ru.dbotthepony.mc.otm.core.collect.nonEmpty
import ru.dbotthepony.mc.otm.core.isNotEmpty import ru.dbotthepony.mc.otm.core.isNotEmpty
import kotlin.math.roundToInt import kotlin.math.roundToInt
operator fun Container.set(index: Int, value: ItemStack) = setItem(index, value) @Suppress("nothing_to_inline")
operator fun Container.get(index: Int): ItemStack = getItem(index) inline operator fun Container.set(index: Int, value: ItemStack) = setItem(index, value)
operator fun IFluidHandler.get(index: Int) = getFluidInTank(index) @Suppress("nothing_to_inline")
inline operator fun Container.get(index: Int): ItemStack = getItem(index)
@Suppress("nothing_to_inline")
inline operator fun IFluidHandler.get(index: Int) = getFluidInTank(index)
fun Container.addItem(stack: ItemStack, range: IntRange, simulate: Boolean = false): ItemStack { fun Container.addItem(stack: ItemStack, range: IntRange, simulate: Boolean = false): ItemStack {
if (this is MatteryContainer) { if (this is MatteryContainer) {