geforkt von Mirrors/Paper
2873869bb1
Signs no longer have a specific isEdiable state, the entire API in this regard needs updating/deprecation. The boolean field is completely gone, replaced by a uuid (which will need a new setEditingPlayer(UUID) method on the Sign interface), and the current upstream implementation of setEdiable simply flips the is_waxed state. This patch is hence not needed as it neither allows editing (which will be redone in a later patch) nor is required to copy the is_waxed boolean flag as it lives in the signs compound tag and is covered by applyTo.
58 Zeilen
2.7 KiB
Diff
58 Zeilen
2.7 KiB
Diff
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
|
|
|
|
== 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 e7e5c9fa734072e9ae15eb5f6d75c7740ba3ba44..8131c1db3d7963121a24348575ea8a98a80a974c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -484,6 +484,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 9068557ac50cfb26e7e3ec4ac64bac583baa582e..3e1d36a8c65e6567ac3b78903a25d5828ab74ea5 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
|
@@ -325,4 +325,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 a618c80fb5a184c2a06ccb7ac3cf55d9151a9fe1..6a048eaf63dec0d061265e639088055c60fbd834 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
@@ -582,6 +582,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
|
|
|
|
/**
|