Skip to content

Commit

Permalink
Fix metadata handling (#39)
Browse files Browse the repository at this point in the history
Entries without a specified metadata default to no metadata rather than Wildcard.

Fixes #38
  • Loading branch information
DrParadox7 authored Jun 29, 2024
1 parent 052cc59 commit e47127c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit e47127c

Please sign in to comment.