diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/ContainerEnchantTable.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java index 528fbc97..5f948e47 100644 --- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java +++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java @@ -152,6 +152,12 @@ public class ContainerEnchantTable extends Container { if (this.costs[i] > 0 && itemstack != null && (entityhuman.expLevel >= this.costs[i] || entityhuman.abilities.canInstantlyBuild)) { if (!this.world.isStatic) { List list = EnchantmentManager.b(this.l, itemstack, this.costs[i]); + // CraftBukkit start - Provide an empty enchantment list + if (list == null) { + list = new java.util.ArrayList<EnchantmentInstance>(); + } + // CraftBukkit end + boolean flag = itemstack.getItem() == Items.BOOK; if (list != null) { @@ -186,7 +192,7 @@ public class ContainerEnchantTable extends Container { EnchantmentInstance enchantment = new EnchantmentInstance(enchantId, entry.getValue()); Items.ENCHANTED_BOOK.a(itemstack, enchantment); } else { - item.addEnchantment(entry.getKey(), entry.getValue()); + item.addUnsafeEnchantment(entry.getKey(), entry.getValue()); } } catch (IllegalArgumentException e) { /* Just swallow invalid enchantments */ |