D’acc j’ai fais ça:
RankSave:
| |
| package net.legacymod.save; |
| |
| import java.util.HashMap; |
| import java.util.UUID; |
| |
| import net.legacymod.properties.EnumRank; |
| import net.legacymod.proxy.ServerProxy; |
| import net.minecraft.nbt.NBTBase; |
| import net.minecraft.nbt.NBTTagCompound; |
| import net.minecraft.nbt.NBTTagList; |
| import net.minecraft.nbt.NBTTagString; |
| import net.minecraft.world.World; |
| import net.minecraft.world.WorldSavedData; |
| import net.minecraft.world.storage.MapStorage; |
| |
| public class RankSave extends WorldSavedData { |
| |
| |
| |
| |
| |
| public static RankSave load(World w) { |
| MapStorage storage = w.perWorldStorage; |
| final String KEY = ServerProxy.SAVE_KEY; |
| RankSave result = (RankSave)storage.loadData(RankSave.class, KEY); |
| if (result == null) { |
| result = new RankSave(KEY); |
| storage.setData(KEY, result); |
| } |
| |
| return result; |
| } |
| |
| public RankSave(String key) { |
| super(key); |
| } |
| |
| public void readFromNBT(NBTTagCompound nbt) { |
| |
| readFromNBT(nbt); |
| NBTTagCompound nbtTagCompound = nbt.getCompoundTag(ServerProxy.SAVE_KEY); |
| } |
| |
| @Override |
| public void writeToNBT(NBTTagCompound nbt) { |
| |
| writeToNBT(nbt); |
| NBTTagCompound nbtTagCompound = nbt.getCompoundTag(ServerProxy.SAVE_KEY); |
| |
| } |
| |
| } |
| |
ServerProxy:
| |
| package net.legacymod.proxy; |
| |
| import java.util.HashMap; |
| import java.util.UUID; |
| |
| import net.legacymod.packets.PacketGuerrier; |
| import net.legacymod.properties.EnumRank; |
| |
| public class ServerProxy { |
| |
| public static final HashMap <uuid, enumrank="">RANK = new HashMap<uuid, enumrank="">(); |
| |
| public static final String SAVE_KEY = "Ranks"; |
| |
| } |
| |
Dite moi si c’est bon sinon une fois que c’est fini je dois enregistrer la classe ?</uuid,></uuid,>