Package net.minecraft.util

Examples of net.minecraft.util.ChatComponentText


    @Override
    public void onEvent(EntityPlayer player)
    {
      String themedLines = getThemedLines(new EnumColor[] {EnumColor.WHITE, EnumColor.YELLOW}, 13);
      player.addChatMessage(new ChatComponentText(themedLines + EnumColor.DARK_BLUE + "[Mekanism]" + themedLines));
      player.addChatMessage(new ChatComponentText(EnumColor.AQUA + "Happy New Year, " + EnumColor.DARK_BLUE + player.getCommandSenderName() + EnumColor.RED + "!"));
      player.addChatMessage(new ChatComponentText(EnumColor.AQUA + "Best wishes to you as we enter this"));
      player.addChatMessage(new ChatComponentText(EnumColor.AQUA + "new and exciting year of " + calendar.get(Calendar.YEAR) + "! :)"));
      player.addChatMessage(new ChatComponentText(EnumColor.DARK_GREY + "-aidancbrady"));
      player.addChatMessage(new ChatComponentText(themedLines + EnumColor.DARK_BLUE + "[=======]" + themedLines));
    }
View Full Code Here


    {
      connectionTypes[hit.subHit] = connectionTypes[hit.subHit].next();
      sendDesc = true;

      onModeChange(ForgeDirection.getOrientation(side));
      player.addChatMessage(new ChatComponentText("Connection type changed to " + connectionTypes[hit.subHit].toString()));

      return true;
    }
    else {
      return onConfigure(player, hit.subHit, side);
View Full Code Here

  {
    redstoneReactive ^= true;
    refreshConnections();
    tile().notifyPartChange(this);

    player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Redstone sensitivity turned " + EnumColor.INDIGO + (redstoneReactive ? "on." : "off.")));
    return true;
  }
View Full Code Here

        {
          IInvConfiguration config = (IInvConfiguration)tile;

          if(!player.isSneaking())
          {
            player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.viewColor") + ": " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName()));
            return true;
          }
          else {
            if(getEnergy(stack) >= ENERGY_PER_CONFIGURE)
            {
              setEnergy(stack, getEnergy(stack) - ENERGY_PER_CONFIGURE);
              MekanismUtils.incrementOutput(config, MekanismUtils.getBaseOrientation(side, config.getOrientation()));
              player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.toggleColor") + ": " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName()));

              if(config instanceof TileEntityBasicBlock)
              {
                TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)config;
                Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity)));
              }

              return true;
            }
          }
        }
        else if(tile instanceof IConfigurable)
        {
          IConfigurable config = (IConfigurable)tile;

          if(player.isSneaking())
          {
            return config.onSneakRightClick(player, side);
          }
          else {
            return config.onRightClick(player, side);
          }
        }
      }
      else if(getState(stack) == 1) //Empty
      {
        if(tile instanceof IInventory)
        {
          IInventory inv = (IInventory)tile;

          if(!(inv instanceof TileEntityElectricChest) || (((TileEntityElectricChest)inv).canAccess()))
          {
            for(int i = 0; i < inv.getSizeInventory(); i++)
            {
              ItemStack slotStack = inv.getStackInSlot(i);

              if(slotStack != null)
              {
                if(getEnergy(stack) < ENERGY_PER_ITEM_DUMP)
                {
                  break;
                }

                float xRandom = random.nextFloat() * 0.8F + 0.1F;
                float yRandom = random.nextFloat() * 0.8F + 0.1F;
                float zRandom = random.nextFloat() * 0.8F + 0.1F;

                while(slotStack.stackSize > 0)
                {
                  int j = random.nextInt(21) + 10;

                  if(j > slotStack.stackSize)
                  {
                    j = slotStack.stackSize;
                  }

                  slotStack.stackSize -= j;
                  EntityItem item = new EntityItem(world, x + xRandom, y + yRandom, z + zRandom, new ItemStack(slotStack.getItem(), j, slotStack.getItemDamage()));

                  if(slotStack.hasTagCompound())
                  {
                    item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
                  }

                  float k = 0.05F;
                  item.motionX = random.nextGaussian() * k;
                  item.motionY = random.nextGaussian() * k + 0.2F;
                  item.motionZ = random.nextGaussian() * k;
                  world.spawnEntityInWorld(item);

                  inv.setInventorySlotContents(i, null);
                  setEnergy(stack, getEnergy(stack) - ENERGY_PER_ITEM_DUMP);
                }
              }
            }

            return true;
          }
          else {
            player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + MekanismUtils.localize("tooltip.configurator.unauth")));
            return true;
          }
        }
      }
      else if(getState(stack) == 2) //Rotate
View Full Code Here

  @Override
  public void processCommand(ICommandSender sender, String[] params)
  {
    if(params.length < 1)
    {
      sender.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
      sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Version: " + EnumColor.DARK_GREY + Mekanism.versionNumber));
      sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Latest Version: " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber));
      sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Developed on Mac OS X 10.8 Mountain Lion"));
      sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Code, textures, and ideas by aidancbrady"));
      sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Recent News: " + EnumColor.INDIGO + Mekanism.recentNews));
      sender.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
    }
    else if(params.length == 1)
    {
      if(params[0].equalsIgnoreCase("help"))
      {
        sender.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
        sender.addChatMessage(new ChatComponentText(EnumColor.INDIGO + " /mk" + EnumColor.GREY + " -- displays the main page."));
        sender.addChatMessage(new ChatComponentText(EnumColor.INDIGO + " /mk help" + EnumColor.GREY + " -- displays this guide."));
        sender.addChatMessage(new ChatComponentText(EnumColor.INDIGO + " /mk version" + EnumColor.GREY + " -- displays the version number."));
        sender.addChatMessage(new ChatComponentText(EnumColor.INDIGO + " /mk latest" + EnumColor.GREY + " -- displays the latest version number."));
        sender.addChatMessage(new ChatComponentText(EnumColor.INDIGO + " /mk news" + EnumColor.GREY + " -- displays most recent recent news."));
        sender.addChatMessage(new ChatComponentText(EnumColor.INDIGO + " /mk debug" + EnumColor.GREY + " -- toggles Mekanism's debug mode."));
        sender.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
      }
      else if(params[0].equalsIgnoreCase("version"))
      {
        if(!MekanismUtils.checkForUpdates((EntityPlayer)sender))
        {
          if(Mekanism.updateNotifications || Mekanism.latestVersionNumber == null || Mekanism.recentNews == null || Mekanism.latestVersionNumber.equals("null"))
          {
            sender.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Minecraft is in offline mode, could not check for updates."));
          }
          else {
            sender.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Your client is up to date."));
          }
        }
      }
      else if(params[0].equalsIgnoreCase("news"))
      {
        sender.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Most recent news: " + EnumColor.INDIGO + Mekanism.recentNews));
      }
      else if(params[0].equalsIgnoreCase("latest"))
      {
        sender.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " The latest version for this mod is " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber + EnumColor.GREY + "."));
      }
      else if(params[0].equalsIgnoreCase("debug"))
      {
        Mekanism.debug = !Mekanism.debug;
        sender.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Debug mode set to " + EnumColor.DARK_GREY + Mekanism.debug));
      }
      else {
        sender.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Unknown command. Type '" + EnumColor.INDIGO + "/mk help" + EnumColor.GREY + "' for help."));
      }
    }
  }
View Full Code Here

        {
          setEnergy(stack, getEnergy(stack)-ENERGY_PER_USE);

          IGridTransmitter<?> transmitter = (IGridTransmitter<?>)tileEntity;

          player.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
          player.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Transmitters: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getSize()));
          player.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getAcceptorSize()));
          player.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Needed: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getNeededInfo()));
          player.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Buffer: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getStoredInfo()));
          player.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Throughput: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getFlowInfo()));
          player.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Capacity: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getCapacity()));
          player.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
        }
      }

      if(player.isSneaking() && Mekanism.debug)
      {
        String[] strings = TransmitterNetworkRegistry.getInstance().toStrings();
        player.addChatMessage(new ChatComponentText(EnumColor.GREY + "---------- " + EnumColor.DARK_BLUE + "[Mekanism Debug]" + EnumColor.GREY + " ----------"));

        for(String s : strings)
        {
          player.addChatMessage(new ChatComponentText(EnumColor.DARK_GREY + s));
        }

        player.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
      }
    }

    return false;
  }
View Full Code Here

  public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
  {
    if(!world.isRemote && entityplayer.isSneaking())
    {
      toggleMode(itemstack);
      entityplayer.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + MekanismUtils.localize("tooltip.modeToggle") + " " + EnumColor.INDIGO + getModeName(itemstack) + EnumColor.AQUA + " (" + getEfficiency(itemstack) + ")"));
    }

    return itemstack;
  }
View Full Code Here

     * @param color The color of the message.
     * @param message The message to send.
     */
    private void sendMessage(EnumChatFormatting color, String message)
    {
        IChatComponent chat = new ChatComponentText(PluginStandardValues.PLUGIN_NAME + ": " + message);

        ChatStyle chatStyle = new ChatStyle();
        chatStyle.setColor(color);
        chat.setChatStyle(chatStyle);

        Minecraft.getMinecraft().thePlayer.addChatMessage(chat);
    }
View Full Code Here

  @Override
  public boolean onSneakRightClick(EntityPlayer player, int side)
  {
    recurringNodes.clear();

    player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + MekanismUtils.localize("tooltip.configurator.pumpReset")));

    return true;
  }
View Full Code Here

  {
    activeNodes.clear();
    usedNodes.clear();
    finishedCalc = false;
   
    player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + MekanismUtils.localize("tooltip.configurator.plenisherReset")));

    return true;
  }
View Full Code Here

TOP

Related Classes of net.minecraft.util.ChatComponentText

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.