aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0596-Add-hasCollision-methods-to-various-places.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0596-Add-hasCollision-methods-to-various-places.patch')
-rw-r--r--patches/server/0596-Add-hasCollision-methods-to-various-places.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/patches/server/0596-Add-hasCollision-methods-to-various-places.patch b/patches/server/0596-Add-hasCollision-methods-to-various-places.patch
new file mode 100644
index 0000000000..a6045ddd1b
--- /dev/null
+++ b/patches/server/0596-Add-hasCollision-methods-to-various-places.patch
@@ -0,0 +1,56 @@
+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 hasCollision 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 1002123cd0c6f57cecc4e80f5f21cc6ff5886d37..e96023b71845526383288917e8d7c5759a4c0e9b 100644
+--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
+@@ -341,4 +341,11 @@ public class CraftBlockState implements BlockState {
+ public BlockState copy(Location location) {
+ return new CraftBlockState(this, location);
+ }
++
++ // Paper start
++ @Override
++ public boolean isCollidable() {
++ return this.data.getBlock().hasCollision;
++ }
++ // Paper end
+ }
+diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java
+index f2f62667ddf082796011ad7dd025e8855b765c1f..5d3ce8c8cb02c5a61f011adbecd10ae041cbb99b 100644
+--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java
++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java
+@@ -232,4 +232,11 @@ public class CraftBlockType<B extends BlockData> implements BlockType.Typed<B>,
+ return this.block.getDescriptionId();
+ }
+ // Paper end - add Translatable
++
++ // Paper start - hasCollision API
++ @Override
++ public boolean hasCollision() {
++ return this.block.hasCollision;
++ }
++ // Paper end - hasCollision API
+ }