From 2c31a4b409f7958d86a38eab2ca0556d16351636 Mon Sep 17 00:00:00 2001 From: Suddenly Date: Sat, 31 Jan 2015 16:43:37 +0000 Subject: If an enchanting table was force opened, default the world to the player's world for checks when dropping items. Fixes SPIGOT-408 --- nms-patches/ContainerEnchantTable.patch | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'nms-patches') 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; -- cgit v1.2.3