2021-11-06 20:43:24 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Thu, 4 Nov 2021 11:50:40 -0700
|
|
|
|
Subject: [PATCH] Add isCollidable methods to various places
|
|
|
|
|
2022-11-20 00:53:20 +01:00
|
|
|
== AT ==
|
|
|
|
public net.minecraft.world.level.block.state.BlockBehaviour hasCollision
|
2021-11-06 20:43:24 +01:00
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
2023-12-06 05:49:31 +01:00
|
|
|
index ce297420f695404356655b1df2847a32fb98ec59..068b3735b6c50a7a2053c7dc39856f728fb7218a 100644
|
2021-11-06 20:43:24 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
2023-12-06 05:49:31 +01:00
|
|
|
@@ -457,6 +457,11 @@ public class CraftBlock implements Block {
|
2021-11-06 20:43:24 +01:00
|
|
|
public boolean isSolid() {
|
2023-06-08 04:12:38 +02:00
|
|
|
return this.getNMS().blocksMotion();
|
2021-11-06 20:43:24 +01:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @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
|
2023-11-04 20:20:01 +01:00
|
|
|
index aca63719790429d3d7c7c59a1931a98221c70fc0..31bb92c026a4a2de0e8d3500f6ecf35b60d61fb9 100644
|
2021-11-06 20:43:24 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
2023-09-29 02:28:26 +02:00
|
|
|
@@ -331,4 +331,11 @@ public class CraftBlockState implements BlockState {
|
|
|
|
public CraftBlockState copy() {
|
|
|
|
return new CraftBlockState(this);
|
2021-11-06 20:43:24 +01:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // 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
|
2023-12-06 05:49:31 +01:00
|
|
|
index 33988ab25aba60c75bffbd39da5562333875d0c1..da0d44cf18888945ed24d941af0f1a3562156e50 100644
|
2021-11-06 20:43:24 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
2023-12-06 05:49:31 +01:00
|
|
|
@@ -572,6 +572,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
2022-12-08 04:24:00 +01:00
|
|
|
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)));
|
2021-11-06 20:43:24 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
/**
|