From 2c29cac8a5e0878696c8e6635f4e41ed4845b41c Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sat, 20 Mar 2021 18:03:04 +0800 Subject: Remove useless EntryStack settings, properly implement tooltip callbacks Signed-off-by: shedaniel --- .../me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java | 10 +++------- .../rei/plugin/composting/DefaultCompostingCategory.java | 7 +++++-- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'default-plugin/src') diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java index e3b4843b6..be45551b2 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java @@ -52,20 +52,16 @@ public class DefaultBrewingDisplay implements Display { ItemStack[] inputItems = input.getItems(); List> i = new ArrayList<>(inputItems.length); for (ItemStack inputItem : inputItems) { - EntryStack entryStack = EntryStacks.of(inputItem); - entryStack.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, s -> Collections.singletonList(new TranslatableComponent("category.rei.brewing.input").withStyle(ChatFormatting.YELLOW))); - i.add(entryStack); + i.add(EntryStacks.of(inputItem).tooltip(new TranslatableComponent("category.rei.brewing.input").withStyle(ChatFormatting.YELLOW))); } this.input = EntryIngredient.of(i); ItemStack[] reactantStacks = reactant.getItems(); List> r = new ArrayList<>(reactantStacks.length); for (ItemStack stack : reactantStacks) { - EntryStack entryStack = EntryStacks.of(stack); - entryStack.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, s -> Collections.singletonList(new TranslatableComponent("category.rei.brewing.reactant").withStyle(ChatFormatting.YELLOW))); - r.add(entryStack); + r.add(EntryStacks.of(stack).tooltip(new TranslatableComponent("category.rei.brewing.reactant").withStyle(ChatFormatting.YELLOW))); } this.reactant = EntryIngredient.of(r); - this.output = EntryStacks.of(output).setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableComponent("category.rei.brewing.result").withStyle(ChatFormatting.YELLOW))); + this.output = EntryStacks.of(output).tooltip(new TranslatableComponent("category.rei.brewing.result").withStyle(ChatFormatting.YELLOW)); } @Override diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java index 41aebe62d..7638f363b 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java @@ -46,7 +46,10 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.level.block.Blocks; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; @Environment(EnvType.CLIENT) public class DefaultCompostingCategory implements DisplayCategory { @@ -94,7 +97,7 @@ public class DefaultCompostingCategory implements DisplayCategory entry.getKey() != null && Objects.equals(entry.getKey().asItem(), entryStack.get(0).getValue())).findAny().map(Map.Entry::getValue).ifPresent(chance -> { for (EntryStack stack : entryStack) { - stack.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, s -> Collections.singletonList(new TranslatableComponent("text.rei.composting.chance", Mth.fastFloor(chance * 100)).withStyle(ChatFormatting.YELLOW))); + stack.tooltip(new TranslatableComponent("text.rei.composting.chance", Mth.fastFloor(chance * 100)).withStyle(ChatFormatting.YELLOW)); } }); } -- cgit