Java 类net.minecraft.world.WorldSettings 实例源码

项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * (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")));
        }
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * (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")));
        }
    }
}
项目:BaseClient    文件:PlayerSelector.java   
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;
}
项目:BaseClient    文件:S01PacketJoinGame.java   
/**
 * 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();
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * 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();
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
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());
}
项目:BaseClient    文件:PlayerSelector.java   
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;
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * 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())));
}
项目:BaseClient    文件:GuiSelectWorld.java   
/**
 * 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();
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * 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())));
}
项目:BaseClient    文件:GuiSelectWorld.java   
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);
        }
    }
}
项目:CustomWorldGen    文件:WorldInfo.java   
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();
}
项目:BaseClient    文件:WorldInfo.java   
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();
}
项目:UniversalRemote    文件:HookedClientWorld.java   
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();

}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
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);
    }
}
项目:DecompiledMinecraft    文件:S07PacketRespawn.java   
/**
 * 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;
    }
}
项目:DecompiledMinecraft    文件:S01PacketJoinGame.java   
public S01PacketJoinGame(int entityIdIn, WorldSettings.GameType gameTypeIn, boolean hardcoreModeIn, int dimensionIn, EnumDifficulty difficultyIn, int maxPlayersIn, WorldType worldTypeIn, boolean reducedDebugInfoIn)
{
    this.entityId = entityIdIn;
    this.dimension = dimensionIn;
    this.difficulty = difficultyIn;
    this.gameType = gameTypeIn;
    this.maxPlayers = maxPlayersIn;
    this.hardcoreMode = hardcoreModeIn;
    this.worldType = worldTypeIn;
    this.reducedDebugInfo = reducedDebugInfoIn;
}
项目:Backmemed    文件:GuiListWorldSelectionEntry.java   
private void loadWorld()
{
    this.client.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));

    if (this.client.getSaveLoader().canLoadWorld(this.worldSummary.getFileName()))
    {
        this.client.launchIntegratedServer(this.worldSummary.getFileName(), this.worldSummary.getDisplayName(), (WorldSettings)null);
    }
}
项目:BaseClient    文件:IntegratedServer.java   
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;
    Reflector.callVoid(Reflector.ModLoader_registerServer, new Object[] {this});
}
项目:BaseClient    文件:S07PacketRespawn.java   
public S07PacketRespawn(int dimensionIDIn, EnumDifficulty difficultyIn, WorldType worldTypeIn, WorldSettings.GameType gameTypeIn)
{
    this.dimensionID = dimensionIDIn;
    this.difficulty = difficultyIn;
    this.gameType = gameTypeIn;
    this.worldType = worldTypeIn;
}
项目:BaseClient    文件:CommandDefaultGameMode.java   
protected void setGameType(WorldSettings.GameType p_71541_1_)
{
    MinecraftServer minecraftserver = MinecraftServer.getServer();
    minecraftserver.setGameType(p_71541_1_);

    if (minecraftserver.getForceGamemode())
    {
        for (EntityPlayerMP entityplayermp : MinecraftServer.getServer().getConfigurationManager().func_181057_v())
        {
            entityplayermp.setGameType(p_71541_1_);
            entityplayermp.fallDistance = 0.0F;
        }
    }
}
项目:DecompiledMinecraft    文件:ItemInWorldManager.java   
public void setGameType(WorldSettings.GameType type)
{
    this.gameType = type;
    type.configurePlayerCapabilities(this.thisPlayerMP.capabilities);
    this.thisPlayerMP.sendPlayerAbilities();
    this.thisPlayerMP.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.UPDATE_GAME_MODE, new EntityPlayerMP[] {this.thisPlayerMP}));
}
项目:BaseClient    文件:PlayerControllerMP.java   
/**
 * Notifies the server of things like consuming food, etc...
 */
