java类net.minecraft.world.storage.WorldInfo的实例源码

GuiCreateWorld.java 文件源码 项目:CustomWorldGen 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Set the initial values of a new world to create, from the values from an existing world.
 *  
 * Called after construction when a user selects the "Recreate" button.
 */
public void recreateFromExistingWorld(WorldInfo original)
{
    this.worldName = I18n.format("selectWorld.newWorld.copyOf", new Object[] {original.getWorldName()});
    this.worldSeed = original.getSeed() + "";
    this.selectedIndex = original.getTerrainType().getWorldTypeID();
    this.chunkProviderSettingsJson = original.getGeneratorOptions();
    this.generateStructuresEnabled = original.isMapFeaturesEnabled();
    this.allowCheats = original.areCommandsAllowed();

    if (original.isHardcoreModeEnabled())
    {
        this.gameMode = "hardcore";
    }
    else if (original.getGameType().isSurvivalOrAdventure())
    {
        this.gameMode = "survival";
    }
    else if (original.getGameType().isCreative())
    {
        this.gameMode = "creative";
    }
}
WorldServer.java 文件源码 项目:CustomWorldGen 阅读 22 收藏 0 点赞 0 评论 0
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
    super(saveHandlerIn, info, net.minecraftforge.common.DimensionManager.createProviderFor(dimensionId), profilerIn, false);
    this.mcServer = server;
    this.theEntityTracker = new EntityTracker(this);
    this.thePlayerManager = new PlayerChunkMap(this);
    // Guarantee the dimension ID was not reset by the provider
    int providerDim = this.provider.getDimension();
    this.provider.registerWorld(this);
    this.provider.setDimension(providerDim);
    this.chunkProvider = this.createChunkProvider();
    perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn));
    this.worldTeleporter = new Teleporter(this);
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.getWorldBorder().setSize(server.getMaxWorldSize());
    net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this, mcServer);
}
GuiWorldEdit.java 文件源码 项目:CustomWorldGen 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    GuiButton guibutton = this.addButton(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 24 + 12, I18n.format("selectWorld.edit.resetIcon", new Object[0])));
    this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 48 + 12, I18n.format("selectWorld.edit.openFolder", new Object[0])));
    this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.edit.save", new Object[0])));
    this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0])));
    guibutton.enabled = this.mc.getSaveLoader().getFile(this.worldId, "icon.png").isFile();
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    WorldInfo worldinfo = isaveformat.getWorldInfo(this.worldId);
    String s = worldinfo.getWorldName();
    this.nameEdit = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20);
    this.nameEdit.setFocused(true);
    this.nameEdit.setText(s);
}
GuiCreateWorld.java 文件源码 项目:DecompiledMinecraft 阅读 28 收藏 0 点赞 0 评论 0
public void func_146318_a(WorldInfo p_146318_1_)
{
    this.field_146330_J = I18n.format("selectWorld.newWorld.copyOf", new Object[] {p_146318_1_.getWorldName()});
    this.field_146329_I = p_146318_1_.getSeed() + "";
    this.selectedIndex = p_146318_1_.getTerrainType().getWorldTypeID();
    this.chunkProviderSettingsJson = p_146318_1_.getGeneratorOptions();
    this.field_146341_s = p_146318_1_.isMapFeaturesEnabled();
    this.allowCheats = p_146318_1_.areCommandsAllowed();

    if (p_146318_1_.isHardcoreModeEnabled())
    {
        this.gameMode = "hardcore";
    }
    else if (p_146318_1_.getGameType().isSurvivalOrAdventure())
    {
        this.gameMode = "survival";
    }
    else if (p_146318_1_.getGameType().isCreative())
    {
        this.gameMode = "creative";
    }
}
WorldClient.java 文件源码 项目:CustomWorldGen 阅读 18 收藏 0 点赞 0 评论 0
public WorldClient(NetHandlerPlayClient netHandler, WorldSettings settings, int dimension, EnumDifficulty difficulty, Profiler profilerIn)
{
    super(new SaveHandlerMP(), new WorldInfo(settings, "MpServer"), net.minecraftforge.common.DimensionManager.createProviderFor(dimension), profilerIn, true);
    this.ambienceTicks = this.rand.nextInt(12000);
    this.viewableChunks = Sets.<ChunkPos>newHashSet();
    this.connection = netHandler;
    this.getWorldInfo().setDifficulty(difficulty);
    this.provider.registerWorld(this);
    this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect.
    this.chunkProvider = this.createChunkProvider();
    this.mapStorage = new SaveDataMemoryStorage();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.initCapabilities();
    net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this));
}
GuiCreateWorld.java 文件源码 项目:BaseClient 阅读 25 收藏 0 点赞 0 评论 0
public void func_146318_a(WorldInfo p_146318_1_)
{
    this.field_146330_J = I18n.format("selectWorld.newWorld.copyOf", new Object[] {p_146318_1_.getWorldName()});
    this.field_146329_I = p_146318_1_.getSeed() + "";
    this.selectedIndex = p_146318_1_.getTerrainType().getWorldTypeID();
    this.chunkProviderSettingsJson = p_146318_1_.getGeneratorOptions();
    this.field_146341_s = p_146318_1_.isMapFeaturesEnabled();
    this.allowCheats = p_146318_1_.areCommandsAllowed();

    if (p_146318_1_.isHardcoreModeEnabled())
    {
        this.gameMode = "hardcore";
    }
    else if (p_146318_1_.getGameType().isSurvivalOrAdventure())
    {
        this.gameMode = "survival";
    }
    else if (p_146318_1_.getGameType().isCreative())
    {
        this.gameMode = "creative";
    }
}
GuiCreateWorld.java 文件源码 项目:BaseClient 阅读 24 收藏 0 点赞 0 评论 0
public void func_146318_a(WorldInfo p_146318_1_)
{
    this.field_146330_J = I18n.format("selectWorld.newWorld.copyOf", new Object[] {p_146318_1_.getWorldName()});
    this.field_146329_I = p_146318_1_.getSeed() + "";
    this.selectedIndex = p_146318_1_.getTerrainType().getWorldTypeID();
    this.chunkProviderSettingsJson = p_146318_1_.getGeneratorOptions();
    this.field_146341_s = p_146318_1_.isMapFeaturesEnabled();
    this.allowCheats = p_146318_1_.areCommandsAllowed();

    if (p_146318_1_.isHardcoreModeEnabled())
    {
        this.gameMode = "hardcore";
    }
    else if (p_146318_1_.getGameType().isSurvivalOrAdventure())
    {
        this.gameMode = "survival";
    }
    else if (p_146318_1_.getGameType().isCreative())
    {
        this.gameMode = "creative";
    }
}
EnvironmentHelper.java 文件源码 项目:Proyecto-DASI 阅读 22 收藏 0 点赞 0 评论 0
public static void setMissionWeather(MissionInit minit)
{
    ServerSection ss = minit.getMission().getServerSection();
    ServerInitialConditions sic = (ss != null) ? ss.getServerInitialConditions() : null;
    if (sic != null && sic.getWeather() != null && !sic.getWeather().equalsIgnoreCase("normal"))
    {
        int maxtime = 1000000 * 20; // Max allowed by Minecraft's own Weather Command.
        int cleartime = (sic.getWeather().equalsIgnoreCase("clear")) ? maxtime : 0;
        int raintime = (sic.getWeather().equalsIgnoreCase("rain")) ? maxtime : 0;
        int thundertime = (sic.getWeather().equalsIgnoreCase("thunder")) ? maxtime : 0;

        WorldServer worldserver = MinecraftServer.getServer().worldServers[0];
        WorldInfo worldinfo = worldserver.getWorldInfo();

        worldinfo.setCleanWeatherTime(cleartime);
        worldinfo.setRainTime(raintime);
        worldinfo.setThunderTime(thundertime);
        worldinfo.setRaining(raintime + thundertime > 0);
        worldinfo.setThundering(thundertime > 0);
    }
}
EnvironmentHelper.java 文件源码 项目:Proyecto-DASI 阅读 25 收藏 0 点赞 0 评论 0
public static void setMissionWeather(MissionInit minit)
{
    ServerSection ss = minit.getMission().getServerSection();
    ServerInitialConditions sic = (ss != null) ? ss.getServerInitialConditions() : null;
    if (sic != null && sic.getWeather() != null && !sic.getWeather().equalsIgnoreCase("normal"))
    {
        int maxtime = 1000000 * 20; // Max allowed by Minecraft's own Weather Command.
        int cleartime = (sic.getWeather().equalsIgnoreCase("clear")) ? maxtime : 0;
        int raintime = (sic.getWeather().equalsIgnoreCase("rain")) ? maxtime : 0;
        int thundertime = (sic.getWeather().equalsIgnoreCase("thunder")) ? maxtime : 0;

        WorldServer worldserver = MinecraftServer.getServer().worldServers[0];
        WorldInfo worldinfo = worldserver.getWorldInfo();

        worldinfo.setCleanWeatherTime(cleartime);
        worldinfo.setRainTime(raintime);
        worldinfo.setThunderTime(thundertime);
        worldinfo.setRaining(raintime + thundertime > 0);
        worldinfo.setThundering(thundertime > 0);
    }
}
WorldClient.java 文件源码 项目:Backmemed 阅读 19 收藏 0 点赞 0 评论 0
public WorldClient(NetHandlerPlayClient netHandler, WorldSettings settings, int dimension, EnumDifficulty difficulty, Profiler profilerIn)
{
    super(new SaveHandlerMP(), new WorldInfo(settings, "MpServer"), makeWorldProvider(dimension), profilerIn, true);
    this.ambienceTicks = this.rand.nextInt(12000);
    this.viewableChunks = Sets.<ChunkPos>newHashSet();
    this.connection = netHandler;
    this.getWorldInfo().setDifficulty(difficulty);
    this.provider.registerWorld(this);
    this.setSpawnPoint(new BlockPos(8, 64, 8));
    this.chunkProvider = this.createChunkProvider();
    this.mapStorage = new SaveDataMemoryStorage();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    Reflector.call(this, Reflector.ForgeWorld_initCapabilities, new Object[0]);
    Reflector.postForgeBusEvent(Reflector.WorldEvent_Load_Constructor, new Object[] {this});

    if (this.mc.playerController != null && this.mc.playerController.getClass() == PlayerControllerMP.class)
    {
        this.mc.playerController = new PlayerControllerOF(this.mc, netHandler);
    }
}
GuiCreateWorld.java 文件源码 项目:Backmemed 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Set the initial values of a new world to create, from the values from an existing world.
 *  
 * Called after construction when a user selects the "Recreate" button.
 */
