Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.jayhill.xlife.common.world.stats;
- import com.jayhill.xlife.XLife;
- import net.minecraft.nbt.CompoundNBT;
- import net.minecraft.nbt.ListNBT;
- import net.minecraft.world.server.ServerWorld;
- import net.minecraft.world.storage.DimensionSavedDataManager;
- import net.minecraft.world.storage.WorldSavedData;
- import net.minecraftforge.common.util.Constants;
- import sun.net.www.content.text.Generic;
- import javax.annotation.Nonnull;
- import java.util.function.Supplier;
- public class StatsManager extends WorldSavedData implements Supplier<Generic> {
- public static ListNBT list = new ListNBT();
- public StatsManager() {
- super(XLife.MOD_ID);
- }
- public void load(CompoundNBT nbt) {
- nbt.getList("Players", Constants.NBT.TAG_LIST);
- }
- @Nonnull
- public CompoundNBT save(CompoundNBT nbt) {
- nbt.put("Players", list);
- return nbt;
- }
- public static StatsManager onWorld(ServerWorld world) {
- DimensionSavedDataManager storage = world.getDataStorage();
- StatsManager saver = storage.computeIfAbsent(StatsManager::new, XLife.MOD_ID);
- storage.set(saver);
- return saver;
- }
- public Generic get() {
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement