Java 类net.minecraft.util.text.TextComponentString 实例源码

项目:Backmemed    文件:EntityRenderer.java   
private void checkLoadVisibleChunks(Entity p_checkLoadVisibleChunks_1_, float p_checkLoadVisibleChunks_2_, ICamera p_checkLoadVisibleChunks_3_, boolean p_checkLoadVisibleChunks_4_)
{
    if (this.loadVisibleChunks)
    {
        this.loadVisibleChunks = false;
        this.loadAllVisibleChunks(p_checkLoadVisibleChunks_1_, (double)p_checkLoadVisibleChunks_2_, p_checkLoadVisibleChunks_3_, p_checkLoadVisibleChunks_4_);
    }

    if (Keyboard.isKeyDown(61) && Keyboard.isKeyDown(38))
    {
        this.loadVisibleChunks = true;
        TextComponentString textcomponentstring = new TextComponentString(I18n.format("of.message.loadingVisibleChunks", new Object[0]));
        this.mc.ingameGUI.getChatGUI().printChatMessage(textcomponentstring);
        Reflector.Minecraft_actionKeyF3.setValue(this.mc, Boolean.TRUE);
    }
}
项目:pnc-repressurized    文件:BlockSecurityStation.java   
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
    if (player.isSneaking()) return false;
    else {
        if (!world.isRemote) {
            TileEntitySecurityStation te = (TileEntitySecurityStation) world.getTileEntity(pos);
            if (te != null) {
                if (te.isPlayerOnWhiteList(player)) {
                    player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.SECURITY_STATION_INVENTORY.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
                } else if (!te.hasValidNetwork()) {
                    player.sendStatusMessage(new TextComponentString(TextFormatting.GREEN + "This Security Station is out of order: Its network hasn't been properly configured."), false);
                } else if (te.hasPlayerHacked(player)) {
                    player.sendStatusMessage(new TextComponentString(TextFormatting.GREEN + "You've already hacked this Security Station!"), false);
                } else if (getPlayerHackLevel(player) < te.getSecurityLevel()) {
                    player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "You can't access or hack this Security Station. To hack it you need at least a Pneumatic Helmet upgraded with " + te.getSecurityLevel() + " Security upgrade(s)."), false);
                } else {
                    player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.HACKING.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
                }
            }
        }
        return true;
    }
}
项目:ProgressiveDifficulty    文件:EventHandler.java   
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event){
    if(DifficultyManager.enabled && ProgressiveDifficulty.oldConfigExists){
        TextComponentString linkComponent = new TextComponentString("[Progressive Difficulty Wiki]");
        ITextComponent[] chats = new ITextComponent[]{
                new TextComponentString("[ProgressiveDifficulty] It looks like you have a version 1.0 " +
                        "config file. Please check out the Progressive Difficulty Wiki for instructions on how" +
                        " to migrate to a version 2.0 config file."),
                linkComponent
        };
        ClickEvent goLinkEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,"https://github.com/talandar/ProgressiveDifficulty/wiki/2.0-Transition");
        linkComponent.getStyle().setClickEvent(goLinkEvent);
        linkComponent.getStyle().setColor(TextFormatting.BLUE);
        linkComponent.getStyle().setUnderlined(true);
        ChatUtil.sendChat(event.player,chats);
    }
}
项目:CustomWorldGen    文件:CommandTreeBase.java   
/**
 * Callback for when the command is executed
 */
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if(args.length < 1)
    {
        sender.addChatMessage(new TextComponentString(CommandBase.joinNiceStringFromCollection(commandMap.keySet())));
    }
    else
    {
        ICommand cmd = getCommandMap().get(args[0]);

        if(cmd == null)
        {
            throw new CommandException("commands.tree_base.invalid_cmd", args[0]);
        }
        else if(!cmd.checkPermission(server, sender))
        {
            throw new CommandException("commands.generic.permission");
        }
        else
        {
            cmd.execute(server, sender, shiftArgs(args));
        }
    }
}
项目:Geolosys    文件:BlockSampleVanilla.java   
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    if (Config.getInstance().boringSamples)
    {
        String resource = Types.Vanilla.byMetadata(state.getBlock().getMetaFromState(state)).getResource();
        playerIn.sendStatusMessage(new TextComponentString("You break the sample to find " + resource), true);
    }
    else
    {
        this.dropBlockAsItem(worldIn, pos, state, 0);
    }
    worldIn.setBlockToAir(pos);
    playerIn.swingArm(EnumHand.MAIN_HAND);
    return true;
}
项目:ForgeHax    文件:Helper.java   
public static void printMessageNaked(String startWith, String message, Style firstStyle, Style secondStyle) {
    if(getLocalPlayer() != null && !Strings.isNullOrEmpty(message)) {
        if(message.contains("\n")) {
            Scanner scanner = new Scanner(message);
            scanner.useDelimiter("\n");
            Style s1 = firstStyle;
            Style s2 = secondStyle;
            while (scanner.hasNext()) {
                printMessageNaked(startWith, scanner.next(), s1, s2);
                // alternate between colors each newline
                Style cpy = s1;
                s1 = s2;
                s2 = cpy;
            }
        } else {
            TextComponentString string = new TextComponentString(startWith + message.replaceAll("\r", ""));
            string.setStyle(firstStyle);
            getLocalPlayer().sendMessage(string);
        }
    }
}
项目:CustomWorldGen    文件:GuiChat.java   
/**
 * Called when tab key pressed. If it's the first time we tried to complete this string, we ask the server
 * for completions. When the server responds, this method gets called again (via setCompletions).
 */
public void complete()
{
    super.complete();

    if (this.completions.size() > 1)
    {
        StringBuilder stringbuilder = new StringBuilder();

        for (String s : this.completions)
        {
            if (stringbuilder.length() > 0)
            {
                stringbuilder.append(", ");
            }

            stringbuilder.append(s);
        }

        this.clientInstance.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new TextComponentString(stringbuilder.toString()), 1);
    }
}
项目:CustomWorldGen    文件:CommandBase.java   
public static ITextComponent join(List<ITextComponent> components)
{
    ITextComponent itextcomponent = new TextComponentString("");

    for (int i = 0; i < components.size(); ++i)
    {
        if (i > 0)
        {
            if (i == components.size() - 1)
            {
                itextcomponent.appendText(" and ");
            }
            else if (i > 0)
            {
                itextcomponent.appendText(", ");
            }
        }

        itextcomponent.appendSibling((ITextComponent)components.get(i));
    }

    return itextcomponent;
}
项目:BetterBeginningsReborn    文件:ItemInfusionScroll.java   
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos,
    EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
{
    TileEntity te = world.getTileEntity(pos);
    if(te instanceof TileEntityInfusionRepair)
    {
        Stack<RecipeElement> pendingIngredients = ((TileEntityInfusionRepair)te).getPendingIngredients();
        if(!pendingIngredients.isEmpty())
        {
            RecipeElement element = pendingIngredients.peek();
            player.sendMessage(new TextComponentString(element.toFriendlyString()));
        }
    }
    return EnumActionResult.SUCCESS;
}
项目:AuthMod    文件:CommandEvents.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
  public void CommandEvents(CommandEvent evt) {

    if(Main.debug==1)System.out.println(evt.getSender().getName() + " called Command " + evt.getSender().toString());


    if(evt.getSender() instanceof EntityPlayer){
    if(!Main.logged.contains(evt.getSender().getName())){
        //System.out.println(evt.getCommand().getCommandName().toString());
        if(!evt.getCommand().getCommandName().toString().contains("login") && !evt.getCommand().getCommandName().toString().contains("register")){
        evt.setCanceled(true);
        if(Main.passwords.containsKey(evt.getSender().getName())){
            evt.getSender().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("loginmessage")));
        } else {
        evt.getSender().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("registermessage")));
        }
        } 
    }
    }
}
项目:Backmemed    文件:GuiChat.java   
public void complete()
{
    super.complete();

    if (this.completions.size() > 1)
    {
        StringBuilder stringbuilder = new StringBuilder();

        for (String s : this.completions)
        {
            if (stringbuilder.length() > 0)
            {
                stringbuilder.append(", ");
            }

            stringbuilder.append(s);
        }

        this.clientInstance.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new TextComponentString(stringbuilder.toString()), 1);
    }
}
项目:uniquecrops    文件:GrowthSteps.java   
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

    TileEntity tile = world.getTileEntity(pos);
    if (tile != null && tile instanceof TileFeroxia) {
        TileFeroxia te = (TileFeroxia)tile;
        EntityPlayer player = UCUtils.getPlayerFromUUID(te.getOwner().toString());
        if (!world.isRemote && player != null && world.getPlayerEntityByUUID(te.getOwner()) != null) {
            NBTTagCompound tag = player.getEntityData();
            if (!tag.hasKey("hasSacrificed"))
            {
                player.addChatMessage(new TextComponentString(TextFormatting.RED + "The savage plant whispers: \"The time is right to perform a self sacrifice.\""));
                tag.setBoolean("hasSacrificed", false);
                return false;
            }
            if (tag.hasKey("hasSacrificed") && tag.getBoolean("hasSacrificed"))
            {
                tag.removeTag("hasSacrificed");
                world.setBlockState(pos, ((Feroxia)state.getBlock()).withAge(7), 2);
                GrowthSteps.generateSteps(player);
                return false;
            }
        }
    }
    return false;
}
项目:Backmemed    文件:SignStrictJSON.java   
public ITextComponent deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    if (p_deserialize_1_.isJsonPrimitive())
    {
        return new TextComponentString(p_deserialize_1_.getAsString());
    }
    else if (p_deserialize_1_.isJsonArray())
    {
        JsonArray jsonarray = p_deserialize_1_.getAsJsonArray();
        ITextComponent itextcomponent = null;

        for (JsonElement jsonelement : jsonarray)
        {
            ITextComponent itextcomponent1 = this.deserialize(jsonelement, jsonelement.getClass(), p_deserialize_3_);

            if (itextcomponent == null)
            {
                itextcomponent = itextcomponent1;
            }
            else
            {
                itextcomponent.appendSibling(itextcomponent1);
            }
        }

        return itextcomponent;
    }
    else
    {
        throw new JsonParseException("Don\'t know how to turn " + p_deserialize_1_ + " into a Component");
    }
}
项目:ModularMachinery    文件:ItemDebugStruct.java   
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if(worldIn.isRemote) return EnumActionResult.SUCCESS;
    TileEntity te = worldIn.getTileEntity(pos);
    if(te != null && te instanceof TileMachineController) {
        DynamicMachine dm = ((TileMachineController) te).getBlueprintMachine();
        if(dm != null) {
            BlockArray pattern = dm.getPattern();
            if(pattern != null) {

                EnumFacing face = EnumFacing.NORTH;
                player.sendMessage(new TextComponentString("Attempting structure matching:"));
                player.sendMessage(new TextComponentString("Structure is facing: " + worldIn.getBlockState(pos).getValue(BlockController.FACING).name()));
                do {
                    if(face == worldIn.getBlockState(pos).getValue(BlockController.FACING)) {
                        BlockPos mismatch = pattern.getRelativeMismatchPosition(worldIn, pos);
                        if(mismatch != null) {
                            player.sendMessage(new TextComponentString("Failed at relative position: " + mismatch.toString()));
                        }
                    }
                    face = face.rotateYCCW();
                    pattern = pattern.rotateYCCW();
                } while (face != EnumFacing.NORTH);
            }
        }
    }
    return EnumActionResult.SUCCESS;
}
项目:pnc-repressurized    文件:NetworkConnectionAIHandler.java   
@Override
public void onSlotHack(int slot, boolean nuked) {
    ItemStack stack = station.getPrimaryInventory().getStackInSlot(slot);
    if (!simulating && !stack.isEmpty() && stack.getItemDamage() == ItemNetworkComponents.NETWORK_IO_PORT) {
        FMLClientHandler.instance().getClient().player.closeScreen();
        FMLClientHandler.instance().getClient().player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Hacking unsuccessful! The Diagnostic Subroutine traced to your location!"), false);
        if (gui instanceof GuiSecurityStationHacking)
            ((GuiSecurityStationHacking) gui).removeUpdatesOnConnectionHandlers();
    }
}
项目:CustomWorldGen    文件:CommandListBans.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && "ips".equalsIgnoreCase(args[0]))
    {
        sender.addChatMessage(new TextComponentTranslation("commands.banlist.ips", new Object[] {Integer.valueOf(server.getPlayerList().getBannedIPs().getKeys().length)}));
        sender.addChatMessage(new TextComponentString(joinNiceString(server.getPlayerList().getBannedIPs().getKeys())));
    }
    else
    {
        sender.addChatMessage(new TextComponentTranslation("commands.banlist.players", new Object[] {Integer.valueOf(server.getPlayerList().getBannedPlayers().getKeys().length)}));
        sender.addChatMessage(new TextComponentString(joinNiceString(server.getPlayerList().getBannedPlayers().getKeys())));
    }
}
项目:World-Border    文件:Util.java   
/**
 * Sends an automatically translated and formatted message to a command sender
 * @param sender Target to send message to
 * @param msg String or language key to broadcast
 */
