diff options
| author | shedaniel <daniel@shedaniel.me> | 2024-04-16 18:39:40 +0900 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2024-04-17 02:55:39 +0900 |
| commit | da47c76268e89abc8bb95f02964ca9ae3550d5a9 (patch) | |
| tree | 3018d8f31cd61942c9a64f229e4beffadedbe669 | |
| parent | 3d3796d684e70c38ec46c28d18051ee6c94c278f (diff) | |
| download | RoughlyEnoughItems-da47c76268e89abc8bb95f02964ca9ae3550d5a9.tar.gz RoughlyEnoughItems-da47c76268e89abc8bb95f02964ca9ae3550d5a9.tar.bz2 RoughlyEnoughItems-da47c76268e89abc8bb95f02964ca9ae3550d5a9.zip | |
Fix compositing category not showing chance in tooltips
| -rw-r--r-- | default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java | 5 |
1 files changed, 3 insertions, 2 deletions
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<DefaultCompost for (int y = 0; y < 5; y++) for (int x = 0; x < 7; x++) { EntryIngredient entryIngredient = stacks.size() > 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))); |
