mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +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));
|
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);
|
||||||
|
|
Loading…
Reference in a new issue