本文整理汇总了Java中net.minecraft.world.storage.WorldInfo类的典型用法代码示例。如果您正苦于以下问题:Java WorldInfo类的具体用法?Java WorldInfo怎么用?Java WorldInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WorldInfo类属于net.minecraft.world.storage包,在下文中一共展示了WorldInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recreateFromExistingWorld
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
/**
* 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";
}
}
示例2: WorldServer
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
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);
}
示例3: initGui
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
/**
* 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);
}
示例4: func_146318_a
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
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";
}
}
示例5: WorldClient
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
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));
}
示例6: setMissionWeather
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
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);
}
}
示例7: WorldClient
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
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);
}
}
示例8: initGui
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
/**
* 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);
}
示例9: World
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
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();
}
示例10: getSaveList
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
@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!");
}
}
示例11: getDataForWriting
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
@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;
}
示例12: WorldServer
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
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());
}
示例13: WorldClient
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
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();
}
示例14: initGui
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
/**
* 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);
}
示例15: addDemoButtons
import net.minecraft.world.storage.WorldInfo; //导入依赖的package包/类
/**
* 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;
}
}