Search in sources :

Example 66 with ChatComponentText

use of net.minecraft.util.ChatComponentText in project watson by totemo.

the class WatsonCommandBase method sendColouredText.

// --------------------------------------------------------------------------
/**
   * Send a message to the specified command sender in the specified colour.
   * 
   * @param sender the command sender who is the message recipient.
   * @param colour the colour.
   * @param message the text.
   */
public void sendColouredText(ICommandSender sender, EnumChatFormatting colour, String message) {
    ChatComponentText chat = new ChatComponentText(message);
    ChatStyle style = new ChatStyle();
    style.setColor(colour);
    chat.setChatStyle(style);
    sender.addChatMessage(chat);
}
Also used : ChatStyle(net.minecraft.util.ChatStyle) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 67 with ChatComponentText

use of net.minecraft.util.ChatComponentText in project watson by totemo.

the class Chat method localChat.

// --------------------------------------------------------------------------
/**
   * Display a chat message locally.
   * 
   * @param colour the colour to format the text as.
   * @param message the text to display.
   */
public static void localChat(EnumChatFormatting colour, String message) {
    ChatComponentText chat = new ChatComponentText(message);
    ChatStyle style = new ChatStyle();
    style.setColor(colour);
    chat.setChatStyle(style);
    localChat(chat);
}
Also used : ChatStyle(net.minecraft.util.ChatStyle) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 68 with ChatComponentText

use of net.minecraft.util.ChatComponentText in project ICBM-Classic by BuiltBrokenModding.

the class TileRadarStation method onPlayerRightClick.

@Override
protected boolean onPlayerRightClick(EntityPlayer entityPlayer, int side, Pos hit) {
    if (entityPlayer.inventory.getCurrentItem() != null) {
        if (WrenchUtility.isUsableWrench(entityPlayer, entityPlayer.inventory.getCurrentItem(), this.xCoord, this.yCoord, this.zCoord)) {
            if (!this.worldObj.isRemote) {
                this.emitAll = !this.emitAll;
                entityPlayer.addChatMessage(new ChatComponentText(LanguageUtility.getLocal("message.radar.redstone") + " " + this.emitAll));
            }
            return true;
        }
    }
    if (isServer()) {
        entityPlayer.openGui(ICBMClassic.INSTANCE, 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
    }
    return true;
}
Also used : ChatComponentText(net.minecraft.util.ChatComponentText)

Example 69 with ChatComponentText

use of net.minecraft.util.ChatComponentText in project ICBM-Classic by BuiltBrokenModding.

the class TileCamouflage method onPlayerRightClickWrench.

@Override
protected boolean onPlayerRightClickWrench(EntityPlayer player, int side, Pos hit) {
    if (player.canPlayerEdit(xi(), yi(), zi(), side, player.getHeldItem())) {
        //TODO ensure there is a permission flag for editing in global list so its not an (eta all)
        if (owner == null || owner.equals(player.getGameProfile().getId())) {
            if (isServer()) {
                if (player.isSneaking()) {
                    toggleCollision();
                    player.addChatComponentMessage(new ChatComponentText("Collision set to " + getCanCollide()));
                } else {
                    toggleRenderSide(ForgeDirection.getOrientation(side));
                    player.addChatComponentMessage(new ChatComponentText("Side set to render: " + canRenderSide(ForgeDirection.getOrientation(side))));
                }
            }
            return true;
        } else if (Engine.runningAsDev && isServer()) {
            player.addChatComponentMessage(new ChatComponentText("No perms"));
        }
    } else if (Engine.runningAsDev && isServer()) {
        player.addChatComponentMessage(new ChatComponentText("Empty hand or can not edit"));
    }
    return false;
}
Also used : ChatComponentText(net.minecraft.util.ChatComponentText)

Example 70 with ChatComponentText

use of net.minecraft.util.ChatComponentText in project ICBM-Classic by BuiltBrokenModding.

the class ItemGrenade method onPlayerStoppedUsing.

@Override
public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer entityPlayer, int nengLiang) {
    if (!world.isRemote) {
        Explosives zhaPin = Explosives.get(itemStack.getItemDamage());
        ExplosivePreDetonationEvent evt = new ExplosivePreDetonationEvent(world, entityPlayer, ExplosiveType.ITEM, zhaPin.handler);
        MinecraftForge.EVENT_BUS.post(evt);
        if (!evt.isCanceled()) {
            if (!entityPlayer.capabilities.isCreativeMode) {
                itemStack.stackSize--;
                if (itemStack.stackSize <= 0) {
                    entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
                }
            }
            world.playSoundAtEntity(entityPlayer, "random.fuse", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
            world.spawnEntityInWorld(new EntityGrenade(world, entityPlayer, zhaPin, (float) (this.getMaxItemUseDuration(itemStack) - nengLiang) / (float) this.getMaxItemUseDuration(itemStack)));
        } else {
            entityPlayer.addChatMessage(new ChatComponentText("Grenades are banned in this region."));
        }
    }
}
Also used : ExplosivePreDetonationEvent(resonant.api.explosion.ExplosionEvent.ExplosivePreDetonationEvent) EntityGrenade(icbm.classic.content.entity.EntityGrenade) Explosives(icbm.classic.content.explosive.Explosives) ChatComponentText(net.minecraft.util.ChatComponentText)

Aggregations

ChatComponentText (net.minecraft.util.ChatComponentText)108 EntityPlayer (net.minecraft.entity.player.EntityPlayer)19 ItemStack (net.minecraft.item.ItemStack)16 TileEntity (net.minecraft.tileentity.TileEntity)9 Entity (net.minecraft.entity.Entity)8 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)7 ArrayList (java.util.ArrayList)7 Block (net.minecraft.block.Block)6 AMVector3 (am2.api.math.AMVector3)4 AccessGroup (com.builtbroken.mc.framework.access.AccessGroup)4 Pos (com.builtbroken.mc.imp.transform.vector.Pos)4 OpenChatGui (logisticspipes.network.packets.gui.OpenChatGui)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 ChatStyle (net.minecraft.util.ChatStyle)4 IPowerNode (am2.api.power.IPowerNode)3 IItemActivationListener (com.builtbroken.mc.api.items.listeners.IItemActivationListener)3 IItemEventListener (com.builtbroken.mc.api.items.listeners.IItemEventListener)3 AbstractCommand (com.builtbroken.mc.core.commands.prefab.AbstractCommand)3 ItemListenerIterator (com.builtbroken.mc.prefab.items.listeners.ItemListenerIterator)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3