If an enchanting table was force opened, default the world to the player's world for checks when dropping items. Fixes SPIGOT-408

This commit is contained in:
Suddenly 2015-01-31 16:43:37 +00:00 committed by Thinkofdeath
parent f25cb6d94b
commit 2c31a4b409

View File

@ -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;