Skip to content

Commit

Permalink
Minor fix for item permutation logic (#21)
Browse files Browse the repository at this point in the history
Manual merge of:
 * D-Cysteine@dc6239b
  • Loading branch information
D-Cysteine authored Feb 8, 2023
1 parent 03a2b13 commit 4f80db5
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ public static List<Component> getPermutations(Component component) {

ItemComponent itemComponent = (ItemComponent) component;
if (itemComponent.hasWildcardDamage()) {
return ItemList.itemMap.get(itemComponent.item()).stream().map(ItemComponent::create)
.collect(Collectors.toList());
List<ItemStack> permutations = ItemList.itemMap.get(itemComponent.item());
if (!permutations.isEmpty()) {
return permutations.stream().map(ItemComponent::create).collect(Collectors.toList());
} else {
return Lists.newArrayList(ItemComponent.create(itemComponent.item(), 0, itemComponent.nbt()));
}
} else {
return Lists.newArrayList(component);
}
Expand Down

0 comments on commit 4f80db5

Please sign in to comment.