From 26d0751f8e55de53a072e3ec4400467c32294f4b Mon Sep 17 00:00:00 2001 From: Jake Potrebic 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 --- .../main/java/org/bukkit/craftbukkit/block/CraftBlock.java | 5 +++++ .../java/org/bukkit/craftbukkit/block/CraftBlockState.java | 7 +++++++ .../java/org/bukkit/craftbukkit/block/CraftBlockType.java | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 9c8aac69f0..d5b495b5a3 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/paper-server/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/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java index 1002123cd0..e96023b718 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/paper-server/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/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java index 2d8a509446..785d3fe492 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java @@ -241,4 +241,11 @@ public class CraftBlockType implements BlockType.Typed, return this.block.getDescriptionId(); } // Paper end - add Translatable + + // Paper start - hasCollision API + @Override + public boolean hasCollision() { + return this.block.hasCollision; + } + // Paper end - hasCollision API }