Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.14/1.15] Get world Save folder client side or detect when world is deleted

Featured Replies

Posted

Hi!  i want to save a json file in the world save folder, how can i locate that folder client side? i know that getWorldName() exists, but Minecrafts allows to have multiple worlds with the same name but with different folders.

An alternative could be creating a custom folder and delete it when the world gets deleted, is there any way to know when the world get deleted?

For servers I am planning to use a custom folder.

 

Cheers! ?

You can access it on the server side. Check if the World is an instance of ServerWorld. If it is, use ((ServerWorld)world).getServer().getFolderName(). If you don't check if the world is an instance of ServerWorld, then getServer() returns null on the client side.

  • Author

I want to keep the mod client side, so i can't access the server side... i think?

What is the purpose of your mod? The server is responsible for save data, so the client doesn't have access to it on its own.

In multiplayer, it wouldn't make sense for clients to have access to save information since the clients are effectively merely simulating the server-side world.

Edited by imacatlolol

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

I think you want the mod to be installed on the player's client, right? Even in Single Player, both a server side and client side run side-by-side. Like imacatlolol said, the client side doesn't access world information, even in single player. The method I pointed out will work in single player worlds by targeting the game's server side without having to be connected to a dedicated server.

Edited by Azaka7

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.