Skip to content

Commit

Permalink
Fixed enchant support in crafting recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jul 26, 2021
1 parent 6611a0f commit c36c0c2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion eco-api/src/main/java/com/willfp/eco/core/items/Items.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public TestableItem lookup(@NotNull final String key) {
String[] split = args[0].toLowerCase().split(":");

if (split.length == 1) {
Material material = Material.getMaterial(key.toUpperCase());
Material material = Material.getMaterial(args[0].toUpperCase());
if (material == null || material == Material.AIR) {
return new EmptyTestableItem();
}
Expand Down Expand Up @@ -113,6 +113,10 @@ public TestableItem lookup(@NotNull final String key) {
requiredEnchantments.put(enchantment, level);
}

if (requiredEnchantments.isEmpty()) {
return item;
}

ItemBuilder builder = new ItemStackBuilder(item.getItem());
requiredEnchantments.forEach(builder::addEnchantment);
ItemStack example = builder.build();
Expand Down

0 comments on commit c36c0c2

Please sign in to comment.