public boolean sendUseItem(EntityPlayer playerIn, World worldIn, ItemStack itemStackIn)
{
    if (this.currentGameType == WorldSettings.GameType.SPECTATOR)
    {
        return false;
    }
    else
    {
        this.syncCurrentPlayItem();
        this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(playerIn.inventory.getCurrentItem()));
        int i = itemStackIn.stackSize;
        ItemStack itemstack = itemStackIn.useItemRightClick(worldIn, playerIn);

        if (itemstack != itemStackIn || itemstack != null && itemstack.stackSize != i)
        {
            playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack;

            if (itemstack.stackSize == 0)
            {
                playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null;
            }

            return true;
        }
        else
        {
            return false;
        }
    }
}
项目:BaseClient    文件:WorldInfo.java   
public WorldInfo(WorldSettings settings, String name)
{
    this.populateFromWorldSettings(settings);
    this.levelName = name;
    this.difficulty = DEFAULT_DIFFICULTY;
    this.initialized = false;
}
项目:Backmemed    文件:WorldInfo.java   
public WorldInfo(WorldSettings settings, String name)
{
    this.populateFromWorldSettings(settings);
    this.levelName = name;
    this.difficulty = DEFAULT_DIFFICULTY;
    this.initialized = false;
}
项目:BaseClient    文件:SaveFormatComparator.java   
public SaveFormatComparator(String fileNameIn, String displayNameIn, long lastTimePlayedIn, long sizeOnDiskIn, WorldSettings.GameType theEnumGameTypeIn, boolean requiresConversionIn, boolean hardcoreIn, boolean cheatsEnabledIn)
{
    this.fileName = fileNameIn;
    this.displayName = displayNameIn;
    this.lastTimePlayed = lastTimePlayedIn;
    this.sizeOnDisk = sizeOnDiskIn;
    this.theEnumGameType = theEnumGameTypeIn;
    this.requiresConversion = requiresConversionIn;
    this.hardcore = hardcoreIn;
    this.cheatsEnabled = cheatsEnabledIn;
}
项目:BaseClient    文件:WorldInfo.java   
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();
}
项目:DecompiledMinecraft    文件:CommandPublishLocalServer.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    String s = MinecraftServer.getServer().shareToLAN(WorldSettings.GameType.SURVIVAL, false);

    if (s != null)
    {
        notifyOperators(sender, this, "commands.publish.started", new Object[] {s});
    }
    else
    {
        notifyOperators(sender, this, "commands.publish.failed", new Object[0]);
    }
}
项目:CustomWorldGen    文件:IntegratedServer.java   
public IntegratedServer(Minecraft clientIn, String folderNameIn, String worldNameIn, WorldSettings worldSettingsIn, YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn, GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn)
{
    super(new File(clientIn.mcDataDir, "saves"), clientIn.getProxy(), clientIn.getDataFixer(), authServiceIn, sessionServiceIn, profileRepoIn, profileCacheIn);
    this.setServerOwner(clientIn.getSession().getUsername());
    this.setFolderName(folderNameIn);
    this.setWorldName(worldNameIn);
    this.setDemo(clientIn.isDemo());
    this.canCreateBonusChest(worldSettingsIn.isBonusChestEnabled());
    this.setBuildLimit(256);
    this.setPlayerList(new IntegratedPlayerList(this));
    this.mc = clientIn;
    this.theWorldSettings = this.isDemo() ? DemoWorldServer.DEMO_WORLD_SETTINGS : worldSettingsIn;
}
项目:Backmemed    文件:IntegratedServer.java   
public IntegratedServer(Minecraft clientIn, String folderNameIn, String worldNameIn, WorldSettings worldSettingsIn, YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn, GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn)
{
    super(new File(clientIn.mcDataDir, "saves"), clientIn.getProxy(), clientIn.getDataFixer(), authServiceIn, sessionServiceIn, profileRepoIn, profileCacheIn);
    this.setServerOwner(clientIn.getSession().getUsername());
    this.setFolderName(folderNameIn);
    this.setWorldName(worldNameIn);
    this.setDemo(clientIn.isDemo());
    this.canCreateBonusChest(worldSettingsIn.isBonusChestEnabled());
    this.setBuildLimit(256);
    this.setPlayerList(new IntegratedPlayerList(this));
    this.mc = clientIn;
    this.theWorldSettings = this.isDemo() ? DemoWorldServer.DEMO_WORLD_SETTINGS : worldSettingsIn;
}
项目:DecompiledMinecraft    文件:WorldInfo.java   
public WorldInfo(WorldSettings settings, String name)
{
    this.populateFromWorldSettings(settings);
    this.levelName = name;
    this.difficulty = DEFAULT_DIFFICULTY;
    this.initialized = false;
}
项目:DecompiledMinecraft    文件:WorldInfo.java   
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();
}
项目:BaseClient    文件:CommandDefaultGameMode.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length <= 0)
    {
        throw new WrongUsageException("commands.defaultgamemode.usage", new Object[0]);
    }
    else
    {
        WorldSettings.GameType worldsettings$gametype = this.getGameModeFromCommand(sender, args[0]);
        this.setGameType(worldsettings$gametype);
        notifyOperators(sender, this, "commands.defaultgamemode.success", new Object[] {new ChatComponentTranslation("gameMode." + worldsettings$gametype.getName(), new Object[0])});
    }
}
项目:BaseClient    文件:EntityPlayerMP.java   
/**
 * Attacks for the player the targeted entity with the currently equipped item.  The equipped item has hitEntity
 * called on it. Args: targetEntity
 */