public void recreateFromExistingWorld(WorldInfo original)
{
    this.worldName = I18n.format("selectWorld.newWorld.copyOf", new Object[] {original.getWorldName()});
    this.worldSeed = original.getSeed() + "";
    this.selectedIndex = original.getTerrainType().getWorldTypeID();
    this.chunkProviderSettingsJson = original.getGeneratorOptions();
    this.generateStructuresEnabled = original.isMapFeaturesEnabled();
    this.allowCheats = original.areCommandsAllowed();

    if (original.isHardcoreModeEnabled())
    {
        this.gameMode = "hardcore";
    }
    else if (original.getGameType().isSurvivalOrAdventure())
    {
        this.gameMode = "survival";
    }
    else if (original.getGameType().isCreative())
    {
        this.gameMode = "creative";
    }
}
GuiWorldEdit.java 文件源码 项目:Backmemed 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    GuiButton guibutton = this.addButton(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 24 + 12, I18n.format("selectWorld.edit.resetIcon", new Object[0])));
    this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 48 + 12, I18n.format("selectWorld.edit.openFolder", new Object[0])));
    this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.edit.save", new Object[0])));
    this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0])));
    guibutton.enabled = this.mc.getSaveLoader().getFile(this.worldId, "icon.png").isFile();
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    WorldInfo worldinfo = isaveformat.getWorldInfo(this.worldId);
    String s = worldinfo == null ? "" : worldinfo.getWorldName();
    this.nameEdit = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20);
    this.nameEdit.setFocused(true);
    this.nameEdit.setText(s);
}
World.java 文件源码 项目:DecompiledMinecraft 阅读 18 收藏 0 点赞 0 评论 0
protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client)
{
    this.ambientTickCountdown = this.rand.nextInt(12000);
    this.spawnHostileMobs = true;
    this.spawnPeacefulMobs = true;
    this.lightUpdateBlockList = new int[32768];
    this.saveHandler = saveHandlerIn;
    this.theProfiler = profilerIn;
    this.worldInfo = info;
    this.provider = providerIn;
    this.isRemote = client;
    this.worldBorder = providerIn.getWorldBorder();
}
AnvilSaveConverter.java 文件源码 项目:CustomWorldGen 阅读 20 收藏 0 点赞 0 评论 0
@SideOnly(Side.CLIENT)
public List<WorldSummary> getSaveList() throws AnvilConverterException
{
    if (this.savesDirectory != null && this.savesDirectory.exists() && this.savesDirectory.isDirectory())
    {
        List<WorldSummary> list = Lists.<WorldSummary>newArrayList();
        File[] afile = this.savesDirectory.listFiles();

        for (File file1 : afile)
        {
            if (file1.isDirectory())
            {
                String s = file1.getName();
                WorldInfo worldinfo = this.getWorldInfo(s);

                if (worldinfo != null && (worldinfo.getSaveVersion() == 19132 || worldinfo.getSaveVersion() == 19133))
                {
                    boolean flag = worldinfo.getSaveVersion() != this.getSaveVersion();
                    String s1 = worldinfo.getWorldName();

                    if (StringUtils.isEmpty(s1))
                    {
                        s1 = s;
                    }

                    long i = 0L;
                    list.add(new WorldSummary(worldinfo, s, s1, 0L, flag));
                }
            }
        }

        return list;
    }
    else
    {
        throw new AnvilConverterException("Unable to read or access folder where game worlds are saved!");
    }
}
ForgeModContainer.java 文件源码 项目:CustomWorldGen 阅读 21 收藏 0 点赞 0 评论 0
@Override
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info)
{
    NBTTagCompound forgeData = new NBTTagCompound();
    NBTTagCompound dimData = DimensionManager.saveDimensionDataMap();
    forgeData.setTag("DimensionData", dimData);
    FluidRegistry.writeDefaultFluidList(forgeData);
    return forgeData;
}
WorldServer.java 文件源码 项目:DecompiledMinecraft 阅读 17 收藏 0 点赞 0 评论 0
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
    super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false);
    this.mcServer = server;
    this.theEntityTracker = new EntityTracker(this);
    this.thePlayerManager = new PlayerManager(this);
    this.provider.registerWorld(this);
    this.chunkProvider = this.createChunkProvider();
    this.worldTeleporter = new Teleporter(this);
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.getWorldBorder().setSize(server.getMaxWorldSize());
}
World.java 文件源码 项目:DecompiledMinecraft 阅读 20 收藏 0 点赞 0 评论 0
protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client)
{
    this.ambientTickCountdown = this.rand.nextInt(12000);
    this.spawnHostileMobs = true;
    this.spawnPeacefulMobs = true;
    this.lightUpdateBlockList = new int[32768];
    this.saveHandler = saveHandlerIn;
    this.theProfiler = profilerIn;
    this.worldInfo = info;
    this.provider = providerIn;
    this.isRemote = client;
    this.worldBorder = providerIn.getWorldBorder();
}
WorldClient.java 文件源码 项目:DecompiledMinecraft 阅读 24 收藏 0 点赞 0 评论 0
public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_)
{
    super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true);
    this.sendQueue = p_i45063_1_;
    this.getWorldInfo().setDifficulty(p_i45063_4_);
    this.setSpawnPoint(new BlockPos(8, 64, 8));
    this.provider.registerWorld(this);
    this.chunkProvider = this.createChunkProvider();
    this.mapStorage = new SaveDataMemoryStorage();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
}
GuiRenameWorld.java 文件源码 项目:DecompiledMinecraft 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.renameButton", new Object[0])));
    this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0])));
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    WorldInfo worldinfo = isaveformat.getWorldInfo(this.saveName);
    String s = worldinfo.getWorldName();
    this.field_146583_f = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20);
    this.field_146583_f.setFocused(true);
    this.field_146583_f.setText(s);
}
GuiMainMenu.java 文件源码 项目:DecompiledMinecraft 阅读 32 收藏 0 点赞 0 评论 0
/**
 * Adds Demo buttons on Main Menu for players who are playing Demo.
 */
