-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
base: master
Are you sure you want to change the base?
Ocean generator #741
Conversation
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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())); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly redundent
There was a problem hiding this comment.
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
src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java
Outdated
Show resolved
Hide resolved
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); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
src/main/java/com/iridium/iridiumskyblock/managers/GeneratorType.java
Outdated
Show resolved
Hide resolved
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
- moved the check for if the generator is a terrain generator to the methods that call regenerateTerrain
Co-authored-by: Daniel Scherf <[email protected]>
* 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
Co-authored-by: Daniel Scherf <[email protected]>
plugin would incorrectly report invalid generator type for VOID because i didnt add the case for void, so it would default
No description provided.