Search in sources :

Example 41 with MapStorage

use of net.minecraft.world.storage.MapStorage in project Magma by magmafoundation.

the class CraftServer method getMap.

@Override
@Deprecated
public CraftMapView getMap(short id) {
    MapStorage collection = console.worlds[0].mapStorage;
    MapData worldmap = (MapData) collection.getOrLoadData(MapData.class, "map_" + id);
    if (worldmap == null) {
        return null;
    }
    return worldmap.mapView;
}
Also used : MapData(net.minecraft.world.storage.MapData) MapStorage(net.minecraft.world.storage.MapStorage)

Example 42 with MapStorage

use of net.minecraft.world.storage.MapStorage in project Multiblocked by CleanroomMC.

the class MultiblockWorldSavedData method getOrCreate.

public static MultiblockWorldSavedData getOrCreate(World world) {
    if (world == null || world instanceof DummyWorld) {
        return DUMMY;
    }
    MapStorage perWorldStorage = world.getPerWorldStorage();
    String name = getName(world);
    worldRef = new WeakReference<>(world);
    MultiblockWorldSavedData mbwsd = (MultiblockWorldSavedData) perWorldStorage.getOrLoadData(MultiblockWorldSavedData.class, name);
    worldRef = null;
    if (mbwsd == null) {
        perWorldStorage.setData(name, mbwsd = new MultiblockWorldSavedData(name));
    }
    return mbwsd;
}
Also used : DummyWorld(com.cleanroommc.multiblocked.util.world.DummyWorld) MapStorage(net.minecraft.world.storage.MapStorage)

Example 43 with MapStorage

use of net.minecraft.world.storage.MapStorage in project Crossroads by Crossroads-Development.

the class PlayerDimensionMapSavedData method get.

public static PlayerDimensionMapSavedData get(World world, @Nullable PlayerProfileCache playerCache) {
    cache = playerCache;
    MapStorage storage = world.getMapStorage();
    PlayerDimensionMapSavedData data = (PlayerDimensionMapSavedData) storage.getOrLoadData(PlayerDimensionMapSavedData.class, PLAYER_DIM_ID);
    if (data == null) {
        data = new PlayerDimensionMapSavedData();
        storage.setData(PLAYER_DIM_ID, data);
    }
    cache = null;
    return data;
}
Also used : MapStorage(net.minecraft.world.storage.MapStorage)

Example 44 with MapStorage

use of net.minecraft.world.storage.MapStorage in project CumServerPro by MCUmbrella.

the class CraftServer method getMap.

@Override
@Deprecated
public CraftMapView getMap(short id) {
    MapStorage collection = console.worlds[0].mapStorage;
    MapData worldmap = (MapData) collection.getOrLoadData(MapData.class, "map_" + id);
    if (worldmap == null) {
        return null;
    }
    return worldmap.mapView;
}
Also used : MapData(net.minecraft.world.storage.MapData) MapStorage(net.minecraft.world.storage.MapStorage)

Example 45 with MapStorage

use of net.minecraft.world.storage.MapStorage in project Flux-Networks by SonarSonic.

the class FluxEvents method onWorldSave.

@SubscribeEvent
public void onWorldSave(WorldEvent.Save event) {
    if (event.getWorld().isRemote) {
        return;
    }
    if (event.getWorld().provider.getDimension() == FluxNetworks.saveDimension) {
        MapStorage storage = event.getWorld().getPerWorldStorage();
        NetworkData data = (NetworkData) storage.getOrLoadData(NetworkData.class, NetworkData.tag);
        if (data == null && !FluxNetworks.getServerCache().getAllNetworks().isEmpty()) {
            storage.setData(NetworkData.tag, new NetworkData(NetworkData.tag));
        }
    }
}
Also used : MapStorage(net.minecraft.world.storage.MapStorage) NetworkData(sonar.flux.network.NetworkData) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

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