aboutsummaryrefslogtreecommitdiff
path: root/default-plugin/src
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-03-20 18:03:04 +0800
committershedaniel <daniel@shedaniel.me>2021-03-20 18:03:04 +0800
commit2c29cac8a5e0878696c8e6635f4e41ed4845b41c (patch)
tree52e2599cdd561900bcb8c2f22efb665dd4c41529 /default-plugin/src
parent0292fa5317106c46a39cd39e9664936f807b6270 (diff)
downloadRoughlyEnoughItems-2c29cac8a5e0878696c8e6635f4e41ed4845b41c.tar.gz
RoughlyEnoughItems-2c29cac8a5e0878696c8e6635f4e41ed4845b41c.tar.bz2
RoughlyEnoughItems-2c29cac8a5e0878696c8e6635f4e41ed4845b41c.zip
Remove useless EntryStack settings, properly implement tooltip callbacks
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'default-plugin/src')
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java10
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java7
2 files changed, 8 insertions, 9 deletions
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<EntryStack<?>> 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<EntryStack<?>> 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<DefaultCompostingDisplay> {
@@ -94,7 +97,7 @@ public class DefaultCompostingCategory implements DisplayCategory<DefaultCompost
if (!entryStack.isEmpty()) {
display.getInputMap().object2FloatEntrySet().stream().filter(entry -> 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));
}
});
}