From e2c264a82dc10b8e29b08225cd5bc24e689fa332 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Tue, 14 Jul 2020 11:19:19 +0800 Subject: Optimised craftable filter and changed some api Signed-off-by: shedaniel --- .../me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java') diff --git a/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java index 5ab1f94cb..2c81519e1 100644 --- a/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java @@ -27,6 +27,8 @@ import com.google.common.collect.Lists; import me.shedaniel.rei.api.EntryStack; import me.shedaniel.rei.api.RecipeDisplay; import me.shedaniel.rei.plugin.DefaultPlugin; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.item.ItemStack; import net.minecraft.recipe.Ingredient; import net.minecraft.text.TranslatableText; @@ -37,6 +39,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +@Environment(EnvType.CLIENT) public class DefaultBrewingDisplay implements RecipeDisplay { private EntryStack input, output; @@ -44,8 +47,9 @@ public class DefaultBrewingDisplay implements RecipeDisplay { public DefaultBrewingDisplay(ItemStack input, Ingredient reactant, ItemStack output) { this.input = EntryStack.create(input).setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableText("category.rei.brewing.input").formatted(Formatting.YELLOW))); - this.reactant = new ArrayList<>(); - for (ItemStack stack : reactant.getMatchingStacksClient()) { + ItemStack[] reactantStacks = reactant.getMatchingStacksClient(); + this.reactant = new ArrayList<>(reactantStacks.length); + for (ItemStack stack : reactantStacks) { EntryStack entryStack = EntryStack.create(stack); entryStack.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, s -> Collections.singletonList(new TranslatableText("category.rei.brewing.reactant").formatted(Formatting.YELLOW))); this.reactant.add(entryStack); -- cgit