Search in sources :

Example 1 with WorldServerMulti

use of net.minecraft.world.WorldServerMulti in project MinecraftForge by MinecraftForge.

the class DimensionManager method initDimension.

public static void initDimension(int dim) {
    WorldServer overworld = getWorld(0);
    if (overworld == null) {
        throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!");
    }
    try {
        DimensionManager.getProviderType(dim);
    } catch (Exception e) {
        System.err.println("Cannot Hotload Dim: " + e.getMessage());
        // If a provider hasn't been registered then we can't hotload the dim
        return;
    }
    MinecraftServer mcServer = overworld.getMinecraftServer();
    ISaveHandler savehandler = overworld.getSaveHandler();
    //WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo());
    WorldServer world = (dim == 0 ? overworld : (WorldServer) (new WorldServerMulti(mcServer, savehandler, dim, overworld, mcServer.theProfiler).init()));
    world.addEventListener(new ServerWorldEventHandler(mcServer, world));
    MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
    if (!mcServer.isSinglePlayer()) {
        world.getWorldInfo().setGameType(mcServer.getGameType());
    }
    mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty());
}
Also used : ISaveHandler(net.minecraft.world.storage.ISaveHandler) WorldEvent(net.minecraftforge.event.world.WorldEvent) WorldServer(net.minecraft.world.WorldServer) ServerWorldEventHandler(net.minecraft.world.ServerWorldEventHandler) MinecraftException(net.minecraft.world.MinecraftException) WorldServerMulti(net.minecraft.world.WorldServerMulti) MinecraftServer(net.minecraft.server.MinecraftServer)

Aggregations

MinecraftServer (net.minecraft.server.MinecraftServer)1 MinecraftException (net.minecraft.world.MinecraftException)1 ServerWorldEventHandler (net.minecraft.world.ServerWorldEventHandler)1 WorldServer (net.minecraft.world.WorldServer)1 WorldServerMulti (net.minecraft.world.WorldServerMulti)1 ISaveHandler (net.minecraft.world.storage.ISaveHandler)1 WorldEvent (net.minecraftforge.event.world.WorldEvent)1