diff options
Diffstat (limited to 'patches/server/0625-Add-isCollidable-methods-to-various-places.patch')
-rw-r--r-- | patches/server/0625-Add-isCollidable-methods-to-various-places.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/patches/server/0625-Add-isCollidable-methods-to-various-places.patch b/patches/server/0625-Add-isCollidable-methods-to-various-places.patch new file mode 100644 index 0000000000..ce6e50fe3c --- /dev/null +++ b/patches/server/0625-Add-isCollidable-methods-to-various-places.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Thu, 4 Nov 2021 11:50:40 -0700 +Subject: [PATCH] Add isCollidable methods to various places + +== AT == +public net.minecraft.world.level.block.state.BlockBehaviour hasCollision + +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +index ce297420f695404356655b1df2847a32fb98ec59..068b3735b6c50a7a2053c7dc39856f728fb7218a 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +@@ -457,6 +457,11 @@ public class CraftBlock implements Block { + public boolean isSolid() { + return this.getNMS().blocksMotion(); + } ++ ++ @Override ++ public boolean isCollidable() { ++ return getNMS().getBlock().hasCollision; ++ } + // Paper end + + @Override +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +index 928a301627134b49915b0ceaeabb7dc350605dc2..08716e757b2e100f7bc47a046f02db664d882aba 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +@@ -331,4 +331,11 @@ public class CraftBlockState implements BlockState { + public CraftBlockState copy() { + return new CraftBlockState(this); + } ++ ++ // Paper start ++ @Override ++ public boolean isCollidable() { ++ return this.data.getBlock().hasCollision; ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +index efa904eac6e3c2995f5a03fca44340d083e73b77..609b103cb9af3b0554bf1116306874fe98c8534c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -588,6 +588,12 @@ public final class CraftMagicNumbers implements UnsafeValues { + var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); + return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier); + } ++ ++ @Override ++ public boolean isCollidable(Material material) { ++ Preconditions.checkArgument(material.isBlock(), material + " is not a block"); ++ return getBlock(material).hasCollision; ++ } + // Paper end + + /** |