Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.14/1.15] Get world Save folder client side or detect when world is deleted
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
Tupaç

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

By Tupaç, May 4, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Tupaç    0

Tupaç

Tupaç    0

  • Tree Puncher
  • Tupaç
  • Members
  • 0
  • 18 posts
Posted May 4, 2020

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! ?

  • Quote

Share this post


Link to post
Share on other sites

Azaka7    6

Azaka7

Azaka7    6

  • Tree Puncher
  • Azaka7
  • Members
  • 6
  • 38 posts
Posted May 4, 2020

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.

  • Quote

Share this post


Link to post
Share on other sites

Tupaç    0

Tupaç

Tupaç    0

  • Tree Puncher
  • Tupaç
  • Members
  • 0
  • 18 posts
Posted May 4, 2020

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

  • Quote

Share this post


Link to post
Share on other sites

imacatlolol    60

imacatlolol

imacatlolol    60

  • Diamond Finder
  • imacatlolol
  • Forge Modder
  • 60
  • 274 posts
Posted May 5, 2020 (edited)

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 May 5, 2020 by imacatlolol
  • Quote

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

Share this post


Link to post
Share on other sites

Azaka7    6

Azaka7

Azaka7    6

  • Tree Puncher
  • Azaka7
  • Members
  • 6
  • 38 posts
Posted May 5, 2020 (edited)

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 May 5, 2020 by Azaka7
  • Quote

Share this post


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.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • diesieben07
      Forge 1.16.5 - 36.0.9 start up crash

      By diesieben07 · Posted 2 minutes ago

      Problem with RandomPatches.
    • diesieben07
      my 1.16.5 modded game crashes after a while of playing

      By diesieben07 · Posted 2 minutes ago

    • diesieben07
      I need help

      By diesieben07 · Posted 4 minutes ago

      Some zip managers like to take control of the .jar file extension away from Java. Make sure you have Java installed and try running Jarfix once, then try the installer again.
    • diesieben07
      [1.16.5] Enchantments can Apply to all Tools

      By diesieben07 · Posted 6 minutes ago

      https://www.geeksforgeeks.org/how-to-use-iterator-in-java/
    • Zockerbua
      I need help

      By Zockerbua · Posted 11 minutes ago

      I want to download forge for version 1.16.5, but wehn i download forge i get a JAR-File and not the Java-file and when i open this JAR-File i can see the code of the programm i dont know how to fix this please help me.
  • Topics

    • Maxi90909
      3
      Forge 1.16.5 - 36.0.9 start up crash

      By Maxi90909
      Started 1 hour ago

    • matthyit
      3
      my 1.16.5 modded game crashes after a while of playing

      By matthyit
      Started 1 hour ago

    • Zockerbua
      1
      I need help

      By Zockerbua
      Started 11 minutes ago

    • Luis_ST
      17
      [1.16.5] Enchantments can Apply to all Tools

      By Luis_ST
      Started Yesterday at 07:21 AM

    • domi0908
      6
      fix hitbox red baby mobs version forge

      By domi0908
      Started Tuesday at 03:04 PM

  • Who's Online (See full list)

    • diesieben07
    • gaularn@gmail.com
    • Alpvax
    • Stefan2007
    • Tavi007
    • ozi
    • Maxi90909
    • 007lol
    • Zemelua
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.14/1.15] Get world Save folder client side or detect when world is deleted
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community