WorldSaveData не инстансируется

Версия Minecraft
1.12.2
API
Forge
172
5
14
вроде бы делаю все правильно World Saved Data - Forge Documentation
я туда запихивал
FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(0);
player.world
WorldServer worldServer = Objects.requireNonNull(player.world.getMinecraftServer()).getWorld(0);
даже это
Minecraft.getMinecraft().world "да это абсурд"

сам код преписывал раз 10
либо нечего не сохраняется
либо при пере заходе в мир ничего не сохраняется
либо вот

WorldData:
package com.artur.returnoftheancients.ancientworldutilities;

import com.artur.returnoftheancients.referense.Referense;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.storage.MapStorage;
import net.minecraft.world.storage.WorldSavedData;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;


public class WorldData extends WorldSavedData {

    public NBTTagCompound saveData = new NBTTagCompound();
    private final String saveDataKey = "savedata";
    public static final String DATA_NAME = Referense.MODID + "_data";


    public WorldData() {
        super(DATA_NAME);
    }

    @Override
    public void readFromNBT(@NotNull NBTTagCompound nbt) {
        saveData = nbt.getCompoundTag(saveDataKey);
        System.out.println("readFromNBT: " + saveData);
    }

    @Override
    public @NotNull NBTTagCompound writeToNBT(@NotNull NBTTagCompound compound) {
        compound.setTag(saveDataKey, saveData);
        System.out.println("writeToNBT: " + saveData);
        return compound;
    }

    public static WorldData get(World world) {
        MapStorage storage = world.getMapStorage();
        WorldData instance = (WorldData) Objects.requireNonNull(storage).getOrLoadData(WorldData.class, DATA_NAME);

        if (instance == null) {
            instance = new WorldData();
            storage.setData(DATA_NAME, instance);
        }
        return instance;
    }
}
DataManager - комманда:
package com.artur.returnoftheancients.commads;

import com.artur.returnoftheancients.ancientworldutilities.WorldData;

import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.WorldServer;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;


public class DataManager extends CommandBase {
    String NAME = "data", USAGE = "/data";



    @Override
    public String getName() {
        return NAME;
    }

    @Override
    public String getUsage(ICommandSender sender) {
        return USAGE;
    }

    @Override
    public void execute(@NotNull MinecraftServer server, @NotNull ICommandSender sender, String @NotNull []args) throws CommandException {
        EntityPlayerMP playerMP = getCommandSenderAsPlayer(sender);
        EntityPlayer player = getCommandSenderAsPlayer(sender);
        WorldServer worldServer = Objects.requireNonNull(player.world.getMinecraftServer()).getWorld(0);
        WorldData worldData = WorldData.get(worldServer);
            if (args[0].equals("set") && args.length == 3) {
                worldData.saveData.setString(args[1], args[2]);
                worldData.setDirty(true);
                worldData.markDirty();
                playerMP.sendMessage(new TextComponentString("Data save"));
            } else if (args[0].equals("get") && args.length == 3) {
                switch (args[1]) {
                    case "int":
                        playerMP.sendMessage(new TextComponentString("Data load: " + worldData.saveData.getInteger(args[2])));
                    break;
                    case "boolean":
                        playerMP.sendMessage(new TextComponentString("Data load: " + worldData.saveData.getBoolean(args[2])));
                    break;
                    case "String":
                        playerMP.sendMessage(new TextComponentString("Data load: " + worldData.saveData.getString(args[2])));
                    break;
                }
            } else if (args[0].equals("help") && args.length == 1){
                playerMP.sendMessage(new TextComponentString("data set key value"));
                playerMP.sendMessage(new TextComponentString("data get dataType key"));
            } else {
                playerMP.sendMessage(new TextComponentString("Gavno"));
            }
    }
}
 
Краш-лог
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: java.lang.RuntimeException: Failed to instantiate class com.artur.returnoftheancients.ancientworldutilities.WorldData
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.world.storage.MapStorage.getOrLoadData(MapStorage.java:56)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at com.artur.returnoftheancients.ancientworldutilities.WorldData.get(WorldData.java:39)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at com.artur.returnoftheancients.commads.DataManager.execute(DataManager.java:38)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.command.CommandHandler.tryExecute(CommandHandler.java:119)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.command.CommandHandler.executeCommand(CommandHandler.java:91)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.network.NetHandlerPlayServer.handleSlashCommand(NetHandlerPlayServer.java:962)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.network.NetHandlerPlayServer.processChatMessage(NetHandlerPlayServer.java:941)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.network.play.client.CPacketChatMessage.processPacket(CPacketChatMessage.java:38)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.network.play.client.CPacketChatMessage.processPacket(CPacketChatMessage.java:8)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.util.Util.runTask(Util.java:50)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:723)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:185)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: at java.lang.Thread.run(Thread.java:748)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: Caused by: java.lang.NoSuchMethodException: com.artur.returnoftheancients.ancientworldutilities.WorldData.<init>(java.lang.String)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: at java.lang.Class.getConstructor0(Class.java:3082)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: at java.lang.Class.getConstructor(Class.java:1825)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: at net.minecraft.world.storage.MapStorage.getOrLoadData(MapStorage.java:52)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: ... 17 more
Краш-лог:
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: java.lang.RuntimeException: Failed to instantiate class com.artur.returnoftheancients.ancientworldutilities.WorldData
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.world.storage.MapStorage.getOrLoadData(MapStorage.java:56)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at com.artur.returnoftheancients.ancientworldutilities.WorldData.get(WorldData.java:39)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at com.artur.returnoftheancients.commads.DataManager.execute(DataManager.java:38)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.command.CommandHandler.tryExecute(CommandHandler.java:119)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.command.CommandHandler.executeCommand(CommandHandler.java:91)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.network.NetHandlerPlayServer.handleSlashCommand(NetHandlerPlayServer.java:962)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.network.NetHandlerPlayServer.processChatMessage(NetHandlerPlayServer.java:941)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.network.play.client.CPacketChatMessage.processPacket(CPacketChatMessage.java:38)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.network.play.client.CPacketChatMessage.processPacket(CPacketChatMessage.java:8)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.util.Util.runTask(Util.java:50)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:723)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:185)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
[22:04:12] [Server thread/INFO] [STDERR]: [net.minecraft.world.storage.MapStorage:getOrLoadData:67]: 	at java.lang.Thread.run(Thread.java:748)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: Caused by: java.lang.NoSuchMethodException: com.artur.returnoftheancients.ancientworldutilities.WorldData.<init>(java.lang.String)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: 	at java.lang.Class.getConstructor0(Class.java:3082)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: 	at java.lang.Class.getConstructor(Class.java:1825)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: 	at net.minecraft.world.storage.MapStorage.getOrLoadData(MapStorage.java:52)
[22:04:12] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:635]: 	... 17 more
Последнее редактирование:
Сверху