Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
0cdce89d59
If a playerdata doesn't contain a valid, loaded world, reset to the main world spawn point
58 Zeilen
3.6 KiB
Diff
58 Zeilen
3.6 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
|
|
|
|
== AT ==
|
|
public net.minecraft.world.entity.item.FallingBlockEntity <init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
index c0186224fd64d70770a0e16752d17c0870121d8f..30a893f7f63961b752e043b81dda20d946cd63aa 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
@@ -599,7 +599,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
|
// Paper end
|
|
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
|
|
BlockPos pos = BlockPos.containing(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 b60765a2176d7a290d2c9b09ba101d61ac572b21..b76d59ae107eec1ea52edfb2d08b1a1da7931593 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -1397,7 +1397,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
Preconditions.checkArgument(material != null, "Material cannot be null");
|
|
Preconditions.checkArgument(material.isBlock(), "Material.%s must be a block", material);
|
|
|
|
- FallingBlockEntity entity = FallingBlockEntity.fall(this.world, BlockPos.containing(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();
|
|
}
|
|
|
|
@@ -1406,7 +1411,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
Preconditions.checkArgument(location != null, "Location cannot be null");
|
|
Preconditions.checkArgument(data != null, "BlockData cannot be null");
|
|
|
|
- FallingBlockEntity entity = FallingBlockEntity.fall(this.world, BlockPos.containing(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();
|
|
}
|
|
|