2022-03-04 19:47:30 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Nassim Jahnke <jahnke.nassim@gmail.com>
|
|
|
|
Date: Fri, 4 Mar 2022 20:35:19 +0100
|
|
|
|
Subject: [PATCH] Fix falling block spawn methods
|
|
|
|
|
2022-04-30 16:27:41 +00:00
|
|
|
Restores the API behavior from previous versions of the server
|
|
|
|
- Do not call API events
|
|
|
|
- Do not replace the existing block in the world
|
2022-03-04 19:47:30 +00:00
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
2022-06-07 17:03:07 +00:00
|
|
|
index e996ffb6fd952208b1dabba8b470fd42f004919d..6e827ed6212915b187e4c610acf6c34037c9c994 100644
|
2022-03-04 19:47:30 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
|
|
@@ -549,7 +549,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
|
2022-06-05 20:51:44 +00:00
|
|
|
index 1a07887345f46582949090b685dae507aaba84f4..f5a6250350a5f0b6236c1fe0f149b1190de34880 100644
|
2022-03-04 19:47:30 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2022-06-05 20:51:44 +00:00
|
|
|
@@ -1411,7 +1411,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
2022-03-04 19:47:30 +00:00
|
|
|
Validate.notNull(material, "Material cannot be null");
|
|
|
|
Validate.isTrue(material.isBlock(), "Material must be a block");
|
|
|
|
|
2022-04-30 16:27:41 +00:00
|
|
|
- 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
|
2022-03-04 19:47:30 +00:00
|
|
|
+ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).defaultBlockState()); // Paper
|
2022-04-30 16:27:41 +00:00
|
|
|
+ entity.time = 1;
|
|
|
|
+
|
|
|
|
+ this.world.addFreshEntity(entity, SpawnReason.CUSTOM);
|
|
|
|
+ // Paper end
|
|
|
|
return (FallingBlock) entity.getBukkitEntity();
|
|
|
|
}
|
2022-03-04 19:47:30 +00:00
|
|
|
|
2022-06-05 20:51:44 +00:00
|
|
|
@@ -1420,7 +1425,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
2022-03-04 19:47:30 +00:00
|
|
|
Validate.notNull(location, "Location cannot be null");
|
2022-04-30 16:27:41 +00:00
|
|
|
Validate.notNull(data, "BlockData cannot be null");
|
2022-03-04 19:47:30 +00:00
|
|
|
|
2022-04-30 16:27:41 +00:00
|
|
|
- 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();
|
|
|
|
}
|
2022-03-04 19:47:30 +00:00
|
|
|
|