-
Notifications
You must be signed in to change notification settings - Fork 17
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
Basic Pregenerator #121
base: master
Are you sure you want to change the base?
Basic Pregenerator #121
Conversation
src/main/java/serverutils/pregenerator/filemanager/PregeneratorFileManager.java
Outdated
Show resolved
Hide resolved
|
||
public PregeneratorFileManager(MinecraftServer server, double xLoc, double zLoc, int radius, int dimensionID) | ||
throws IOException { | ||
Path temporaryFileSaveFolder = Paths.get("saves").resolve(getWorldFolderPath(server).resolve(COMMAND_FOLDER)); |
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 would prefer if the temp files are made in some subfolder of the serverutilities
folder, if they're in the world folder and backups are running then all of the temp files will be zipped up.
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.
Makes sense. I'll be sure to move those over. Just had it there for the moment.
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 would prefer if the temp files are made in some subfolder of the
serverutilities
folder, if they're in the world folder and backups are running then all of the temp files will be zipped up.
So for pregeneration PR I have made, you mentioned you prefered to have the temp files in the server utilties folder. I think I'll need to make a separate folder in the serverutilties/server folder for each world. For servers this isn't an issue because there's only one world, but for clients that have multiple saves this would be an issue. So I can put it in the serverutilties/server/saves folder and have a folder for each save if you want. I don't know what's best so I thought I'd ask you.
Also, is having it in each backup not fine? If you're doing a pregen and you have to load the backup, you will still need to finish the pregen. Not sure on this.
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 don't really mind it being in the world folder that much, but right now it's only in there in SP. Servers don't have a saves
folder.
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.
If you want it in the world folder you can use DimensionManager.getCurrentSaveRootDirectory()
to get the actual root folder.
You can also use World.getSaveHandler().getWorldDirectory()
if you want it in the dim folder
src/main/java/serverutils/handlers/ServerUtilitiesWorldEventHandler.java
Outdated
Show resolved
Hide resolved
This is using impressively little ram to the point that there is definitely some wiggle room if you ever wanted it to go faster. |
Weird things start happening when I up to 2 chunks per tick. I can do something like 2 chunks every other tick. Most testing will be required before I'm happy upping the speed. I can maybe add a config for how fast? It really might just depend on your system speed. |
IDK how hard it is, but all the in game generators have sucked tbh. They always miss something like lighting checks fluids movement, witchery walls around towns, etc. The best one I found just rcon teleport the player around. That being said I wish that was just in game with SU doing the same idea without needing to use a tool. It be better at keeping track the player / position and such as well in case something derps up, etc. |
this.fileManager = fileManager; | ||
} | ||
|
||
public void processLoadChunk(MinecraftServer server, int dimensionId, Long chunk) { |
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.
That should be a primitive long
decisionTracker += 2 * (z - x) + 1; | ||
} | ||
} | ||
System.out.printf("Found %s chunks to load", chunksToLoad.size()); |
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.
This should be replaced with a proper logger
|
||
public PregeneratorFileManager(MinecraftServer server, double xLoc, double zLoc, int radius, int dimensionID) | ||
throws IOException { | ||
Path temporaryFileSaveFolder = Paths.get("saves").resolve(getWorldFolderPath(server).resolve(COMMAND_FOLDER)); |
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.
If you want it in the world folder you can use DimensionManager.getCurrentSaveRootDirectory()
to get the actual root folder.
You can also use World.getSaveHandler().getWorldDirectory()
if you want it in the dim folder
if (sender instanceof MinecraftServer) { | ||
return "commands." + ICommandWithParent.getCommandPath(this) + ".usage_server"; | ||
} | ||
|
||
return "commands." + ICommandWithParent.getCommandPath(this) + ".usage_client"; |
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.
These two lang keys don't actually exist in the lang file
crash-2024-12-02_17.08.14-server.txt I crashed when reloading a world that had a pregen running. It seems to happen consistently in SP if you exit to main menu and reload the world. |
You can also simplify the chunk queuing a bit by using a LongArrayFIFOQueue aecaf5b This both fixes the crash and provides an early return so that it won't find 500k chunks to load if only 10k of those still need to be loaded. |
More work will eventually be needed to make it better, but this works to generate a circle for now.
Will want to make a GUI to select the areas specifically and add a square generation area.