From 339cacc5459fbbe41e97da5e522e2eacab4dbcd9 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 30 Mar 2025 18:47:18 +0700 Subject: [PATCH] Remove toImmutableList --- .../otm/compat/jei/ExopackInventoryTransferHandler.kt | 10 +++++----- src/main/kotlin/ru/dbotthepony/mc/otm/util/Utils.kt | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/ExopackInventoryTransferHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/ExopackInventoryTransferHandler.kt index 9fe9144c9..0924f220b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/ExopackInventoryTransferHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/ExopackInventoryTransferHandler.kt @@ -1,5 +1,6 @@ package ru.dbotthepony.mc.otm.compat.jei +import com.google.common.collect.ImmutableList import it.unimi.dsi.fastutil.ints.Int2IntArrayMap import it.unimi.dsi.fastutil.ints.IntArraySet import mezz.jei.api.constants.RecipeTypes @@ -16,7 +17,6 @@ import net.minecraft.world.inventory.Slot import net.minecraft.world.item.crafting.CraftingRecipe import net.minecraft.world.item.crafting.RecipeHolder import ru.dbotthepony.mc.otm.util.TranslatableComponent -import ru.dbotthepony.mc.otm.util.toImmutableList import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu import java.util.* import kotlin.collections.ArrayList @@ -116,9 +116,9 @@ class ExopackInventoryTransferHandler(private val helper: IRecipeTransferHandler } } - val outputs = recipeSlots.getSlotViews(RecipeIngredientRole.OUTPUT).toImmutableList() - val catalysts = recipeSlots.getSlotViews(RecipeIngredientRole.CATALYST).toImmutableList() - val render = recipeSlots.getSlotViews(RecipeIngredientRole.RENDER_ONLY).toImmutableList() + val outputs = ImmutableList.copyOf(recipeSlots.getSlotViews(RecipeIngredientRole.OUTPUT)) + val catalysts = ImmutableList.copyOf(recipeSlots.getSlotViews(RecipeIngredientRole.CATALYST)) + val render = ImmutableList.copyOf(recipeSlots.getSlotViews(RecipeIngredientRole.RENDER_ONLY)) val combine = ArrayList(filteredInputs.size + outputs.size + render.size) @@ -126,7 +126,7 @@ class ExopackInventoryTransferHandler(private val helper: IRecipeTransferHandler combine.addAll(outputs) combine.addAll(render) - val combined = combine.toImmutableList() + val combined = ImmutableList.copyOf(combine) val newView = object : IRecipeSlotsView { override fun getSlotViews(): List { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/util/Utils.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/util/Utils.kt index f96f61283..a320c00d9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/util/Utils.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/util/Utils.kt @@ -131,10 +131,6 @@ operator fun , T : Comparable> S.set(property: Property return setValue(property, value) as S } -fun List.toImmutableList(): List { - return ImmutableList.copyOf(this) -} - operator fun (() -> R).getValue(thisRef: Any, property: KProperty<*>): R { return invoke() }