aboutsummaryrefslogtreecommitdiff
path: root/default-plugin/src/main
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2024-04-16 18:39:40 +0900
committershedaniel <daniel@shedaniel.me>2024-04-17 02:55:39 +0900
commitda47c76268e89abc8bb95f02964ca9ae3550d5a9 (patch)
tree3018d8f31cd61942c9a64f229e4beffadedbe669 /default-plugin/src/main
parent3d3796d684e70c38ec46c28d18051ee6c94c278f (diff)
downloadRoughlyEnoughItems-da47c76268e89abc8bb95f02964ca9ae3550d5a9.tar.gz
RoughlyEnoughItems-da47c76268e89abc8bb95f02964ca9ae3550d5a9.tar.bz2
RoughlyEnoughItems-da47c76268e89abc8bb95f02964ca9ae3550d5a9.zip
Fix compositing category not showing chance in tooltips
Diffstat (limited to 'default-plugin/src/main')
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java5
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)));