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

Ocean generator #741

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

Ocean generator #741

wants to merge 25 commits into from

Conversation

PeachesMLG
Copy link
Member

No description provided.

sh0inx and others added 7 commits September 23, 2023 14:00
updated generators to allow server owners to set the default biome and whether they'd like their oceans to be decorated or not (includes ores, deposits, and geodes, no caves)
cleaned up some residual das code
uh so we basically create a duplicate of the world on first generation of an island that will then be used to copy and paste the terrain under the islands

the first generation is slow because it has to create the worlds, but once this is done its exactly like the deleting blocks method except in reverse
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are Biomes neccisary here? they will get overridden when you create an island, so will just be more confusing to people configuring no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i added them for consistency, they do affect things spawning outside of an island for terrain generation purposes, but you're right

Comment on lines +22 to +26
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
biomeGrid.setBiome(x, z, Objects.requireNonNull(getSkyblockGenerator(world.getEnvironment()).biome.getBiome()));
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly redundent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont remember why this was here, but i remember it being important, so if it breaks you can just revert the change ig

Comment on lines 329 to 348
for (int x = pos1.getBlockX(); x <= pos2.getBlockX(); x++) {
for (int z = pos1.getBlockZ(); z <= pos2.getBlockZ(); z++) {
Block blockA = regenWorld.getBlockAt(x, y, z);
Block blockB = world.getBlockAt(x, y, z);

blockB.setType(blockA.getType(), false);
}
}

if (y <= LocationUtils.getMinHeight(world)) {
completableFuture.complete(null);
} else {
if (delay < 1) {
regenerateTerrain(island, world, y - 1, completableFuture, delay);
} else {
Bukkit.getScheduler().runTaskLater(IridiumSkyblock.getInstance(), () -> regenerateTerrain(island, world, y - 1, completableFuture, delay), delay);
}
}
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially we can utilise the Paster class, which should already have this code in

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can look into this, but i separated it into its own method because it will only run this if it detects we're using a terrain generator

- moved the cache world creation to the create world method so that the plugin does not lag on island creation
- changed setting to GeneratorType enum
- added vanilla generation option (takes advantage of null chunk generator)
- deletes and regenerates cache world on bad seed comparison so that the cache world matches even on generator change
if (Bukkit.getWorld(getCacheWorldName(world)).getSeed() != Bukkit.getWorld(world.getName()).getSeed()) {
File cacheWorld = Bukkit.getWorld(getCacheWorldName(world)).getWorldFolder();
Bukkit.unloadWorld(getCacheWorldName(world), false);
deleteWorld(cacheWorld);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the server crashes or the code above throws an exception? Maybe we should cleanup cached worlds on server startup?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to have the cached world for terrain generation, generating them on startup for every server start seems a bit unnecessary if the world is already there and matches our criteria

sh0inx and others added 4 commits March 6, 2024 02:18
@sh0inx sh0inx marked this pull request as ready for review March 16, 2024 15:01
sh0inx and others added 11 commits May 10, 2024 20:14
* Added flatlands generator

- also added some logging about the generator type to ensure that server admins know what the correct enum values are

* forgot to import arrays, silly me
plugin would incorrectly report invalid generator type for VOID

because i didnt add the case for void, so it would default
@dlsf dlsf added the enhancement New feature or request label Sep 4, 2024
@sh0inx
Copy link
Contributor

sh0inx commented Nov 20, 2024

We need to implement one of the following:

A) Block populators for versions below 1.17.1
B) Block populators for ALL versions, stop using the decorate function included in 1.17.1
C) Version check to ignore world type in versions below 1.17.1
D) Version check to ignore the decorate function in versions below 1.17.1

ideally, we have the generators work the same across all versions that IridiumSkyblock is compatible with, so I think either option A or B would be the preferred choice (i hate the concept too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants