本文整理匯總了Java中net.minecraft.world.WorldSettings類的典型用法代碼示例。如果您正苦於以下問題:Java WorldSettings類的具體用法?Java WorldSettings怎麽用?Java WorldSettings使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WorldSettings類屬於net.minecraft.world包,在下文中一共展示了WorldSettings類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readEntityFromNBT
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
super.readEntityFromNBT(tagCompund);
if (tagCompund.hasKey("playerGameType", 99))
{
if (MinecraftServer.getServer().getForceGamemode())
{
this.theItemInWorldManager.setGameType(MinecraftServer.getServer().getGameType());
}
else
{
this.theItemInWorldManager.setGameType(WorldSettings.GameType.getByID(tagCompund.getInteger("playerGameType")));
}
}
}
示例2: func_179649_c
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
private static List<Predicate<Entity>> func_179649_c(Map<String, String> p_179649_0_)
{
List<Predicate<Entity>> list = Lists.<Predicate<Entity>>newArrayList();
final int i = parseIntWithDefault(p_179649_0_, "m", WorldSettings.GameType.NOT_SET.getID());
if (i != WorldSettings.GameType.NOT_SET.getID())
{
list.add(new Predicate<Entity>()
{
public boolean apply(Entity p_apply_1_)
{
if (!(p_apply_1_ instanceof EntityPlayerMP))
{
return false;
}
else
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)p_apply_1_;
return entityplayermp.theItemInWorldManager.getGameType().getID() == i;
}
}
});
}
return list;
}
示例3: readPacketData
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readInt();
int i = buf.readUnsignedByte();
this.hardcoreMode = (i & 8) == 8;
i = i & -9;
this.gameType = WorldSettings.GameType.getByID(i);
this.dimension = buf.readByte();
this.difficulty = EnumDifficulty.getDifficultyEnum(buf.readUnsignedByte());
this.maxPlayers = buf.readUnsignedByte();
this.worldType = WorldType.parseWorldType(buf.readStringFromBuffer(16));
if (this.worldType == null)
{
this.worldType = WorldType.DEFAULT;
}
this.reducedDebugInfo = buf.readBoolean();
}
示例4: setGameType
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
/**
* Sets the player's game mode and sends it to them.
*/
public void setGameType(WorldSettings.GameType gameType)
{
this.theItemInWorldManager.setGameType(gameType);
this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(3, (float)gameType.getID()));
if (gameType == WorldSettings.GameType.SPECTATOR)
{
this.mountEntity((Entity)null);
}
else
{
this.setSpectatingEntity(this);
}
this.sendPlayerAbilities();
this.markPotionsDirty();
}
示例5: handleRespawn
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
public void handleRespawn(S07PacketRespawn packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension) {
this.doneLoadingTerrain = false;
Scoreboard scoreboard = this.clientWorldController.getScoreboard();
this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false,
this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()),
packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.clientWorldController.setWorldScoreboard(scoreboard);
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimensionID();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
}
this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID());
this.gameController.playerController.setGameType(packetIn.getGameType());
}
示例6: handleJoinGame
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
/**
* Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
* WorldClient and sets the player initial dimension
*/
public void handleJoinGame(S01PacketJoinGame packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimension();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
this.gameController.thePlayer.setEntityId(packetIn.getEntityId());
this.currentServerMaxPlayers = packetIn.getMaxPlayers();
this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
this.gameController.playerController.setGameType(packetIn.getGameType());
this.gameController.gameSettings.sendSettingsToServer();
this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
示例7: initGui
import net.minecraft.world.WorldSettings; //導入依賴的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()
{
this.field_146628_f = I18n.format("selectWorld.title", new Object[0]);
try
{
this.func_146627_h();
}
catch (AnvilConverterException anvilconverterexception)
{
logger.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception);
this.mc.displayGuiScreen(new GuiErrorScreen("Unable to load worlds", anvilconverterexception.getMessage()));
return;
}
this.field_146637_u = I18n.format("selectWorld.world", new Object[0]);
this.field_146636_v = I18n.format("selectWorld.conversion", new Object[0]);
this.field_146635_w[WorldSettings.GameType.SURVIVAL.getID()] = I18n.format("gameMode.survival", new Object[0]);
this.field_146635_w[WorldSettings.GameType.CREATIVE.getID()] = I18n.format("gameMode.creative", new Object[0]);
this.field_146635_w[WorldSettings.GameType.ADVENTURE.getID()] = I18n.format("gameMode.adventure", new Object[0]);
this.field_146635_w[WorldSettings.GameType.SPECTATOR.getID()] = I18n.format("gameMode.spectator", new Object[0]);
this.field_146638_t = new GuiSelectWorld.List(this.mc);
this.field_146638_t.registerScrollButtons(4, 5);
this.func_146618_g();
}
示例8: handleJoinGame
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
/**
* Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
* WorldClient and sets the player initial dimension
*/
public void handleJoinGame(SPacketJoinGame packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimension();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
this.gameController.thePlayer.setEntityId(packetIn.getPlayerId());
this.currentServerMaxPlayers = packetIn.getMaxPlayers();
this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
this.gameController.playerController.setGameType(packetIn.getGameType());
this.gameController.gameSettings.sendSettingsToServer();
this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
示例9: IntegratedServer
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
public IntegratedServer(Minecraft mcIn, String folderName, String worldName, WorldSettings settings)
{
super(new File(mcIn.mcDataDir, "saves"), mcIn.getProxy(), new File(mcIn.mcDataDir, USER_CACHE_FILE.getName()));
this.setServerOwner(mcIn.getSession().getUsername());
this.setFolderName(folderName);
this.setWorldName(worldName);
this.setDemo(mcIn.isDemo());
this.canCreateBonusChest(settings.isBonusChestEnabled());
this.setBuildLimit(256);
this.setConfigManager(new IntegratedPlayerList(this));
this.mc = mcIn;
this.theWorldSettings = this.isDemo() ? DemoWorldServer.demoWorldSettings : settings;
}
示例10: func_146615_e
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
public void func_146615_e(int p_146615_1_)
{
this.mc.displayGuiScreen((GuiScreen)null);
if (!this.field_146634_i)
{
this.field_146634_i = true;
String s = this.func_146621_a(p_146615_1_);
if (s == null)
{
s = "World" + p_146615_1_;
}
String s1 = this.func_146614_d(p_146615_1_);
if (s1 == null)
{
s1 = "World" + p_146615_1_;
}
if (this.mc.getSaveLoader().canLoadWorld(s))
{
this.mc.launchIntegratedServer(s, s1, (WorldSettings)null);
}
}
}
示例11: populateFromWorldSettings
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
public void populateFromWorldSettings(WorldSettings settings)
{
this.randomSeed = settings.getSeed();
this.theGameType = settings.getGameType();
this.mapFeaturesEnabled = settings.isMapFeaturesEnabled();
this.hardcore = settings.getHardcoreEnabled();
this.terrainType = settings.getTerrainType();
this.generatorOptions = settings.getGeneratorOptions();
this.allowCommands = settings.areCommandsAllowed();
}
示例12: populateFromWorldSettings
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
public void populateFromWorldSettings(WorldSettings settings)
{
this.randomSeed = settings.getSeed();
this.theGameType = settings.getGameType();
this.mapFeaturesEnabled = settings.isMapFeaturesEnabled();
this.hardcore = settings.getHardcoreEnabled();
this.terrainType = settings.getTerrainType();
this.generatorOptions = settings.getWorldName();
this.allowCommands = settings.areCommandsAllowed();
}
示例13: HookedClientWorld
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
public HookedClientWorld(WorldClient originalWorld) throws IllegalAccessException {
super(InjectionHandler.readFieldOfType(originalWorld, NetHandlerPlayClient.class),
new WorldSettings(originalWorld.getWorldInfo()),
originalWorld.provider.getDimension(), originalWorld.getDifficulty(), originalWorld.profiler);
HookedChunkProviderClient chunkProvider = new HookedChunkProviderClient(this);
// replace the chunk provider with our own!
InjectionHandler.writeFieldOfType(this, chunkProvider, ChunkProviderClient.class);
InjectionHandler.writeFieldOfType(this, chunkProvider, IChunkProvider.class);
SetupWorldProviderProxy();
}
示例14: EntityPlayerMP
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager)
{
super(worldIn, profile);
interactionManager.thisPlayerMP = this;
this.theItemInWorldManager = interactionManager;
BlockPos blockpos = worldIn.getSpawnPoint();
if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE)
{
int i = Math.max(5, server.getSpawnProtectionSize() - 6);
int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ()));
if (j < i)
{
i = j;
}
if (j <= 1)
{
i = 1;
}
blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos.add(this.rand.nextInt(i * 2) - i, 0, this.rand.nextInt(i * 2) - i));
}
this.mcServer = server;
this.statsFile = server.getConfigurationManager().getPlayerStatsFile(this);
this.stepHeight = 0.0F;
this.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F);
while (!worldIn.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && this.posY < 255.0D)
{
this.setPosition(this.posX, this.posY + 1.0D, this.posZ);
}
}
示例15: readPacketData
import net.minecraft.world.WorldSettings; //導入依賴的package包/類
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.dimensionID = buf.readInt();
this.difficulty = EnumDifficulty.getDifficultyEnum(buf.readUnsignedByte());
this.gameType = WorldSettings.GameType.getByID(buf.readUnsignedByte());
this.worldType = WorldType.parseWorldType(buf.readStringFromBuffer(16));
if (this.worldType == null)
{
this.worldType = WorldType.DEFAULT;
}
}