Java 类net.minecraft.server.integrated.IntegratedServer 实例源码

项目:Cauldron    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            try
            {
                integratedserver.stopServer();
            }
            catch (MinecraftException e)
            {
                e.printStackTrace();
            }
        }
    }
}
项目:DecompiledMinecraft    文件:Minecraft.java   
public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.field_181038_N = gameConfig.userInfo.field_181172_c;
    this.mcDefaultResourcePack = new DefaultResourcePack((new ResourceIndex(gameConfig.folderInfo.assetsDir, gameConfig.folderInfo.assetIndex)).getResourceMap());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    logger.info("Setting user: " + this.session.getUsername());
    logger.info("(Session ID is " + this.session.getSessionID() + ")");
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = new IntegratedServer(this);

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
}
项目:DecompiledMinecraft    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            integratedserver.stopServer();
        }
    }
}
项目:BaseClient    文件:Minecraft.java   
public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.field_181038_N = gameConfig.userInfo.field_181172_c;
    this.mcDefaultResourcePack = new DefaultResourcePack((new ResourceIndex(gameConfig.folderInfo.assetsDir, gameConfig.folderInfo.assetIndex)).getResourceMap());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    logger.info("Setting user: " + this.session.getUsername());
    logger.info("(Session ID is " + this.session.getSessionID() + ")");
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = new IntegratedServer(this);

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
}
项目:BaseClient    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            integratedserver.stopServer();
        }
    }
}
项目:BaseClient    文件:Minecraft.java   
public Minecraft(GameConfiguration gameConfig) {
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.field_181038_N = gameConfig.userInfo.field_181172_c;
    this.mcDefaultResourcePack = new DefaultResourcePack(
            (new ResourceIndex(gameConfig.folderInfo.assetsDir, gameConfig.folderInfo.assetIndex))
                    .getResourceMap());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy,
            UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    logger.info("Setting user: " + this.session.getUsername());
    logger.info("(Session ID is " + this.session.getSessionID() + ")");
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = new IntegratedServer(this);

    if (gameConfig.serverInfo.serverName != null) {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
}
项目:BaseClient    文件:Minecraft.java   
public static void stopIntegratedServer() {
    if (theMinecraft != null) {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null) {
            integratedserver.stopServer();
        }
    }
}
项目:Zombe-Modpack    文件:Minecraft.java   
@Nullable

    /**
     * Returns the currently running integrated server
     */
    public IntegratedServer getIntegratedServer()
    {
        return this.theIntegratedServer;
    }
项目:Zombe-Modpack    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            integratedserver.stopServer();
        }
    }
}
项目:Backmemed    文件:Minecraft.java   
@Nullable

    /**
     * Returns the currently running integrated server
     */
    public IntegratedServer getIntegratedServer()
    {
        return this.theIntegratedServer;
    }
