Search in sources :

Example 11 with MapStorage

use of net.minecraft.world.storage.MapStorage in project Railcraft by Railcraft.

the class TokenManager method getManager.

public static TokenWorldManager getManager(World world) {
    MapStorage storage = world.getPerWorldStorage();
    TokenWorldManager data = (TokenWorldManager) storage.getOrLoadData(TokenWorldManager.class, DATA_TAG);
    if (data == null) {
        data = new TokenWorldManager(DATA_TAG);
        storage.setData(DATA_TAG, data);
    }
    return data;
}
Also used : MapStorage(net.minecraft.world.storage.MapStorage)

Example 12 with MapStorage

use of net.minecraft.world.storage.MapStorage in project Railcraft by Railcraft.

the class ChargeSaveData method getFor.

public static ChargeSaveData getFor(Charge network, World world) {
    MapStorage storage = world.getPerWorldStorage();
    String dataIdentifier = NAME + network.name().toLowerCase();
    ChargeSaveData result = (ChargeSaveData) storage.getOrLoadData(ChargeSaveData.class, dataIdentifier);
    if (result == null) {
        result = new ChargeSaveData(dataIdentifier);
        storage.setData(dataIdentifier, result);
    }
    return result;
}
Also used : MapStorage(net.minecraft.world.storage.MapStorage)

Example 13 with MapStorage

use of net.minecraft.world.storage.MapStorage in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class WorldServer method init.

public World init() {
    this.mapStorage = new MapStorage(this.saveHandler);
    String s = VillageCollection.fileNameForProvider(this.provider);
    VillageCollection villagecollection = (VillageCollection) this.mapStorage.getOrLoadData(VillageCollection.class, s);
    if (villagecollection == null) {
        this.villageCollectionObj = new VillageCollection(this);
        this.mapStorage.setData(s, this.villageCollectionObj);
    } else {
        this.villageCollectionObj = villagecollection;
        this.villageCollectionObj.setWorldsForAll(this);
    }
    this.worldScoreboard = new ServerScoreboard(this.mcServer);
    ScoreboardSaveData scoreboardsavedata = (ScoreboardSaveData) this.mapStorage.getOrLoadData(ScoreboardSaveData.class, "scoreboard");
    if (scoreboardsavedata == null) {
        scoreboardsavedata = new ScoreboardSaveData();
        this.mapStorage.setData("scoreboard", scoreboardsavedata);
    }
    scoreboardsavedata.setScoreboard(this.worldScoreboard);
    ((ServerScoreboard) this.worldScoreboard).addDirtyRunnable(new WorldSavedDataCallableSave(scoreboardsavedata));
    this.lootTable = new LootTableManager(new File(new File(this.saveHandler.getWorldDirectory(), "data"), "loot_tables"));
    this.field_191951_C = new AdvancementManager(new File(new File(this.saveHandler.getWorldDirectory(), "data"), "advancements"));
    this.field_193036_D = new FunctionManager(new File(new File(this.saveHandler.getWorldDirectory(), "data"), "functions"), this.mcServer);
    this.getWorldBorder().setCenter(this.worldInfo.getBorderCenterX(), this.worldInfo.getBorderCenterZ());
    this.getWorldBorder().setDamageAmount(this.worldInfo.getBorderDamagePerBlock());
    this.getWorldBorder().setDamageBuffer(this.worldInfo.getBorderSafeZone());
    this.getWorldBorder().setWarningDistance(this.worldInfo.getBorderWarningDistance());
    this.getWorldBorder().setWarningTime(this.worldInfo.getBorderWarningTime());
    if (this.worldInfo.getBorderLerpTime() > 0L) {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize(), this.worldInfo.getBorderLerpTarget(), this.worldInfo.getBorderLerpTime());
    } else {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize());
    }
    return this;
}
Also used : ServerScoreboard(net.minecraft.scoreboard.ServerScoreboard) AdvancementManager(net.minecraft.advancements.AdvancementManager) WorldSavedDataCallableSave(net.minecraft.world.storage.WorldSavedDataCallableSave) LootTableManager(net.minecraft.world.storage.loot.LootTableManager) ScoreboardSaveData(net.minecraft.scoreboard.ScoreboardSaveData) VillageCollection(net.minecraft.village.VillageCollection) File(java.io.File) MapStorage(net.minecraft.world.storage.MapStorage) FunctionManager(net.minecraft.advancements.FunctionManager)

Example 14 with MapStorage

use of net.minecraft.world.storage.MapStorage in project WizClient-1.8.9-Version by WizClient.

the class WorldServer method init.

public World init() {
    this.mapStorage = new MapStorage(this.saveHandler);
    String s = VillageCollection.fileNameForProvider(this.provider);
    VillageCollection villagecollection = (VillageCollection) this.mapStorage.loadData(VillageCollection.class, s);
    if (villagecollection == null) {
        this.villageCollectionObj = new VillageCollection(this);
        this.mapStorage.setData(s, this.villageCollectionObj);
    } else {
        this.villageCollectionObj = villagecollection;
        this.villageCollectionObj.setWorldsForAll(this);
    }
    this.worldScoreboard = new ServerScoreboard(this.mcServer);
    ScoreboardSaveData scoreboardsavedata = (ScoreboardSaveData) this.mapStorage.loadData(ScoreboardSaveData.class, "scoreboard");
    if (scoreboardsavedata == null) {
        scoreboardsavedata = new ScoreboardSaveData();
        this.mapStorage.setData("scoreboard", scoreboardsavedata);
    }
    scoreboardsavedata.setScoreboard(this.worldScoreboard);
    ((ServerScoreboard) this.worldScoreboard).func_96547_a(scoreboardsavedata);
    this.getWorldBorder().setCenter(this.worldInfo.getBorderCenterX(), this.worldInfo.getBorderCenterZ());
    this.getWorldBorder().setDamageAmount(this.worldInfo.getBorderDamagePerBlock());
    this.getWorldBorder().setDamageBuffer(this.worldInfo.getBorderSafeZone());
    this.getWorldBorder().setWarningDistance(this.worldInfo.getBorderWarningDistance());
    this.getWorldBorder().setWarningTime(this.worldInfo.getBorderWarningTime());
    if (this.worldInfo.getBorderLerpTime() > 0L) {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize(), this.worldInfo.getBorderLerpTarget(), this.worldInfo.getBorderLerpTime());
    } else {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize());
    }
    return this;
}
Also used : ServerScoreboard(net.minecraft.scoreboard.ServerScoreboard) ScoreboardSaveData(net.minecraft.scoreboard.ScoreboardSaveData) VillageCollection(net.minecraft.village.VillageCollection) MapStorage(net.minecraft.world.storage.MapStorage)

Example 15 with MapStorage

use of net.minecraft.world.storage.MapStorage in project pnc-repressurized by TeamPneumatic.

the class HeatExtractionTracker method getInstance.

public static HeatExtractionTracker getInstance(World world) {
    MapStorage storage = world.getPerWorldStorage();
    HeatExtractionTracker tracker = (HeatExtractionTracker) storage.getOrLoadData(HeatExtractionTracker.class, DATA_NAME);
    if (tracker == null) {
        tracker = new HeatExtractionTracker();
        storage.setData(DATA_NAME, tracker);
    }
    return tracker;
}
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