Skip to content

Commit

Permalink
Use SmyLib's server info instead of vanilla's
Browse files Browse the repository at this point in the history
  • Loading branch information
SmylerMC committed Jun 22, 2024
1 parent cfcf551 commit f6b248e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import net.buildtheearth.terraplusplus.projection.mercator.WebMercatorProjection;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -271,7 +270,7 @@ public void reloadState() {
}

public void saveState() {
ServerData servData = Minecraft.getMinecraft().getCurrentServerData();
MinecraftServerInfo servData = getGameClient().currentServerInfo();
if(this.proxyForceGlobalSettings && this.proxyUUID != null) {
this.saveManager.saveProxyState(this.proxyUUID, this.state);
Terramap.instance().logger().debug("Saved proxy state for UUID {} (forced by proxy)", this.proxyUUID);
Expand All @@ -283,7 +282,7 @@ public void saveState() {
Terramap.instance().logger().debug("Saved proxy state for UUID {} (world unknown)", this.proxyUUID);
} else if (servData != null) {
this.saveManager.saveServerState(servData, this.state);
Terramap.instance().logger().debug("Saved server state for server {} ({})",servData.serverName, servData.serverIP);
Terramap.instance().logger().debug("Saved server state for server {} ({})",servData.name, servData.host);
} else {
Terramap.instance().logger().debug("Did not save state for unreliable context");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.gson.Gson;
import net.smyler.smylib.game.MinecraftServerInfo;
import net.minecraft.client.multiplayer.ServerData;
import net.smyler.terramap.Terramap;

import java.io.*;
Expand Down Expand Up @@ -53,8 +52,8 @@ public SavedClientState loadWorldState(UUID worldUUID) {
}

/**
* Loads a {@link SavedClientState} associated with a specific server, given the server's {@link ServerData}.
* This method will usually be used when a remote world cannot be uniquely identified and we can only identify the server.
* Loads a {@link SavedClientState} associated with a specific server, given the server's {@link MinecraftServerInfo}.
* This method will usually be used when a remote world cannot be uniquely identified, and we can only identify the server.
*
* @param serverInfo the information of the server to retrieve the save for
*
Expand Down Expand Up @@ -108,14 +107,14 @@ public void saveWorldState(UUID worldUUID, SavedClientState state) {
}

/**
* Saves a {@link SavedClientState} associated with a specific server, given the server's {@link ServerData}.
* This method will usually be used when a remote world cannot be uniquely identified and we can only identify the server.
* Saves a {@link SavedClientState} associated with a specific server, given the server's {@link MinecraftServerInfo}.
* This method will usually be used when a remote world cannot be uniquely identified, and we can only identify the server.
*
* @param serverData the information of the server to retrieve the save for
* @param state the state to save
*/
public void saveServerState(ServerData serverData, SavedClientState state) {
this.saveStateToPath(this.serverDirectory.resolve(serverData.serverIP + EXTENSION), state);
public void saveServerState(MinecraftServerInfo serverData, SavedClientState state) {
this.saveStateToPath(this.serverDirectory.resolve(serverData.host + EXTENSION), state);
}

/**
Expand Down

0 comments on commit f6b248e

Please sign in to comment.