public static void chat(ICommandSender sender, String msg, Object... parts)
{
    String translated = translate(msg);

    // Consoles require ANSI coloring for formatting
    if (sender instanceof DedicatedServer)
        Log.info( removeFormatting(translated), parts );
    else
    {
        translated = String.format(translated, parts);
        sender.addChatMessage( new TextComponentString(translated) );
    }
}
项目:Backmemed    文件:CommandGameRule.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    GameRules gamerules = this.getOverWorldGameRules(server);
    String s = args.length > 0 ? args[0] : "";
    String s1 = args.length > 1 ? buildString(args, 1) : "";

    switch (args.length)
    {
        case 0:
            sender.addChatMessage(new TextComponentString(joinNiceString(gamerules.getRules())));
            break;

        case 1:
            if (!gamerules.hasRule(s))
            {
                throw new CommandException("commands.gamerule.norule", new Object[] {s});
            }

            String s2 = gamerules.getString(s);
            sender.addChatMessage((new TextComponentString(s)).appendText(" = ").appendText(s2));
            sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, gamerules.getInt(s));
            break;

        default:
            if (gamerules.areSameType(s, GameRules.ValueType.BOOLEAN_VALUE) && !"true".equals(s1) && !"false".equals(s1))
            {
                throw new CommandException("commands.generic.boolean.invalid", new Object[] {s1});
            }

            gamerules.setOrCreateGameRule(s, s1);
            notifyGameRuleChange(gamerules, s, server);
            notifyCommandListener(sender, this, "commands.gamerule.success", new Object[] {s, s1});
    }
}
项目:CustomWorldGen    文件:CommandBlockBaseLogic.java   
/**
 * Send a chat message to the CommandSender
 */
public void addChatMessage(ITextComponent component)
{
    if (this.trackOutput && this.getEntityWorld() != null && !this.getEntityWorld().isRemote)
    {
        this.lastOutput = (new TextComponentString("[" + TIMESTAMP_FORMAT.format(new Date()) + "] ")).appendSibling(component);
        this.updateCommand();
    }
}
项目:CustomWorldGen    文件:GuiOptions.java   
public String getDifficultyText(EnumDifficulty p_175355_1_)
{
    ITextComponent itextcomponent = new TextComponentString("");
    itextcomponent.appendSibling(new TextComponentTranslation("options.difficulty", new Object[0]));
    itextcomponent.appendText(": ");
    itextcomponent.appendSibling(new TextComponentTranslation(p_175355_1_.getDifficultyResourceKey(), new Object[0]));
    return itextcomponent.getFormattedText();
}
项目:CustomWorldGen    文件:GuiConnecting.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == 0)
    {
        this.cancel = true;

        if (this.networkManager != null)
        {
            this.networkManager.closeChannel(new TextComponentString("Aborted"));
        }

        this.mc.displayGuiScreen(this.previousGuiScreen);
    }
}
项目:Backmemed    文件:StatBase.java   
/**
 * 1.8.9
 */
public ITextComponent createChatComponent()
{
    ITextComponent itextcomponent = this.getStatName();
    ITextComponent itextcomponent1 = (new TextComponentString("[")).appendSibling(itextcomponent).appendText("]");
    itextcomponent1.setStyle(itextcomponent.getStyle());
    return itextcomponent1;
}
项目:CustomWorldGen    文件:NetHandlerHandshakeTCP.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return;

    switch (packetIn.getRequestedState())
    {
        case LOGIN:
            this.networkManager.setConnectionState(EnumConnectionState.LOGIN);

            if (packetIn.getProtocolVersion() > 210)
            {
                TextComponentString textcomponentstring = new TextComponentString("Outdated server! I\'m still on 1.10.2");
                this.networkManager.sendPacket(new SPacketDisconnect(textcomponentstring));
                this.networkManager.closeChannel(textcomponentstring);
            }
            else if (packetIn.getProtocolVersion() < 210)
            {
                TextComponentString textcomponentstring1 = new TextComponentString("Outdated client! Please use 1.10.2");
                this.networkManager.sendPacket(new SPacketDisconnect(textcomponentstring1));
                this.networkManager.closeChannel(textcomponentstring1);
            }
            else
            {
                this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager));
            }

            break;
        case STATUS:
            this.networkManager.setConnectionState(EnumConnectionState.STATUS);
            this.networkManager.setNetHandler(new NetHandlerStatusServer(this.server, this.networkManager));
            break;
        default:
            throw new UnsupportedOperationException("Invalid intention " + packetIn.getRequestedState());
    }
}
项目:InControl    文件:CmdLoadLoot.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (!RulesManager.readCustomLoot(args[0])) {
        ChatTools.addChatMessage(sender, new TextComponentString(TextFormatting.RED + "Error reading file '" + args[0] + "'!"));
        InControl.logger.warn("Error reading file '" + args[0] + "'!");
    }
}
项目:InControl    文件:CmdLoadSpawn.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (!RulesManager.readCustomSpawn(args[0])) {
        ChatTools.addChatMessage(sender, new TextComponentString(TextFormatting.RED + "Error reading file '" + args[0] + "'!"));
        InControl.logger.warn("Error reading file '" + args[0] + "'!");
    }
}
项目:CustomWorldGen    文件:CommandBase.java   
public static ITextComponent getChatComponentFromNthArg(ICommandSender sender, String[] args, int index, boolean p_147176_3_) throws PlayerNotFoundException
{
    ITextComponent itextcomponent = new TextComponentString("");

    for (int i = index; i < args.length; ++i)
    {
        if (i > index)
        {
            itextcomponent.appendText(" ");
        }

        ITextComponent itextcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(args[i]); // Forge: links for messages

        if (p_147176_3_)
        {
            ITextComponent itextcomponent2 = EntitySelector.matchEntitiesToTextComponent(sender, args[i]);

            if (itextcomponent2 == null)
            {
                if (EntitySelector.hasArguments(args[i]))
                {
                    throw new PlayerNotFoundException();
                }
            }
            else
            {
                itextcomponent1 = itextcomponent2;
            }
        }

        itextcomponent.appendSibling(itextcomponent1);
    }

    return itextcomponent;
}
项目:CustomWorldGen    文件:CommandListPlayers.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    int i = server.getCurrentPlayerCount();
    sender.addChatMessage(new TextComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(server.getMaxPlayers())}));
    sender.addChatMessage(new TextComponentString(server.getPlayerList().getFormattedListOfPlayers(args.length > 0 && "uuids".equalsIgnoreCase(args[0]))));
    sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i);
}
项目:Backmemed    文件:GuiOptions.java   
public String getDifficultyText(EnumDifficulty p_175355_1_)
{
    ITextComponent itextcomponent = new TextComponentString("");
    itextcomponent.appendSibling(new TextComponentTranslation("options.difficulty", new Object[0]));
    itextcomponent.appendText(": ");
    itextcomponent.appendSibling(new TextComponentTranslation(p_175355_1_.getDifficultyResourceKey(), new Object[0]));
    return itextcomponent.getFormattedText();
}
项目:CustomWorldGen    文件:Entity.java   
/**
 * Get the formatted ChatComponent that will be used for the sender's username in chat
 */