项目:Backmemed    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            integratedserver.stopServer();
        }
    }
}
项目:CustomWorldGen    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            integratedserver.stopServer();
        }
    }
}
项目:Toms-Mod    文件:Utils.java   
public static String getWorldName() {
    String worldName;

    if (Minecraft.getMinecraft().isIntegratedServerRunning()) {
        // cannot use this.mc.theWorld.getWorldInfo().getWorldName() as it
        // is set statically to "MpServer".
        IntegratedServer server = Minecraft.getMinecraft().getIntegratedServer();
        worldName = (server != null) ? server.getFolderName() : "sp_world";
    } else if (Minecraft.getMinecraft().isConnectedToRealms()) {
        if (RealmsWorldName != "") {
            worldName = RealmsWorldName;
        } else {
            worldName = "Realms";
        }
    } else {
        worldName = Minecraft.getMinecraft().getCurrentServerData().serverIP;
        if (!Config.portNumberInWorldNameEnabled) {
            worldName = worldName.substring(0, worldName.indexOf(":"));
        } else {
            if (worldName.indexOf(":") == -1) {// standard port is missing.
                                                // Adding it
                worldName += "_25565";
            } else {
                worldName = worldName.replace(":", "_");
            }
        }
    }

    // strip invalid characters from the server name so that it
    // can't be something malicious like '..\..\..\windows\'
    worldName = mungeString(worldName);

    // if something went wrong make sure the name is not blank
    // (causes crash on start up due to empty configuration section)
    if (worldName == "") {
        worldName = "default";
    }
    return worldName;
}
项目:Factorization    文件:MiscellaneousNonsense.java   
@SubscribeEvent
public void serverTick(TickEvent.ServerTickEvent event) {
    if (event.phase == Phase.END) return;
    if (!enabled) return;
    IntegratedServer is = Minecraft.getMinecraft().getIntegratedServer();
    if (is != null) {
        if (is.isServerStopped()) return;
        if (!is.isServerRunning()) return;
    }
    if (pokeValue % 5 != 0 && !isPlayerInDanger(mc.thePlayer)) return;

    if (pokeValue != serversLastSeenPoke) {
        serversLastSeenPoke = pokeValue;
        return;
    }

    synchronized (this) {
        long originalPoke = pokeValue;
        long maxWaitTime = 1000*1;
        do {
            try {
                this.wait(maxWaitTime);
            } catch (InterruptedException e) {
                return;
            }
        } while (originalPoke == pokeValue);
    }
    serversLastSeenPoke = pokeValue;
}
项目:morecommands    文件:PatchEntityPlayerMP.java   
@Override
public <T extends FMLStateEvent> boolean applyStateEventPatch(T e) {
    FMLServerAboutToStartEvent event = (FMLServerAboutToStartEvent) e;

    try {
        Constructor<PlayerList> ctor;

        if (event.getServer().isDedicatedServer())
            ctor = (Constructor<PlayerList>) (Constructor<?>) DedicatedPlayerList.class.getDeclaredConstructor(DedicatedServer.class);
        else
            ctor = (Constructor<PlayerList>) (Constructor<?>) IntegratedPlayerList.class.getDeclaredConstructor(IntegratedServer.class);

        ctor.setAccessible(true);

        if (event.getServer().isDedicatedServer())
            event.getServer().setPlayerList(ctor.newInstance((DedicatedServer) event.getServer()));
        else
            event.getServer().setPlayerList(ctor.newInstance((IntegratedServer) event.getServer()));

        PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, true);
        return true;
    }
    catch (Exception ex) {
        PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false);
        return false;
    }
}
项目:Resilience-Client-Source    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer var0 = theMinecraft.getIntegratedServer();

        if (var0 != null)
        {
            var0.stopServer();
        }
    }
}
项目:Resilience-Client-Source    文件:Config.java   
public static WorldServer getWorldServer()
{
    if (minecraft == null)
    {
        return null;
    }
    else
    {
        WorldClient world = minecraft.theWorld;

        if (world == null)
        {
            return null;
        }
        else
        {
            IntegratedServer is = minecraft.getIntegratedServer();

            if (is == null)
            {
                return null;
            }
            else
            {
                WorldProvider wp = world.provider;

                if (wp == null)
                {
                    return null;
                }
                else
                {
                    int wd = wp.dimensionId;
                    WorldServer ws = is.worldServerForDimension(wd);
                    return ws;
                }
            }
        }
    }
}
项目:ExpandedRailsMod    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            integratedserver.stopServer();
        }
    }
}
项目:Cauldron    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            integratedserver.stopServer();
        }
    }
}
项目:RuneCraftery    文件:Minecraft.java   
public static void func_71363_D() {
   if(field_71432_P != null) {
      IntegratedServer var0 = field_71432_P.func_71401_C();
      if(var0 != null) {
         var0.func_71260_j();
      }

   }
}
项目:RuneCraftery    文件:NetClientHandler.java   
public NetClientHandler(Minecraft par1Minecraft, IntegratedServer par2IntegratedServer) throws IOException
{
    this.mc = par1Minecraft;
    this.netManager = new MemoryConnection(par1Minecraft.getLogAgent(), this);
    par2IntegratedServer.getServerListeningThread().func_71754_a((MemoryConnection)this.netManager, par1Minecraft.getSession().getUsername());
    FMLNetworkHandler.onClientConnectionToIntegratedServer(this, par2IntegratedServer, this.netManager);
}
项目:RuneCraftery    文件:Minecraft.java   
/**
 * Arguments: World foldername,  World ingame name, WorldSettings
 */
