summaryrefslogtreecommitdiffstats
path: root/nms-patches/ContainerEnchantTable.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/ContainerEnchantTable.patch')
-rw-r--r--nms-patches/ContainerEnchantTable.patch12
1 files changed, 6 insertions, 6 deletions
diff --git a/nms-patches/ContainerEnchantTable.patch b/nms-patches/ContainerEnchantTable.patch
index 37fd4ffa..e7e871e9 100644
--- a/nms-patches/ContainerEnchantTable.patch
+++ b/nms-patches/ContainerEnchantTable.patch
@@ -34,8 +34,8 @@
+ return new org.bukkit.Location(world.getWorld(), position.getX(), position.getY(), position.getZ());
+ }
};
- private World world;
- private BlockPosition position;
+ public World world;
+ private final BlockPosition position;
@@ -23,6 +41,10 @@
public int[] costs = new int[3];
public int[] h = new int[] { -1, -1, -1};
@@ -150,19 +150,19 @@
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack1.count -= j;
if (itemstack1.count <= 0) {
-@@ -227,6 +297,11 @@
+@@ -228,6 +298,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) {
++ if (this.world == null) {
+ this.world = entityhuman.getWorld();
+ }
+ // CraftBukkit end
if (!this.world.isClientSide) {
for (int i = 0; i < this.enchantSlots.getSize(); ++i) {
ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(i);
-@@ -240,6 +315,7 @@
+@@ -241,6 +316,7 @@
}
public boolean a(EntityHuman entityhuman) {
@@ -170,7 +170,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;
}
-@@ -293,4 +369,17 @@
+@@ -294,4 +370,17 @@
return itemstack;
}