From 9f5a9eae9a7863412cc5eb433bf15e5ee71da616 Mon Sep 17 00:00:00 2001 From: Danielshe Date: Sun, 3 Nov 2019 14:44:52 +0800 Subject: 3.2.1 --- .../rei/plugin/brewing/DefaultBrewingDisplay.java | 45 ++++++++++++++-------- 1 file changed, 29 insertions(+), 16 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 5a091e42b..3b8023779 100644 --- a/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java @@ -6,36 +6,49 @@ package me.shedaniel.rei.plugin.brewing; 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.minecraft.block.Blocks; +import net.minecraft.client.resource.language.I18n; import net.minecraft.item.ItemStack; +import net.minecraft.item.PotionItem; import net.minecraft.recipe.Ingredient; +import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; public class DefaultBrewingDisplay implements RecipeDisplay { - private ItemStack input, output; - private Ingredient reactant; + private EntryStack input, output; + private List reactant; public DefaultBrewingDisplay(ItemStack input, Ingredient reactant, ItemStack output) { - this.input = input; - this.reactant = reactant; - this.output = output; + this.input = EntryStack.create(input).setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(Formatting.YELLOW.toString() + I18n.translate("category.rei.brewing.input"))); + if (this.input.getItem() instanceof PotionItem) + this.input = this.input.setting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE); + this.reactant = new ArrayList<>(); + for (ItemStack stack : reactant.getStackArray()) { + EntryStack entryStack = EntryStack.create(stack); + if (stack.getItem() instanceof PotionItem) + entryStack.setting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE); + entryStack.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, s -> Collections.singletonList(Formatting.YELLOW.toString() + I18n.translate("category.rei.brewing.reactant"))); + this.reactant.add(entryStack); + } + this.output = EntryStack.create(output).setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(Formatting.YELLOW.toString() + I18n.translate("category.rei.brewing.result"))); + if (this.output.getItem() instanceof PotionItem) + this.output = this.output.setting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE); } @Override - public List> getInput() { - return Lists.newArrayList(Collections.singletonList(input), Arrays.asList(reactant.getMatchingStacksClient())); + public List> getInputEntries() { + return Lists.newArrayList(Collections.singletonList(input), reactant); } @Override - public List getOutput() { + public List getOutputEntries() { return Collections.singletonList(output); } @@ -44,17 +57,17 @@ public class DefaultBrewingDisplay implements RecipeDisplay { return DefaultPlugin.BREWING; } - public List getOutput(int slot) { - List stack = new ArrayList<>(); + public List getOutput(int slot) { + List stack = new ArrayList<>(); for (int i = 0; i < slot * 2; i++) - stack.add(new ItemStack(Blocks.AIR)); + stack.add(EntryStack.empty()); for (int i = 0; i < 6 - slot * 2; i++) - stack.addAll(getOutput()); + stack.addAll(getOutputEntries()); return stack; } @Override - public List> getRequiredItems() { - return Collections.singletonList(Collections.singletonList(ItemStack.EMPTY)); + public List> getRequiredEntries() { + return getInputEntries(); } } -- cgit