public void launchIntegratedServer(String par1Str, String par2Str, WorldSettings par3WorldSettings)
{
    this.loadWorld((WorldClient)null);
    System.gc();
    ISaveHandler isavehandler = this.saveLoader.getSaveLoader(par1Str, false);
    WorldInfo worldinfo = isavehandler.loadWorldInfo();

    if (worldinfo == null && par3WorldSettings != null)
    {
        worldinfo = new WorldInfo(par3WorldSettings, par1Str);
        isavehandler.saveWorldInfo(worldinfo);
    }

    if (par3WorldSettings == null)
    {
        par3WorldSettings = new WorldSettings(worldinfo);
    }

    this.statFileWriter.readStat(StatList.startGameStat, 1);

    GameData.initializeServerGate(2);

    this.theIntegratedServer = new IntegratedServer(this, par1Str, par2Str, par3WorldSettings);
    this.theIntegratedServer.startServerThread();

    MapDifference<Integer, ItemData> idDifferences = GameData.gateWorldLoadingForValidation();
    if (idDifferences!=null)
    {
        FMLClientHandler.instance().warnIDMismatch(idDifferences, true);
    }
    else
    {
        GameData.releaseGate(true);
        continueWorldLoading();
    }

}
项目:RuneCraftery    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            integratedserver.stopServer();
        }
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
public NetClientHandler(Minecraft par1Minecraft, IntegratedServer par2IntegratedServer) throws IOException
{
    this.mc = par1Minecraft;
    this.netManager = new MemoryConnection(par1Minecraft.getLogAgent(), this);
    par2IntegratedServer.getServerListeningThread().func_71754_a((MemoryConnection)this.netManager, par1Minecraft.getSession().getUsername());
    FMLNetworkHandler.onClientConnectionToIntegratedServer(this, par2IntegratedServer, this.netManager);
}
项目:BetterNutritionMod    文件:Minecraft.java   
/**
 * Arguments: World foldername,  World ingame name, WorldSettings
 */
public void launchIntegratedServer(String par1Str, String par2Str, WorldSettings par3WorldSettings)
{
    this.loadWorld((WorldClient)null);
    System.gc();
    ISaveHandler isavehandler = this.saveLoader.getSaveLoader(par1Str, false);
    WorldInfo worldinfo = isavehandler.loadWorldInfo();

    if (worldinfo == null && par3WorldSettings != null)
    {
        worldinfo = new WorldInfo(par3WorldSettings, par1Str);
        isavehandler.saveWorldInfo(worldinfo);
    }

    if (par3WorldSettings == null)
    {
        par3WorldSettings = new WorldSettings(worldinfo);
    }

    this.statFileWriter.readStat(StatList.startGameStat, 1);

    GameData.initializeServerGate(2);

    this.theIntegratedServer = new IntegratedServer(this, par1Str, par2Str, par3WorldSettings);
    this.theIntegratedServer.startServerThread();

    MapDifference<Integer, ItemData> idDifferences = GameData.gateWorldLoadingForValidation();
    if (idDifferences!=null)
    {
        FMLClientHandler.instance().warnIDMismatch(idDifferences, true);
    }
    else
    {
        GameData.releaseGate(true);
        continueWorldLoading();
    }

}
项目:BetterNutritionMod    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            integratedserver.stopServer();
        }
    }
}
项目:DecompiledMinecraft    文件:Minecraft.java   
/**
 * Returns the currently running integrated server
 */
