diff options
author | Suddenly <suddenly@suddenly.coffee> | 2015-01-31 16:43:37 +0000 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2015-02-07 10:56:00 +0000 |
commit | 2c31a4b409f7958d86a38eab2ca0556d16351636 (patch) | |
tree | 23880c1513bff5ba2e058649d0a876a723cd8aa9 | |
parent | f25cb6d94b55b9dc667d4b4a6b7b140dc24691f8 (diff) | |
download | craftbukkit-2c31a4b409f7958d86a38eab2ca0556d16351636.tar craftbukkit-2c31a4b409f7958d86a38eab2ca0556d16351636.tar.gz craftbukkit-2c31a4b409f7958d86a38eab2ca0556d16351636.tar.lz craftbukkit-2c31a4b409f7958d86a38eab2ca0556d16351636.tar.xz craftbukkit-2c31a4b409f7958d86a38eab2ca0556d16351636.zip |
If an enchanting table was force opened, default the world to the player's world for checks when dropping items. Fixes SPIGOT-408
-rw-r--r-- | nms-patches/ContainerEnchantTable.patch | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/nms-patches/ContainerEnchantTable.patch b/nms-patches/ContainerEnchantTable.patch index 89df8424..b9a813f1 100644 --- a/nms-patches/ContainerEnchantTable.patch +++ b/nms-patches/ContainerEnchantTable.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerEnchantTable.java 2014-11-28 22:39:23.881313691 +0000 -+++ src/main/java/net/minecraft/server/ContainerEnchantTable.java 2014-11-28 22:38:24.125315018 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerEnchantTable.java Sat Jan 31 16:10:54 2015 ++++ src/main/java/net/minecraft/server/ContainerEnchantTable.java Sat Jan 31 16:10:54 2015 @@ -3,15 +3,31 @@ import java.util.List; import java.util.Random; @@ -141,7 +141,19 @@ if (!entityhuman.abilities.canInstantlyBuild) { itemstack1.count -= j; if (itemstack1.count <= 0) { -@@ -212,6 +278,7 @@ +@@ -199,6 +265,11 @@ + + public void b(EntityHuman entityhuman) { + super.b(entityhuman); ++ // CraftBukkit Start - If an enchantable was opened from a null location, set the world to the player's world, preventing a crash ++ if(this.world == null) { ++ this.world = entityhuman.getWorld(); ++ } ++ // CraftBukkit end + if (!this.world.isStatic) { + for (int i = 0; i < this.enchantSlots.getSize(); ++i) { + ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(i); +@@ -212,6 +283,7 @@ } public boolean a(EntityHuman entityhuman) { @@ -149,7 +161,7 @@ return this.world.getType(this.position).getBlock() != Blocks.ENCHANTING_TABLE ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D; } -@@ -263,5 +330,18 @@ +@@ -263,5 +335,18 @@ } return itemstack; |