3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

SPIGOT-6111: NPE in CraftHumanEntity#openWorkbench & CraftHumanEntity#openEnchanting

Dieser Commit ist enthalten in:
md_5 2020-08-27 18:32:52 +10:00
Ursprung ee7116b4cc
Commit bfea455968
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: E8E901AC7C617C11

Datei anzeigen

@ -326,15 +326,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public InventoryView openWorkbench(Location location, boolean force) {
if (location == null) {
location = getLocation();
}
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.CRAFTING_TABLE) {
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())));
if (force) {
getHandle().activeContainer.checkReachable = false;
@ -344,15 +344,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public InventoryView openEnchanting(Location location, boolean force) {
if (location == null) {
location = getLocation();
}
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.ENCHANTING_TABLE) {
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.
BlockPosition pos = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());