mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Add API to get the collision shape of a block before it's placed
This commit is contained in:
parent
85e082a9b3
commit
d30ecac57d
1 changed files with 14 additions and 0 deletions
|
@ -688,6 +688,20 @@ public class CraftBlockData implements BlockData {
|
|||
return this.state.isFaceSturdy(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CraftBlock.blockFaceToNotch(face), CraftBlockSupport.toNMS(support));
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public org.bukkit.util.VoxelShape getCollisionShape(Location location) {
|
||||
Preconditions.checkArgument(location != null, "location must not be null");
|
||||
|
||||
CraftWorld world = (CraftWorld) location.getWorld();
|
||||
Preconditions.checkArgument(world != null, "location must not have a null world");
|
||||
|
||||
BlockPos position = CraftLocation.toBlockPosition(location);
|
||||
net.minecraft.world.phys.shapes.VoxelShape shape = this.state.getCollisionShape(world.getHandle(), position);
|
||||
return new org.bukkit.craftbukkit.util.CraftVoxelShape(shape);
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
public Color getMapColor() {
|
||||
return Color.fromRGB(this.state.getMapColor(null, null).col);
|
||||
|
|
Loading…
Reference in a new issue