public IntegratedServer getIntegratedServer()
{
    return this.theIntegratedServer;
}
项目:BaseClient    文件:Config.java   
public static WorldServer getWorldServer()
{
    if (minecraft == null)
    {
        return null;
    }
    else
    {
        World world = minecraft.theWorld;

        if (world == null)
        {
            return null;
        }
        else if (!minecraft.isIntegratedServerRunning())
        {
            return null;
        }
        else
        {
            IntegratedServer integratedserver = minecraft.getIntegratedServer();

            if (integratedserver == null)
            {
                return null;
            }
            else
            {
                WorldProvider worldprovider = world.provider;

                if (worldprovider == null)
                {
                    return null;
                }
                else
                {
                    int i = worldprovider.getDimensionId();

                    try
                    {
                        WorldServer worldserver = integratedserver.worldServerForDimension(i);
                        return worldserver;
                    }
                    catch (NullPointerException var5)
                    {
                        return null;
                    }
                }
            }
        }
    }
}
项目:BaseClient    文件:Minecraft.java   
/**
 * Returns the currently running integrated server
 */
public IntegratedServer getIntegratedServer()
{
    return this.theIntegratedServer;
}
项目:BaseClient    文件:Config.java   
public static WorldServer getWorldServer()
{
    if (minecraft == null)
    {
        return null;
    }
    else
    {
        World world = minecraft.theWorld;

        if (world == null)
        {
            return null;
        }
        else if (!minecraft.isIntegratedServerRunning())
        {
            return null;
        }
        else
        {
            IntegratedServer integratedserver = minecraft.getIntegratedServer();

            if (integratedserver == null)
            {
                return null;
            }
            else
            {
                WorldProvider worldprovider = world.provider;

                if (worldprovider == null)
                {
                    return null;
                }
                else
                {
                    int i = worldprovider.getDimensionId();

                    try
                    {
                        WorldServer worldserver = integratedserver.worldServerForDimension(i);
                        return worldserver;
                    }
                    catch (NullPointerException var5)
                    {
                        return null;
                    }
                }
            }
        }
    }
}
项目:BaseClient    文件:EntityRenderer.java   
private void waitForServerThread() {
    this.serverWaitTimeCurrent = 0;

    if (Config.isSmoothWorld() && Config.isSingleProcessor()) {
        if (this.mc.isIntegratedServerRunning()) {
            IntegratedServer integratedserver = this.mc.getIntegratedServer();

            if (integratedserver != null) {
                boolean flag = this.mc.isGamePaused();

                if (!flag && !(this.mc.currentScreen instanceof GuiDownloadTerrain)) {
                    if (this.serverWaitTime > 0) {
                        Lagometer.timerServer.start();
                        Config.sleep((long) this.serverWaitTime);
                        Lagometer.timerServer.end();
                        this.serverWaitTimeCurrent = this.serverWaitTime;
                    }

                    long i = System.nanoTime() / 1000000L;

                    if (this.lastServerTime != 0L && this.lastServerTicks != 0) {
                        long j = i - this.lastServerTime;

                        if (j < 0L) {
                            this.lastServerTime = i;
                            j = 0L;
                        }

                        if (j >= 50L) {
                            this.lastServerTime = i;
                            int k = integratedserver.getTickCounter();
                            int l = k - this.lastServerTicks;

                            if (l < 0) {
                                this.lastServerTicks = k;
                                l = 0;
                            }

                            if (l < 1 && this.serverWaitTime < 100) {
                                this.serverWaitTime += 2;
                            }

                            if (l > 1 && this.serverWaitTime > 0) {
                                --this.serverWaitTime;
                            }

                            this.lastServerTicks = k;
                        }
                    } else {
                        this.lastServerTime = i;
                        this.lastServerTicks = integratedserver.getTickCounter();
                        this.avgServerTickDiff = 1.0F;
                        this.avgServerTimeDiff = 50.0F;
                    }
                } else {
                    if (this.mc.currentScreen instanceof GuiDownloadTerrain) {
                        Config.sleep(20L);
                    }

                    this.lastServerTime = 0L;
                    this.lastServerTicks = 0;
                }
            }
        }
    } else {
        this.lastServerTime = 0L;
        this.lastServerTicks = 0;
    }
}
项目:BaseClient    文件:Minecraft.java   
/**
 * Returns the currently running integrated server
 */
