Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SOLVED][1.16.4] Get Overworld save directory


Recommended Posts

Hello ! I'd like to get the directory from the overworld to save sqlite databases inside it. ( Kind of the way Computercraft / CC:Tweaked does it with computer data )
I tried with :

ServerLifecycleHooks.getCurrentServer().getWorld

But I don't kow how to use it.
Could anyone help me ?
Thanks ^^

Edited by BastouP
Link to post
Share on other sites

ServerChunkProvider#getSavedData and then DimensionSavedDataManager#folder (needs reflection) will get you the data folder.

However I would really encourage you to consider not using a custom data format.

  • Thanks 1
Link to post
Share on other sites
1 minute ago, diesieben07 said:

ServerChunkProvider#getSavedData and then DimensionSavedDataManager#folder (needs reflection) will get you the data folder.

However I would really encourage you to consider not using a custom data format.

Yeah but I am creating a perpheral for computercraft that uses SQL. So i think using a sqlite file would be the easiest way. (You do not need to maintain a server.) However if there is another way I’d be glad to test it.

Testing this this evening btw.

Link to post
Share on other sites

Okay I made it work with this:
 

public static File getWorldFolder(ServerWorld world) throws NoSuchFieldException, IllegalAccessException {
	DimensionSavedDataManager savedData = world.getChunkProvider().getSavedData();
	Field folderField = DimensionSavedDataManager.class.getDeclaredField("folder");
	folderField.setAccessible(true);
	return ((File) folderField.get(savedData)).getParentFile();
}

So I'm good now ^^

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I just got started with modding and I'm trying to create one. I did everything that the Forge Documentation said, ran the Eclipse IDE launch configurations and after trying to run   gradlew build after 46% of the build I got an error:   > Task :compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find net.minecraftforge:forge:1.16.5-36.1.0_mapped_official_1.16.5. Searched in the following locations: - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.module - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - file:/C:/Users/Zalman/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom - file:/C:/Users/Zalman/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - https://libraries.minecraft.net/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - https://repo.maven.apache.org/maven2/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom Required by: project : * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.8.1/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 35s 1 actionable task: 1 executed I tried deleting the gradle cache (in C:\Users\username\.gradle) and building again, nothing. Tried deleting the whole project, putting the forge files back and generating the launch configurations again, still nothing. I'd appreciate some support with this.
    • Ugh, I posted in the wrong category, sorry.
    • I just got started with modding and I'm trying to create one. I did everything that the Forge Documentation said, ran the Eclipse IDE launch configurations and after trying to run   gradlew build after 46% of the build I got an error:   > Task :compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find net.minecraftforge:forge:1.16.5-36.1.0_mapped_official_1.16.5. Searched in the following locations: - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.module - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - file:/C:/Users/Zalman/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom - file:/C:/Users/Zalman/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - https://libraries.minecraft.net/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - https://repo.maven.apache.org/maven2/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom Required by: project : * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.8.1/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 35s 1 actionable task: 1 executed I tried deleting the gradle cache (in C:\Users\username\.gradle) and building again, nothing. Tried deleting the whole project, putting the forge files back and generating the launch configurations again, still nothing. I'd appreciate some support with this.  
    • This is the launcher log, it's the only place where I see any reference to an error.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.