mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2025-08-31 22:30:15 +00:00
SPIGOT-6781: Add Block#canPlace
This commit is contained in:
parent
2f6662d467
commit
1c82731ddb
1 changed files with 9 additions and 0 deletions
|
@ -584,4 +584,13 @@ public class CraftBlock implements Block {
|
|||
VoxelShape shape = getNMS().getCollisionShape(world, position);
|
||||
return new CraftVoxelShape(shape);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlace(BlockData data) {
|
||||
Preconditions.checkArgument(data != null, "Provided block data is null!");
|
||||
net.minecraft.world.level.block.state.IBlockData iblockdata = ((CraftBlockData) data).getState();
|
||||
net.minecraft.world.level.World world = this.world.getMinecraftWorld();
|
||||
|
||||
return iblockdata.canSurvive(world, this.position);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue