diff options
author | Jake Potrebic <[email protected]> | 2021-12-22 10:02:31 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2021-12-22 10:02:31 -0800 |
commit | 82eaf4ee15d77303cdd352cce9b33c2f3e5d14d7 (patch) | |
tree | 53e4a42978675fc17acc76b85dcb0c3569ab3e3b /patches/server/0729-Add-isCollidable-methods-to-various-places.patch | |
parent | 6e5ceb34eb2ef4d6c0a35c46d0eded9099bb2fee (diff) | |
download | Paper-82eaf4ee15d77303cdd352cce9b33c2f3e5d14d7.tar.gz Paper-82eaf4ee15d77303cdd352cce9b33c2f3e5d14d7.zip |
Fix duplicated BlockPistonRetractEvent call (#7111)
Diffstat (limited to 'patches/server/0729-Add-isCollidable-methods-to-various-places.patch')
-rw-r--r-- | patches/server/0729-Add-isCollidable-methods-to-various-places.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/patches/server/0729-Add-isCollidable-methods-to-various-places.patch b/patches/server/0729-Add-isCollidable-methods-to-various-places.patch new file mode 100644 index 0000000000..3d05bde04f --- /dev/null +++ b/patches/server/0729-Add-isCollidable-methods-to-various-places.patch @@ -0,0 +1,55 @@ +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 + + +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +index 991e73e0f397da265b08ce14bb2f92b251eaff48..89cfa5093d53e1a249efc64aa1b449755c6eecd9 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +@@ -473,6 +473,11 @@ public class CraftBlock implements Block { + public boolean isSolid() { + return getNMS().getMaterial().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 7b9e943b391c061782fccd2b8d705ceec8db50fe..966ac60daebb7bb211ab8096fc0c5f33db67320a 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +@@ -324,4 +324,11 @@ public class CraftBlockState implements BlockState { + throw new IllegalStateException("The blockState must be placed to call this method"); + } + } ++ ++ // 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 812fc61a81519980dad5dcd80127c8420f73676e..9787bc1b989a7d7f92fe0a058b725519fe0d2156 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -528,6 +528,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.Registry.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 + + /** |