Add API to get the collision shape of a block before it's placed
This commit is contained in:
@@ -688,6 +688,20 @@ public class CraftBlockData implements BlockData {
|
|||||||
return this.state.isFaceSturdy(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CraftBlock.blockFaceToNotch(face), CraftBlockSupport.toNMS(support));
|
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
|
@Override
|
||||||
public Color getMapColor() {
|
public Color getMapColor() {
|
||||||
return Color.fromRGB(this.state.getMapColor(null, null).col);
|
return Color.fromRGB(this.state.getMapColor(null, null).col);
|
||||||
|
|||||||
Reference in New Issue
Block a user