From 7053769e26c0c6b78c631ecfb86d899000630df3 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 30 Jul 2023 10:39:32 +0700 Subject: [PATCH] Inline container.set/get --- src/main/kotlin/ru/dbotthepony/mc/otm/container/Ext.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/container/Ext.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/container/Ext.kt index 3900cd640..d74d6220b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/container/Ext.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/container/Ext.kt @@ -17,10 +17,14 @@ import ru.dbotthepony.mc.otm.core.collect.nonEmpty import ru.dbotthepony.mc.otm.core.isNotEmpty import kotlin.math.roundToInt -operator fun Container.set(index: Int, value: ItemStack) = setItem(index, value) -operator fun Container.get(index: Int): ItemStack = getItem(index) +@Suppress("nothing_to_inline") +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 { if (this is MatteryContainer) {