From da47c76268e89abc8bb95f02964ca9ae3550d5a9 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Tue, 16 Apr 2024 18:39:40 +0900 Subject: Fix compositing category not showing chance in tooltips --- .../rei/plugin/client/categories/DefaultCompostingCategory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'default-plugin/src') diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java index 6f5c942c2..c8a94ecc9 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java @@ -34,6 +34,7 @@ import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.registry.display.DisplayCategory; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.entry.EntryIngredient; +import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.plugin.common.BuiltinPlugin; import me.shedaniel.rei.plugin.common.displays.DefaultCompostingDisplay; @@ -94,8 +95,8 @@ public class DefaultCompostingCategory implements DisplayCategory i ? stacks.get(i) : EntryIngredient.empty(); - if (!entryIngredient.isEmpty()) { - ItemStack firstStack = (ItemStack) entryIngredient.get(0).getValue(); + if (!entryIngredient.isEmpty() && entryIngredient.get(0).getType() == VanillaEntryTypes.ITEM) { + ItemStack firstStack = entryIngredient.get(0).castValue(); float chance = ComposterBlock.COMPOSTABLES.getFloat(firstStack.getItem()); if (chance > 0.0f) { entryIngredient = entryIngredient.map(stack -> stack.copy().tooltip(Component.translatable("text.rei.composting.chance", Mth.clamp(Mth.fastFloor(chance * 100), 0, 100)).withStyle(ChatFormatting.YELLOW))); -- cgit