geforkt von Mirrors/Paper
90fe0d58a5
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry 255b2aa1 SPIGOT-7080: Add World#locateNearestBiome ff984826 Remove javadoc.io doc links CraftBukkit Changes: 71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler 38c599f9d PR-1272: Only allow one entity in CraftItem instead of two f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld Spigot Changes: e0e223fe Remove javadoc.io doc links
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 4c4e242305edf7b8bfa6761cd7e8c9498982608c..5fa6a77ccd01deb929d86efc227439f4f280ba53 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -456,6 +456,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 eb895090384b6ce0943e8286a3aae55506f4310a..1308720c6f3072a5442b93d495e03735419d59eb 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
|
@@ -331,4 +331,11 @@ public class CraftBlockState implements BlockState {
|
|
public CraftBlockState copy() {
|
|
return new CraftBlockState(this);
|
|
}
|
|
+
|
|
+ // 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 19c07e2c4b6010bf673f79e58fdbaa41275c4fba..4e4852a1973df20023b7213b18b032d7244a4c1f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
@@ -575,6 +575,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
|
|
|
|
/**
|