Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create world without bukkit finding initial spawn for it #11630

Open
SergioK29 opened this issue Nov 17, 2024 · 0 comments
Open

Can't create world without bukkit finding initial spawn for it #11630

SergioK29 opened this issue Nov 17, 2024 · 0 comments

Comments

@SergioK29
Copy link

SergioK29 commented Nov 17, 2024

Expected behavior

Creating worlds is very expensive in part because setInitialSpawn() is called which calls findSpawnPosition(), even if we provide the worlds generator with a fixed spawn location, the findspawnposition code is called before the fixed spawn position check

  private static void setInitialSpawn(ServerLevel world, ServerLevelData worldProperties, boolean bonusChest, boolean debugWorld) {
        if (debugWorld) {
            worldProperties.setSpawn(BlockPos.ZERO.above(80), 0.0F);
        } else {
            ServerChunkCache chunkproviderserver = world.getChunkSource();
            ChunkPos chunkcoordintpair = new ChunkPos(chunkproviderserver.randomState().sampler().findSpawnPosition()); // LAG
            // CraftBukkit start
            if (world.generator != null) {
                Random rand = new Random(world.getSeed());
                org.bukkit.Location spawn = world.generator.getFixedSpawnLocation(world.getWorld(), rand); // fixed spawn check

Image

Solution

The fix is simple ChunkPos chunkcoordintpair line should be moved down below the fixed spawn check from line 804 to line 819 (its not even used until line 823)

Paper version

Latest 1.21.1 1.21.1-DEV-755a775 (MC: 1.21.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant