mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-07 11:05:13 +01:00
SPIGOT-6781: Add Block#canPlace
By: coll1234567 <joshl5324@gmail.com>
This commit is contained in:
parent
3e7bd2643c
commit
731158e521
1 changed files with 9 additions and 0 deletions
|
@ -584,4 +584,13 @@ public class CraftBlock implements Block {
|
||||||
VoxelShape shape = getNMS().getCollisionShape(world, position);
|
VoxelShape shape = getNMS().getCollisionShape(world, position);
|
||||||
return new CraftVoxelShape(shape);
|
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…
Reference in a new issue