2014-03-26 21:34:47 +01:00
|
|
|
From 4b55b1c0354600be33f73d04a58f0bbf83df7047 Mon Sep 17 00:00:00 2001
|
2014-03-15 07:28:55 +01:00
|
|
|
From: andrepl <andre@norcode.com>
|
|
|
|
Date: Sat, 15 Mar 2014 12:50:00 -0400
|
|
|
|
Subject: [PATCH] Allow enchanting tables to enchant any item
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
|
2014-03-26 21:34:47 +01:00
|
|
|
index 528fbc9..372ccde 100644
|
2014-03-15 07:28:55 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
|
|
|
|
@@ -152,6 +152,11 @@ 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]);
|
|
|
|
+ // Spigot - Provide an empty enchantment list
|
|
|
|
+ if (list == null) {
|
|
|
|
+ list = new java.util.ArrayList<EnchantmentInstance>();
|
|
|
|
+ }
|
|
|
|
+ // Spigot End
|
|
|
|
boolean flag = itemstack.getItem() == Items.BOOK;
|
|
|
|
|
|
|
|
if (list != null) {
|
|
|
|
@@ -186,7 +191,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()); // Spigot addEnchantment -> addUnsafeEnchantment
|
|
|
|
}
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
/* Just swallow invalid enchantments */
|
|
|
|
--
|
2014-03-26 21:34:47 +01:00
|
|
|
1.8.5.2.msysgit.0
|
2014-03-15 07:28:55 +01:00
|
|
|
|