Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
e8c2c3bfda
The chunk would not be marked as ticking in this case, so retrieving the ticking chunk would not work.
55 Zeilen
3.3 KiB
Diff
55 Zeilen
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Nassim Jahnke <nassim@njahnke.dev>
|
|
Date: Fri, 4 Mar 2022 20:35:19 +0100
|
|
Subject: [PATCH] Fix falling block spawn methods
|
|
|
|
Restores the API behavior from previous versions of the server
|
|
- Do not call API events
|
|
- Do not replace the existing block in the world
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
index d1fca0e3227b5f37c11367548be362f5a49b6a71..5628940cd3c3566c5db2beda506d4f20b6e3cbae 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
@@ -566,7 +566,7 @@ 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 cf6fce4f3bddcbbae59fd128cf661e4506b9d2c5..23c68b6cd26fbd05685ebcfbb5e81db4c8dedb29 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -1408,7 +1408,12 @@ 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(), SpawnReason.CUSTOM);
|
|
+ // Paper start - restore API behavior for spawning falling blocks
|
|
+ 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);
|
|
+ // Paper end
|
|
return (FallingBlock) entity.getBukkitEntity();
|
|
}
|
|
|
|
@@ -1417,7 +1422,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
Validate.notNull(location, "Location cannot be null");
|
|
Validate.notNull(data, "BlockData cannot be null");
|
|
|
|
- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState(), SpawnReason.CUSTOM);
|
|
+ // Paper start - restore API behavior for spawning falling blocks
|
|
+ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), ((CraftBlockData) data).getState());
|
|
+ entity.time = 1;
|
|
+
|
|
+ this.world.addFreshEntity(entity, SpawnReason.CUSTOM);
|
|
+ // Paper end
|
|
return (FallingBlock) entity.getBukkitEntity();
|
|
}
|
|
|