mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 04:09:54 +01:00
4cdbb0c86c
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: 044d4ee9 SPIGOT-7283, SPIGOT-7318: Add AsyncStructureGenerateEvent and BlockState cloning 57b73d57 PR-913: Deprecate Projectile#doesBounce() and #setBounce() 43373c44 PR-904: Update FeatureFlag for 1.20.2 a7bbbf0c PR-911: Expand DataPack API with 1.20.2 pack version methods 0341e3a0 SPIGOT-7489: Add TeleportDuration to Display Entity bcd8d2aa PR-912: Update Minecraft Wiki URLs CraftBukkit Changes: 99aafc222 Increase outdated build delay dab849f08 SPIGOT-7283, SPIGOT-7318: Add AsyncStructureGenerateEvent and BlockState cloning 041b29ae3 Upgrade specialsource-maven-plugin 851a32cff PR-1263: Remove unused implementation of AbstractProjectile#doesBounce() and #setBounce() 251af0da3 PR-1261: Expand DataPack API with 1.20.2 pack version methods 46e4ba627 Upgrade specialsource-maven-plugin df3738a24 SPIGOT-7489: Add TeleportDuration to Display Entity 8d0fea457 PR-1262: Update Minecraft Wiki URLs e62905aab SPIGOT-7490: Fix entity equipment updates Spigot Changes: a0f3d486 Rebuild patches
58 lines
2.7 KiB
Diff
58 lines
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 b697619abf1bce42a15a38d959dad37d49055c30..ce6b2198db6a48e9e1899db94c49a6c108950f61 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
@@ -562,6 +562,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
|
|
|
|
/**
|