mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-08 08:02:13 -07:00
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user