aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java
diff options
context:
space:
mode:
authorDanielshe <shekwancheung0528@gmail.com>2019-11-03 14:44:52 +0800
committerDanielshe <shekwancheung0528@gmail.com>2019-11-03 14:44:59 +0800
commit9f5a9eae9a7863412cc5eb433bf15e5ee71da616 (patch)
tree0e6b0b94af061c5e9023b1ff19f339a6c30149be /src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java
parent3e3e25855b9f6df507a7d4c8a07c64b9a502fae2 (diff)
downloadRoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.gz
RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.bz2
RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.zip
3.2.1
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java')
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java45
1 files changed, 29 insertions, 16 deletions
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<EntryStack> 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<List<ItemStack>> getInput() {
- return Lists.newArrayList(Collections.singletonList(input), Arrays.asList(reactant.getMatchingStacksClient()));
+ public List<List<EntryStack>> getInputEntries() {
+ return Lists.newArrayList(Collections.singletonList(input), reactant);
}
@Override
- public List<ItemStack> getOutput() {
+ public List<EntryStack> getOutputEntries() {
return Collections.singletonList(output);
}
@@ -44,17 +57,17 @@ public class DefaultBrewingDisplay implements RecipeDisplay {
return DefaultPlugin.BREWING;
}
- public List<ItemStack> getOutput(int slot) {
- List<ItemStack> stack = new ArrayList<>();
+ public List<EntryStack> getOutput(int slot) {
+ List<EntryStack> 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<List<ItemStack>> getRequiredItems() {
- return Collections.singletonList(Collections.singletonList(ItemStack.EMPTY));
+ public List<List<EntryStack>> getRequiredEntries() {
+ return getInputEntries();
}
}