diff options
Diffstat (limited to 'patches/server/0920-Add-API-to-get-the-collision-shape-of-a-block-before.patch')
-rw-r--r-- | patches/server/0920-Add-API-to-get-the-collision-shape-of-a-block-before.patch | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/patches/server/0920-Add-API-to-get-the-collision-shape-of-a-block-before.patch b/patches/server/0920-Add-API-to-get-the-collision-shape-of-a-block-before.patch new file mode 100644 index 0000000000..48e81c5809 --- /dev/null +++ b/patches/server/0920-Add-API-to-get-the-collision-shape-of-a-block-before.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TrollyLoki <[email protected]> +Date: Wed, 11 Oct 2023 00:45:53 -0400 +Subject: [PATCH] Add API to get the collision shape of a block before it's + placed + + +diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +index de4bbb73a78d037b99d662df130c7e122fda6cee..162e10ce5481d1f94afae595114920ef9df51c61 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +@@ -679,6 +679,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); |