1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-04-05 02:06:58 +00:00

Resolve CC's save location to the world dir

Fixes #509
This commit is contained in:
SquidDev 2020-07-27 19:04:57 +01:00
parent 3093f882d8
commit 50d2712581

View File

@ -10,6 +10,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import dan200.computercraft.ComputerCraft;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.storage.FolderName;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import java.io.File;
@ -25,6 +26,7 @@ import java.util.Map;
public final class IDAssigner
{
private static final FolderName FOLDER = new FolderName( ComputerCraft.MOD_ID );
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
private static final Type ID_TOKEN = new TypeToken<Map<String, Integer>>()
{
@ -40,9 +42,7 @@ public final class IDAssigner
public static File getDir()
{
File root = ServerLifecycleHooks.getCurrentServer().getDataDirectory();
// TODO: File worldDirectory = server.getWorld( World.field_234918_g_ ).getSaveHandler().getWorldDirectory();
return new File( root, ComputerCraft.MOD_ID );
return ServerLifecycleHooks.getCurrentServer().func_240776_a_( FOLDER ).toFile();
}
private static MinecraftServer getCachedServer()