public ITextComponent getDisplayName()
{
    TextComponentString textcomponentstring = new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()));
    textcomponentstring.getStyle().setHoverEvent(this.getHoverEvent());
    textcomponentstring.getStyle().setInsertion(this.getCachedUniqueIdString());
    return textcomponentstring;
}
项目:needtobreath    文件:ForgeEventHandlers.java   
@SubscribeEvent
public void onBonemeal(BonemealEvent evt) {
    World world = evt.getWorld();
    DimensionData data = getDimensionData(world);
    if (data != null) {
        if (preventPlantGrowth(world, data, evt.getPos())) {
            evt.setResult(Event.Result.ALLOW);
            if (world.isRemote) {
                evt.getEntityPlayer().sendStatusMessage(new TextComponentString(TextFormatting.RED + "The bonemeal did not work!"), false);
            }
        }
    }
}
项目:Scripty    文件:ScriptyNetworkHandler.java   
@SideOnly(Side.SERVER)
public static void handleOpenRequest(BlockPos pos, EntityPlayerMP player) {
    TileEntity te = player.world.getTileEntity(pos);
    if (te instanceof ScriptyBlock.TEScriptyBlock) {
        ScriptyBlock.TEScriptyBlock scriptyBlock = (ScriptyBlock.TEScriptyBlock) te;
        if (scriptyBlock.getOwner() != null && scriptyBlock.getOwner().isEntityEqual(player)) {
            player.sendMessage(new TextComponentString(scriptyBlock.getOwner().getName() + " is already using this Scripty block.").setStyle(new Style().setColor(TextFormatting.RED)));
            return;
        }
        scriptyBlock.setOwner(player);
        sendContentMessage(player, pos, scriptyBlock.getContent(), scriptyBlock.getLanguage(), scriptyBlock.isParsing());
    }
}
项目:Etheric    文件:TileEntityTestTank.java   
public boolean activate(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
        EnumFacing side, float hitX, float hitY, float hitZ) {
    if (!world.isRemote) {
        player.sendMessage(new TextComponentString(
                "Quintessence: " + internalTank.getAmount() + ", Purity: " + internalTank.getPurity()));
    }
    return true;
}
项目:Geolosys    文件:BlockSample.java   
@SubscribeEvent
public void registerEvent(BlockEvent.HarvestDropsEvent event)
{
    if (!Config.getInstance().boringSamples || event.getHarvester() == null || event.getState() == null || event.getState().getBlock() != this)
    {
        return;
    }
    String resource = Types.Modded.byMetadata(event.getState().getBlock().getMetaFromState(event.getState())).getResource();
    event.getHarvester().sendStatusMessage(new TextComponentString("You break the sample to find " + resource), true);
    event.getDrops().clear();
}
项目:CustomWorldGen    文件:CommandBlockBaseLogic.java   
/**
 * Reads NBT formatting and stored data into variables.
 */
