From 54b4f479594667262b2372ed9df86f8e60f8be57 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 4 Mar 2022 20:47:30 +0100 Subject: [PATCH] Fix falling block spawn methods For some reason Spigot broke both behavior and the method as a whole --- build-data/paper.at | 3 ++ .../Fix-falling-block-spawn-methods.patch | 41 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 patches/server/Fix-falling-block-spawn-methods.patch diff --git a/build-data/paper.at b/build-data/paper.at index 7d282dd818..c672e2bab1 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -315,3 +315,6 @@ public-f net.minecraft.world.level.gameevent.vibrations.VibrationListener listen # Fix custom inventory holders public-f net.minecraft.world.inventory.AbstractContainerMenu dataSlots public-f net.minecraft.world.inventory.AbstractContainerMenu remoteDataSlots + +# Fix falling block spawn methods +public net.minecraft.world.entity.item.FallingBlockEntity (Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V diff --git a/patches/server/Fix-falling-block-spawn-methods.patch b/patches/server/Fix-falling-block-spawn-methods.patch new file mode 100644 index 0000000000..9455197fa1 --- /dev/null +++ b/patches/server/Fix-falling-block-spawn-methods.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Fri, 4 Mar 2022 20:35:19 +0100 +Subject: [PATCH] Fix falling block spawn methods + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java +@@ -0,0 +0,0 @@ public abstract class CraftRegionAccessor implements RegionAccessor { + // Paper end + } else if (FallingBlock.class.isAssignableFrom(clazz)) { + BlockPos pos = new BlockPos(x, y, z); +- entity = FallingBlockEntity.fall(world, pos, this.getHandle().getBlockState(pos)); ++ entity = new FallingBlockEntity(world, x, y, z, this.getHandle().getBlockState(pos)); // Paper + } else if (Projectile.class.isAssignableFrom(clazz)) { + if (Snowball.class.isAssignableFrom(clazz)) { + entity = new net.minecraft.world.entity.projectile.Snowball(world, x, y, z); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { + Validate.notNull(material, "Material cannot be null"); + Validate.isTrue(material.isBlock(), "Material must be a block"); + +- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState()); ++ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).defaultBlockState()); // Paper + entity.time = 1; + + this.world.addFreshEntity(entity, SpawnReason.CUSTOM); +@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { + Validate.notNull(location, "Location cannot be null"); + Validate.notNull(data, "Material cannot be null"); + +- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState()); ++ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), ((CraftBlockData) data).getState()); // Paper + entity.time = 1; + + this.world.addFreshEntity(entity, SpawnReason.CUSTOM);