SPIGOT-6781: Add Block#canPlace

This commit is contained in:
coll1234567 2021-11-23 18:49:13 +11:00 committed by md_5
parent 2f6662d467
commit 1c82731ddb
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -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);
}
}