public void readDataFromNBT(NBTTagCompound nbt)
{
    this.commandStored = nbt.getString("Command");
    this.successCount = nbt.getInteger("SuccessCount");

    if (nbt.hasKey("CustomName", 8))
    {
        this.customName = nbt.getString("CustomName");
    }

    if (nbt.hasKey("TrackOutput", 1))
    {
        this.trackOutput = nbt.getBoolean("TrackOutput");
    }

    if (nbt.hasKey("LastOutput", 8) && this.trackOutput)
    {
        try
        {
            this.lastOutput = ITextComponent.Serializer.jsonToComponent(nbt.getString("LastOutput"));
        }
        catch (Throwable throwable)
        {
            this.lastOutput = new TextComponentString(throwable.getMessage());
        }
    }
    else
    {
        this.lastOutput = null;
    }

    this.resultStats.readStatsFromNBT(nbt);
}
项目:DankNull    文件:BlockDankNullDock.java   
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (getTE(world, pos) != null) {
        if (!player.getHeldItem(hand).isEmpty() && getTE(world, pos).getStack().isEmpty() && player.getHeldItem(hand).getItem() == ModItems.DANK_NULL) {
            getTE(world, pos).setStack(player.getHeldItem(hand));
            getTE(world, pos).setSelectedStack(DankNullUtils.getSelectedStack(DankNullUtils.getInventoryFromHeld(player)));
            player.setHeldItem(hand, ItemStack.EMPTY);
            return true;
        }
        else if (player.getHeldItem(hand).isEmpty()) {
            if (!player.isSneaking()) {
                if (getTE(world, pos).getExtractionMode() == ExtractionMode.NORMAL) {
                    getTE(world, pos).setExtractionMode(ExtractionMode.SELECTED);
                    if (world.isRemote) {
                        player.sendMessage(new TextComponentString("Extraction mode: Only Selected Item Extracted"));
                    }
                }
                else {
                    getTE(world, pos).setExtractionMode(ExtractionMode.NORMAL);
                    if (world.isRemote) {
                        player.sendMessage(new TextComponentString("Extraction mode: All Items Extracted"));
                    }
                }
            }
            else {
                if (!getTE(world, pos).getStack().isEmpty()) {
                    player.setHeldItem(hand, getTE(world, pos).getStack());
                    getTE(world, pos).setStack(ItemStack.EMPTY);
                    getTE(world, pos).setSelectedStack(ItemStack.EMPTY);
                    getTE(world, pos).resetInventory();
                }
            }
            return true;
        }
    }
    return false;
}
项目:CustomWorldGen    文件:StatBase.java   
/**
 * 1.8.9
 */