private void addDemoButtons(int p_73972_1_, int p_73972_2_)
{
    this.buttonList.add(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo", new Object[0])));
    this.buttonList.add(this.buttonResetDemo = new GuiButton(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo", new Object[0])));
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");

    if (worldinfo == null)
    {
        this.buttonResetDemo.enabled = false;
    }
}
GuiMainMenu.java 文件源码 项目:CustomWorldGen 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Adds Demo buttons on Main Menu for players who are playing Demo.
 */
private void addDemoButtons(int p_73972_1_, int p_73972_2_)
{
    this.buttonList.add(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo", new Object[0])));
    this.buttonResetDemo = this.addButton(new GuiButton(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo", new Object[0])));
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");

    if (worldinfo == null)
    {
        this.buttonResetDemo.enabled = false;
    }
}
WorldServer.java 文件源码 项目:BaseClient 阅读 20 收藏 0 点赞 0 评论 0
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
    super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false);
    this.mcServer = server;
    this.theEntityTracker = new EntityTracker(this);
    this.thePlayerManager = new PlayerManager(this);
    this.provider.registerWorld(this);
    this.chunkProvider = this.createChunkProvider();
    this.worldTeleporter = new Teleporter(this);
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.getWorldBorder().setSize(server.getMaxWorldSize());
}
World.java 文件源码 项目:BaseClient 阅读 23 收藏 0 点赞 0 评论 0
protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client)
{
    this.ambientTickCountdown = this.rand.nextInt(12000);
    this.spawnHostileMobs = true;
    this.spawnPeacefulMobs = true;
    this.lightUpdateBlockList = new int[32768];
    this.saveHandler = saveHandlerIn;
    this.theProfiler = profilerIn;
    this.worldInfo = info;
    this.provider = providerIn;
    this.isRemote = client;
    this.worldBorder = providerIn.getWorldBorder();
}
GuiListWorldSelectionEntry.java 文件源码 项目:CustomWorldGen 阅读 17 收藏 0 点赞 0 评论 0
public void recreateWorld()
{
    this.client.displayGuiScreen(new GuiScreenWorking());
    GuiCreateWorld guicreateworld = new GuiCreateWorld(this.worldSelScreen);
    ISaveHandler isavehandler = this.client.getSaveLoader().getSaveLoader(this.worldSummary.getFileName(), false);
    WorldInfo worldinfo = isavehandler.loadWorldInfo();
    isavehandler.flush();
    guicreateworld.recreateFromExistingWorld(worldinfo);
    this.client.displayGuiScreen(guicreateworld);
}
GuiRenameWorld.java 文件源码 项目:BaseClient 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.renameButton", new Object[0])));
    this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0])));
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    WorldInfo worldinfo = isaveformat.getWorldInfo(this.saveName);
    String s = worldinfo.getWorldName();
    this.field_146583_f = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20);
    this.field_146583_f.setFocused(true);
    this.field_146583_f.setText(s);
}
GuiMainMenu.java 文件源码 项目:BaseClient 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Adds Demo buttons on Main Menu for players who are playing Demo.
 */
