From e47127ccf6eeb7d27e4a7c3f275696b0f9695194 Mon Sep 17 00:00:00 2001 From: DrParadox7 <47131096+DrParadox7@users.noreply.github.com> Date: Sat, 29 Jun 2024 21:59:40 +0200 Subject: [PATCH] Fix metadata handling (#39) Entries without a specified metadata default to no metadata rather than Wildcard. Fixes https://github.com/GTNewHorizons/SpiceOfLife/issues/38 --- .../spiceoflife/foodtracker/foodgroups/FoodGroup.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/squeek/spiceoflife/foodtracker/foodgroups/FoodGroup.java b/src/main/java/squeek/spiceoflife/foodtracker/foodgroups/FoodGroup.java index c69f8a1..5b74bdf 100644 --- a/src/main/java/squeek/spiceoflife/foodtracker/foodgroups/FoodGroup.java +++ b/src/main/java/squeek/spiceoflife/foodtracker/foodgroups/FoodGroup.java @@ -100,8 +100,11 @@ public ItemStack getItemFromString(String itemString) { if (itemStringParts.length > 1) { Item item = GameRegistry.findItem(itemStringParts[0], itemStringParts[1]); if (item != null) { - boolean exactMetadata = itemStringParts.length > 2 && !itemStringParts[2].equals("*"); - int metadata = exactMetadata ? Integer.parseInt(itemStringParts[2]) : OreDictionary.WILDCARD_VALUE; + int metadata = 0; + if (itemStringParts.length > 2) { + metadata = itemStringParts[2].equals("*") ? OreDictionary.WILDCARD_VALUE + : Integer.parseInt(itemStringParts[2]); + } return new ItemStack(item, 1, metadata); } }