SPIGOT-6817: Revert back to old block state behaviour again

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-29 11:03:16 +11:00
parent 6b0484122e
commit 4dbb83e45d
3 changed files with 9 additions and 7 deletions

View File

@@ -49,7 +49,7 @@
return nbttagcompound;
}
@@ -202,4 +226,15 @@
@@ -202,4 +226,13 @@
public void setBlockState(IBlockData iblockdata) {
this.blockState = iblockdata;
}
@@ -57,9 +57,7 @@
+ // CraftBukkit start - add method
+ public InventoryHolder getOwner() {
+ if (level == null) return null;
+ org.bukkit.block.Block block = level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
+ if (block.getType() == org.bukkit.Material.AIR) return null;
+ org.bukkit.block.BlockState state = block.getState();
+ org.bukkit.block.BlockState state = level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()).getState();
+ if (state instanceof InventoryHolder) return (InventoryHolder) state;
+ return null;
+ }