Search in sources :

Example 1 with MapStorage

use of net.minecraft.world.storage.MapStorage in project wuxiacraft by airesnoronha.

the class WorldSectData method get.

public static WorldSectData get(World world) {
    MapStorage storage = world.getMapStorage();
    WorldSectData instance = (WorldSectData) storage.getOrLoadData(WorldSectData.class, DATA_NAME);
    if (instance == null) {
        instance = new WorldSectData();
        storage.setData(DATA_NAME, instance);
    }
    return instance;
}
Also used : MapStorage(net.minecraft.world.storage.MapStorage)

Example 2 with MapStorage

use of net.minecraft.world.storage.MapStorage in project wuxiacraft by airesnoronha.

the class WorldVariables method get.

public static WorldVariables get(World world) {
    MapStorage storage = world.getPerWorldStorage();
    WorldVariables instance = (WorldVariables) storage.getOrLoadData(WorldVariables.class, DATA_NAME);
    if (instance == null) {
        instance = new WorldVariables(world.provider.getDimension());
        storage.setData(DATA_NAME, instance);
    }
    return instance;
}
Also used : MapStorage(net.minecraft.world.storage.MapStorage)

Example 3 with MapStorage

use of net.minecraft.world.storage.MapStorage in project clientcommands by Earthcomputer.

the class ClientVirtualWorld method init.

@Override
public World init() {
    mapStorage = new MapStorage(null);
    String villageCollectionId = VillageCollection.fileNameForProvider(provider);
    villageCollection = new VillageCollection(this);
    mapStorage.setData(villageCollectionId, villageCollection);
    worldScoreboard = new ServerScoreboard(server);
    ScoreboardSaveData scoreboardSaveData = new ScoreboardSaveData();
    mapStorage.setData("scoreboard", scoreboardSaveData);
    scoreboardSaveData.setScoreboard(worldScoreboard);
    lootTable = new LootTableManager(null);
    advancementManager = new AdvancementManager(null);
    functionManager = new FunctionManager(null, server);
    getWorldBorder().setCenter(worldInfo.getBorderCenterX(), worldInfo.getBorderCenterZ());
    getWorldBorder().setDamageAmount(worldInfo.getBorderDamagePerBlock());
    getWorldBorder().setDamageBuffer(worldInfo.getBorderSafeZone());
    getWorldBorder().setWarningDistance(worldInfo.getBorderWarningDistance());
    getWorldBorder().setWarningTime(worldInfo.getBorderWarningTime());
    if (worldInfo.getBorderLerpTime() > 0) {
        getWorldBorder().setTransition(worldInfo.getBorderSize(), worldInfo.getBorderLerpTarget(), worldInfo.getBorderLerpTime());
    } else {
        getWorldBorder().setTransition(worldInfo.getBorderSize());
    }
    initCapabilities();
    return this;
}
Also used : ServerScoreboard(net.minecraft.scoreboard.ServerScoreboard) AdvancementManager(net.minecraft.advancements.AdvancementManager) LootTableManager(net.minecraft.world.storage.loot.LootTableManager) ScoreboardSaveData(net.minecraft.scoreboard.ScoreboardSaveData) VillageCollection(net.minecraft.village.VillageCollection) MapStorage(net.minecraft.world.storage.MapStorage) FunctionManager(net.minecraft.advancements.FunctionManager)

Example 4 with MapStorage

use of net.minecraft.world.storage.MapStorage in project GregTech by GregTechCEu.

the class VirtualTankRegistry method initializeStorage.

/**
 * To be called on world load event
 */
public static void initializeStorage(World world) {
    MapStorage storage = world.getMapStorage();
    VirtualTankRegistry instance = (VirtualTankRegistry) storage.getOrLoadData(VirtualTankRegistry.class, DATA_ID);
    if (instance == null) {
        instance = new VirtualTankRegistry();
        storage.setData(DATA_ID, instance);
    }
}
Also used : MapStorage(net.minecraft.world.storage.MapStorage)

Example 5 with MapStorage

use of net.minecraft.world.storage.MapStorage in project RuneCraftory by Flemmli97.

the class NPCVillageHandler method get.

public static NPCVillageHandler get(World world) {
    MapStorage storage = world.getMapStorage();
    NPCVillageHandler data = (NPCVillageHandler) storage.getOrLoadData(NPCVillageHandler.class, identifier);
    if (data == null) {
        data = new NPCVillageHandler();
        storage.setData(identifier, data);
    }
    return data;
}
Also used : MapStorage(net.minecraft.world.storage.MapStorage)

Aggregations

MapStorage (net.minecraft.world.storage.MapStorage)45 ScoreboardSaveData (net.minecraft.scoreboard.ScoreboardSaveData)5 ServerScoreboard (net.minecraft.scoreboard.ServerScoreboard)5 VillageCollection (net.minecraft.village.VillageCollection)5 AdvancementManager (net.minecraft.advancements.AdvancementManager)2 FunctionManager (net.minecraft.advancements.FunctionManager)2 WorldServer (net.minecraft.world.WorldServer)2 MapData (net.minecraft.world.storage.MapData)2 WorldSavedData (net.minecraft.world.storage.WorldSavedData)2 LootTableManager (net.minecraft.world.storage.loot.LootTableManager)2 DummyWorld (com.cleanroommc.multiblocked.util.world.DummyWorld)1 File (java.io.File)1 LinkedList (java.util.LinkedList)1 Nonnull (javax.annotation.Nonnull)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 WorldSavedDataCallableSave (net.minecraft.world.storage.WorldSavedDataCallableSave)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 NetworkData (sonar.flux.network.NetworkData)1