SPIGOT-7001: Fix entity already exists in CraftWorld#spawnFallingBlock

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2022-04-18 11:05:12 +10:00
parent e935d60d1d
commit 14aabc2648
2 changed files with 19 additions and 14 deletions

View File

@@ -1145,22 +1145,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Validate.notNull(material, "Material cannot be null");
Validate.isTrue(material.isBlock(), "Material must be a block");
EntityFallingBlock entity = EntityFallingBlock.fall(world, new BlockPosition(location.getX(), location.getY(), location.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState());
entity.time = 1;
world.addFreshEntity(entity, SpawnReason.CUSTOM);
EntityFallingBlock entity = EntityFallingBlock.fall(world, new BlockPosition(location.getX(), location.getY(), location.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState(), true);
return (FallingBlock) entity.getBukkitEntity();
}
@Override
public FallingBlock spawnFallingBlock(Location location, BlockData data) throws IllegalArgumentException {
Validate.notNull(location, "Location cannot be null");
Validate.notNull(data, "Material cannot be null");
Validate.notNull(data, "BlockData cannot be null");
EntityFallingBlock entity = EntityFallingBlock.fall(world, new BlockPosition(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState());
entity.time = 1;
world.addFreshEntity(entity, SpawnReason.CUSTOM);
EntityFallingBlock entity = EntityFallingBlock.fall(world, new BlockPosition(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState(), true);
return (FallingBlock) entity.getBukkitEntity();
}