public ITextComponent createChatComponent()
{
    ITextComponent itextcomponent = this.getStatName();
    ITextComponent itextcomponent1 = (new TextComponentString("[")).appendSibling(itextcomponent).appendText("]");
    itextcomponent1.setStyle(itextcomponent.getStyle());
    return itextcomponent1;
}
项目:Backmemed    文件:GuiConnecting.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == 0)
    {
        this.cancel = true;

        if (this.networkManager != null)
        {
            this.networkManager.closeChannel(new TextComponentString("Aborted"));
        }

        this.mc.displayGuiScreen(this.previousGuiScreen);
    }
}
项目:ForgeHax    文件:AutoLog.java   
@SubscribeEvent
public void onPacketRecieved(PacketEvent.Incoming.Pre event) {
    if (event.getPacket() instanceof SPacketSpawnPlayer) {
        if (disconnectOnNewPlayer.getAsBoolean()) {
            AutoReconnectMod.hasAutoLogged = true; // dont automatically reconnect
            UUID id = ((SPacketSpawnPlayer) event.getPacket()).getUniqueId();

            NetworkPlayerInfo info = MC.getConnection().getPlayerInfo(id);
            String name = info != null ? info.getGameProfile().getName() : "(Failed) " + id.toString();

            getNetworkManager().closeChannel(new TextComponentString(name + " entered render distance"));
            disable();
        }
    }
}
项目:ForgeHax    文件:GuiTextInput.java   
public void keyTyped(char typedChar, int keyCode) throws IOException {
    if (isActive) {
        switch (keyCode) {
            case Keyboard.KEY_ESCAPE:
                isActive = false;
                break;

            case Keyboard.KEY_RETURN:
                isActive = false;
                //setValue(input);
                MC.player.sendMessage(new TextComponentString(input.toString()));
                break;

            case Keyboard.KEY_BACK:
                if (selectedIndex > -1) {
                    input.deleteCharAt(selectedIndex);
                    selectedIndex--;
                }
                break;

            case Keyboard.KEY_LEFT:
                selectedIndex--;
                break;

            case Keyboard.KEY_RIGHT:
                selectedIndex++;
                break;

            default:
                if (isValidChar(typedChar)) {
                    selectedIndex++;
                    input.insert(selectedIndex, typedChar);
                }
        }
        selectedIndex = MathHelper.clamp(selectedIndex, -1, input.length()-1);
    }
}
项目:OpenFlexiTrack    文件:ChatPacket.java   
@Override
public IMessage onMessage(final ChatPacket message, final MessageContext ctx){
    FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(new Runnable(){
        @Override
        public void run(){
            Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentString(I18n.format(message.translatableMessage) + message.extraMessage));
        }
    });
    return null;
}