public IntegratedServer getIntegratedServer() {
    return this.theIntegratedServer;
}
项目:Proyecto-DASI    文件:FileWorldGeneratorImplementation.java   
@Override
public boolean createWorld(MissionInit missionInit)
{
    if (this.mapFilename == null || this.mapFilename.length() == 0)
    {
        this.errorDetails = "No basemap URI provided - check your Mission XML.";
        return false;
    }
    File mapSource = new File(this.mapFilename);
    if (!mapSource.exists())
    {
        this.errorDetails = "Basemap file " + this.mapFilename + " was not found - check your Mission XML and ensure the file exists on the Minecraft client machine.";
        return false;
    }
    if (!mapSource.isDirectory())
    {
        this.errorDetails = "Basemap location " + this.mapFilename + " needs to be a folder. Check the path in your Mission XML.";
        return false;
    }
    File mapCopy = MapFileHelper.copyMapFiles(mapSource, this.fwparams.isDestroyAfterUse());
    if (mapCopy == null)
    {
        this.errorDetails = "Unable to copy " + this.mapFilename + " - is the hard drive full?";
        return false;
    }
    if (!Minecraft.getMinecraft().getSaveLoader().canLoadWorld(mapCopy.getName()))
    {
        this.errorDetails = "Minecraft is unable to load " + this.mapFilename + " - is it a valid saved world?";
        return false;
    }

    net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(null, mapCopy.getName(), mapSource.getName());
    IntegratedServer server = Minecraft.getMinecraft().getIntegratedServer();
    String worldName = (server != null) ? server.getWorldName() : null;
    if (worldName == null || !worldName.equals(mapSource.getName()))
    {
        this.errorDetails = "Minecraft could not load " + this.mapFilename + " - is it a valid saved world?";
        return false;
    }
    MapFileHelper.cleanupTemporaryWorlds(mapCopy.getName());    // Now we are safely running a new file, we can attempt to clean up old ones.
    return true;
}
项目:Proyecto-DASI    文件:FileWorldGeneratorImplementation.java   
@Override
public boolean createWorld(MissionInit missionInit)
{
    if (this.mapFilename == null || this.mapFilename.length() == 0)
    {
        this.errorDetails = "No basemap URI provided - check your Mission XML.";
        return false;
    }
    File mapSource = new File(this.mapFilename);
    if (!mapSource.exists())
    {
        this.errorDetails = "Basemap file " + this.mapFilename + " was not found - check your Mission XML and ensure the file exists on the Minecraft client machine.";
        return false;
    }
    if (!mapSource.isDirectory())
    {
        this.errorDetails = "Basemap location " + this.mapFilename + " needs to be a folder. Check the path in your Mission XML.";
        return false;
    }
    File mapCopy = MapFileHelper.copyMapFiles(mapSource, this.fwparams.isDestroyAfterUse());
    if (mapCopy == null)
    {
        this.errorDetails = "Unable to copy " + this.mapFilename + " - is the hard drive full?";
        return false;
    }
    if (!Minecraft.getMinecraft().getSaveLoader().canLoadWorld(mapCopy.getName()))
    {
        this.errorDetails = "Minecraft is unable to load " + this.mapFilename + " - is it a valid saved world?";
        return false;
    }

    net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(null, mapCopy.getName(), mapSource.getName());
    IntegratedServer server = Minecraft.getMinecraft().getIntegratedServer();
    String worldName = (server != null) ? server.getWorldName() : null;
    if (worldName == null || !worldName.equals(mapSource.getName()))
    {
        this.errorDetails = "Minecraft could not load " + this.mapFilename + " - is it a valid saved world?";
        return false;
    }
    MapFileHelper.cleanupTemporaryWorlds(mapCopy.getName());    // Now we are safely running a new file, we can attempt to clean up old ones.
    return true;
}
项目:Backmemed    文件:Config.java   
public static WorldServer getWorldServer()
{
    World world = minecraft.world;

    if (world == null)
    {
        return null;
    }
    else if (!minecraft.isIntegratedServerRunning())
    {
        return null;
    }
    else
    {
        IntegratedServer integratedserver = minecraft.getIntegratedServer();

        if (integratedserver == null)
        {
            return null;
        }
        else
        {
            WorldProvider worldprovider = world.provider;

            if (worldprovider == null)
            {
                return null;
            }
            else
            {
                DimensionType dimensiontype = worldprovider.getDimensionType();

                try
                {
                    WorldServer worldserver = integratedserver.worldServerForDimension(dimensiontype.getId());
                    return worldserver;
                }
                catch (NullPointerException var5)
                {
                    return null;
                }
            }
        }
    }
}
项目:CustomWorldGen    文件:Minecraft.java   
/**
 * Returns the currently running integrated server
 */
