mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 15:00:30 +01:00
SPIGOT-6111: NPE in CraftHumanEntity#openWorkbench & CraftHumanEntity#openEnchanting
This commit is contained in:
parent
ee7116b4cc
commit
bfea455968
1 changed files with 6 additions and 6 deletions
|
@ -326,15 +326,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InventoryView openWorkbench(Location location, boolean force) {
|
public InventoryView openWorkbench(Location location, boolean force) {
|
||||||
|
if (location == null) {
|
||||||
|
location = getLocation();
|
||||||
|
}
|
||||||
if (!force) {
|
if (!force) {
|
||||||
Block block = location.getBlock();
|
Block block = location.getBlock();
|
||||||
if (block.getType() != Material.CRAFTING_TABLE) {
|
if (block.getType() != Material.CRAFTING_TABLE) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (location == null) {
|
|
||||||
location = getLocation();
|
|
||||||
}
|
|
||||||
getHandle().openContainer(((BlockWorkbench) Blocks.CRAFTING_TABLE).getInventory(null, getHandle().world, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())));
|
getHandle().openContainer(((BlockWorkbench) Blocks.CRAFTING_TABLE).getInventory(null, getHandle().world, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())));
|
||||||
if (force) {
|
if (force) {
|
||||||
getHandle().activeContainer.checkReachable = false;
|
getHandle().activeContainer.checkReachable = false;
|
||||||
|
@ -344,15 +344,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InventoryView openEnchanting(Location location, boolean force) {
|
public InventoryView openEnchanting(Location location, boolean force) {
|
||||||
|
if (location == null) {
|
||||||
|
location = getLocation();
|
||||||
|
}
|
||||||
if (!force) {
|
if (!force) {
|
||||||
Block block = location.getBlock();
|
Block block = location.getBlock();
|
||||||
if (block.getType() != Material.ENCHANTING_TABLE) {
|
if (block.getType() != Material.ENCHANTING_TABLE) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (location == null) {
|
|
||||||
location = getLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there isn't an enchant table we can force create one, won't be very useful though.
|
// If there isn't an enchant table we can force create one, won't be very useful though.
|
||||||
BlockPosition pos = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
BlockPosition pos = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
|
|
Loading…
Reference in a new issue