public void attackTargetEntityWithCurrentItem(Entity targetEntity)
{
    if (this.theItemInWorldManager.getGameType() == WorldSettings.GameType.SPECTATOR)
    {
        this.setSpectatingEntity(targetEntity);
    }
    else
    {
        super.attackTargetEntityWithCurrentItem(targetEntity);
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
/**
 * Attacks for the player the targeted entity with the currently equipped item.  The equipped item has hitEntity
 * called on it. Args: targetEntity
 */
public void attackTargetEntityWithCurrentItem(Entity targetEntity)
{
    if (this.theItemInWorldManager.getGameType() == WorldSettings.GameType.SPECTATOR)
    {
        this.setSpectatingEntity(targetEntity);
    }
    else
    {
        super.attackTargetEntityWithCurrentItem(targetEntity);
    }
}
项目:BaseClient    文件:PlayerControllerMP.java   
/**
 * Attacks an entity
 */
public void attackEntity(EntityPlayer playerIn, Entity targetEntity)
{
    this.syncCurrentPlayItem();
    this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.ATTACK));

    if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
    {
        playerIn.attackTargetEntityWithCurrentItem(targetEntity);
    }
}
项目:DecompiledMinecraft    文件:S07PacketRespawn.java   
/**
 * 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;
    }
}
项目:BaseClient    文件:PlayerControllerMP.java   
public boolean func_178894_a(EntityPlayer p_178894_1_, Entity p_178894_2_, MovingObjectPosition p_178894_3_)
{
    this.syncCurrentPlayItem();
    Vec3 vec3 = new Vec3(p_178894_3_.hitVec.xCoord - p_178894_2_.posX, p_178894_3_.hitVec.yCoord - p_178894_2_.posY, p_178894_3_.hitVec.zCoord - p_178894_2_.posZ);
    this.netClientHandler.addToSendQueue(new C02PacketUseEntity(p_178894_2_, vec3));
    return this.currentGameType != WorldSettings.GameType.SPECTATOR && p_178894_2_.interactAt(p_178894_1_, vec3);
}
项目:BaseClient    文件:S07PacketRespawn.java   
public S07PacketRespawn(int dimensionIDIn, EnumDifficulty difficultyIn, WorldType worldTypeIn, WorldSettings.GameType gameTypeIn)
{
    this.dimensionID = dimensionIDIn;
    this.difficulty = difficultyIn;
    this.gameType = gameTypeIn;
    this.worldType = worldTypeIn;
}
项目:BaseClient    文件:WorldInfo.java   
public WorldInfo(WorldSettings settings, String name)
{
    this.populateFromWorldSettings(settings);
    this.levelName = name;
    this.difficulty = DEFAULT_DIFFICULTY;
    this.initialized = false;
}