private void addDemoButtons(int p_73972_1_, int p_73972_2_)
{
    this.buttonList.add(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo", new Object[0])));
    this.buttonList.add(this.buttonResetDemo = new GuiButton(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo", new Object[0])));
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");

    if (worldinfo == null)
    {
        this.buttonResetDemo.enabled = false;
    }
}
WorldServer.java 文件源码 项目:BaseClient 阅读 20 收藏 0 点赞 0 评论 0
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
    super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false);
    this.mcServer = server;
    this.theEntityTracker = new EntityTracker(this);
    this.thePlayerManager = new PlayerManager(this);
    this.provider.registerWorld(this);
    this.chunkProvider = this.createChunkProvider();
    this.worldTeleporter = new Teleporter(this);
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.getWorldBorder().setSize(server.getMaxWorldSize());
}
AnvilSaveConverter.java 文件源码 项目:BaseClient 阅读 25 收藏 0 点赞 0 评论 0
public List<SaveFormatComparator> getSaveList() throws AnvilConverterException
{
    if (this.savesDirectory != null && this.savesDirectory.exists() && this.savesDirectory.isDirectory())
    {
        List<SaveFormatComparator> list = Lists.<SaveFormatComparator>newArrayList();
        File[] afile = this.savesDirectory.listFiles();

        for (File file1 : afile)
        {
            if (file1.isDirectory())
            {
                String s = file1.getName();
                WorldInfo worldinfo = this.getWorldInfo(s);

                if (worldinfo != null && (worldinfo.getSaveVersion() == 19132 || worldinfo.getSaveVersion() == 19133))
                {
                    boolean flag = worldinfo.getSaveVersion() != this.getSaveVersion();
                    String s1 = worldinfo.getWorldName();

                    if (StringUtils.isEmpty(s1))
                    {
                        s1 = s;
                    }

                    long i = 0L;
                    list.add(new SaveFormatComparator(s, s1, worldinfo.getLastTimePlayed(), i, worldinfo.getGameType(), flag, worldinfo.isHardcoreModeEnabled(), worldinfo.areCommandsAllowed()));
                }
            }
        }

        return list;
    }
    else
    {
        throw new AnvilConverterException("Unable to read or access folder where game worlds are saved!");
    }
}
World.java 文件源码 项目:BaseClient 阅读 19 收藏 0 点赞 0 评论 0
protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client)
{
    this.ambientTickCountdown = this.rand.nextInt(12000);
    this.spawnHostileMobs = true;
    this.spawnPeacefulMobs = true;
    this.lightUpdateBlockList = new int[32768];
    this.saveHandler = saveHandlerIn;
    this.theProfiler = profilerIn;
    this.worldInfo = info;
    this.provider = providerIn;
    this.isRemote = client;
    this.worldBorder = providerIn.getWorldBorder();
}
WorldClient.java 文件源码 项目:BaseClient 阅读 17 收藏 0 点赞 0 评论 0
public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_)
{
    super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true);
    this.sendQueue = p_i45063_1_;
    this.getWorldInfo().setDifficulty(p_i45063_4_);
    this.provider.registerWorld(this);
    this.setSpawnPoint(new BlockPos(8, 64, 8));
    this.chunkProvider = this.createChunkProvider();
    this.mapStorage = new SaveDataMemoryStorage();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
}


问题


面经


文章

微信
公众号

扫码关注公众号