@Nullable
public IntegratedServer getIntegratedServer()
{
    return this.theIntegratedServer;
}
项目:malmo    文件:FileWorldGeneratorImplementation.java   
@Override
public boolean createWorld(MissionInit missionInit)
{
    if (this.mapFilename == null || this.mapFilename.length() == 0)
    {
        this.errorDetails = "No basemap URI provided - check your Mission XML.";
        return false;
    }
    File mapSource = new File(this.mapFilename);
    if (!mapSource.exists())
    {
        this.errorDetails = "Basemap file " + this.mapFilename + " was not found - check your Mission XML and ensure the file exists on the Minecraft client machine.";
        return false;
    }
    if (!mapSource.isDirectory())
    {
        this.errorDetails = "Basemap location " + this.mapFilename + " needs to be a folder. Check the path in your Mission XML.";
        return false;
    }
    File mapCopy = MapFileHelper.copyMapFiles(mapSource, this.fwparams.isDestroyAfterUse());
    if (mapCopy == null)
    {
        this.errorDetails = "Unable to copy " + this.mapFilename + " - is the hard drive full?";
        return false;
    }
    if (!Minecraft.getMinecraft().getSaveLoader().canLoadWorld(mapCopy.getName()))
    {
        this.errorDetails = "Minecraft is unable to load " + this.mapFilename + " - is it a valid saved world?";
        return false;
    }

    ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader();
    List<WorldSummary> worldlist;
    try
    {
        worldlist = isaveformat.getSaveList();
    }
    catch (AnvilConverterException anvilconverterexception)
    {
        this.errorDetails = "Minecraft couldn't rebuild saved world list.";
        return false;
    }

    WorldSummary newWorld = null;
    for (WorldSummary ws : worldlist)
    {
        if (ws.getFileName().equals(mapCopy.getName()))
            newWorld = ws;
    }
    if (newWorld == null)
    {
        this.errorDetails = "Minecraft could not find the copied world.";
        return false;
    }

    net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(null, newWorld);
    IntegratedServer server = Minecraft.getMinecraft().getIntegratedServer();
    String worldName = (server != null) ? server.getWorldName() : null;
    if (worldName == null || !worldName.equals(newWorld.getDisplayName()))
    {
        this.errorDetails = "Minecraft could not load " + this.mapFilename + " - is it a valid saved world?";
        return false;
    }
    MapFileHelper.cleanupTemporaryWorlds(mapCopy.getName());    // Now we are safely running a new file, we can attempt to clean up old ones.
    return true;
}
项目:morecommands    文件:PatchEntityPlayerMP.java   
IntegratedPlayerList(IntegratedServer server) {
    super(server);
}
项目:morecommands    文件:CommandSudo.java   
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
    if (params.length > 1 && sender.getServer() instanceof IntegratedServer && 
                            ((IntegratedServer) sender.getServer()).getPublic()) {
        EntityPlayer player = null;
        Object playerEntity;
        Iterator players = sender.getServer().getPlayerList().getPlayers().iterator();

        while (players.hasNext()) {
            playerEntity = players.next();

            if (playerEntity instanceof EntityPlayer) {
                if (((EntityPlayer) playerEntity).getName().equalsIgnoreCase(params[0])) {
                    player = (EntityPlayer) playerEntity;
                    break;
                }
            }
        }

        if (player == null) throw new CommandException("command.sudo.playerNotFound", sender);

        ICommandManager manager = sender.getServer().getCommandManager();
        String command = params[1];
        String parameters = "";

        if (params.length > 2) {
            int index = 0;

            for (String param : params) {
                if (index > 1) {parameters += " " + param;}
                index++;
            }
        }

        manager.executeCommand((new CommandSender(player)).getMinecraftISender(), command + parameters);
        sender.sendLangfileMessage("command.sudo.executed", command + parameters, player.getName());
    }
    else if (!(sender.getServer() instanceof IntegratedServer)) throw new CommandException("command.sudo.notInLAN", sender);
    else if (!((IntegratedServer) sender.getServer()).getPublic()) throw new CommandException("command.sudo.notInLAN", sender);
    else throw new CommandException("command.sudo.invalidArgs", sender);

    return null;
}
项目:Resilience-Client-Source    文件:EntityRenderer.java   
private void waitForServerThread()
{
    this.serverWaitTimeCurrent = 0;

    if (!Config.isSmoothWorld())
    {
        this.lastServerTime = 0L;
        this.lastServerTicks = 0;
    }
    else if (this.mc.getIntegratedServer() != null)
    {
        IntegratedServer srv = this.mc.getIntegratedServer();
        boolean paused = this.mc.func_147113_T();

        if (!paused && !(this.mc.currentScreen instanceof GuiDownloadTerrain))
        {
            if (this.serverWaitTime > 0)
            {
                Config.sleep((long)this.serverWaitTime);
                this.serverWaitTimeCurrent = this.serverWaitTime;
            }

            long timeNow = System.nanoTime() / 1000000L;

            if (this.lastServerTime != 0L && this.lastServerTicks != 0)
            {
                long timeDiff = timeNow - this.lastServerTime;

                if (timeDiff < 0L)
                {
                    this.lastServerTime = timeNow;
                    timeDiff = 0L;
                }

                if (timeDiff >= 50L)
                {
                    this.lastServerTime = timeNow;
                    int ticks = srv.getTickCounter();
                    int tickDiff = ticks - this.lastServerTicks;

                    if (tickDiff < 0)
                    {
                        this.lastServerTicks = ticks;
                        tickDiff = 0;
                    }

                    if (tickDiff < 1 && this.serverWaitTime < 100)
                    {
                        this.serverWaitTime += 2;
                    }

                    if (tickDiff > 1 && this.serverWaitTime > 0)
                    {
                        --this.serverWaitTime;
                    }

                    this.lastServerTicks = ticks;
                }
            }
            else
            {
                this.lastServerTime = timeNow;
                this.lastServerTicks = srv.getTickCounter();
                this.avgServerTickDiff = 1.0F;
                this.avgServerTimeDiff = 50.0F;
            }
        }
        else
        {
            if (this.mc.currentScreen instanceof GuiDownloadTerrain)
            {
                Config.sleep(20L);
            }

            this.lastServerTime = 0L;
            this.lastServerTicks = 0;
        }
    }
}