Search in sources :

Example 46 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.

the class HelpfulMethods method sendMessageToPlayer.

public static void sendMessageToPlayer(EntityPlayer par1EntityPlayer, String par2, EnumChatFormatting par3) {
    ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(par2, new Object[0]);
    if (par3 != null) {
        chatcomponenttranslation.getChatStyle().setColor(par3);
    }
    par1EntityPlayer.addChatComponentMessage(chatcomponenttranslation);
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation)

Example 47 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.

the class HelpfulMethods method sendMessage.

public static void sendMessage(ICommandSender par1ICommandSender, String par2, EnumChatFormatting par3) {
    ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(par2, new Object[0]);
    chatcomponenttranslation.getChatStyle().setColor(par3);
    par1ICommandSender.addChatMessage(chatcomponenttranslation);
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation)

Example 48 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.

the class CommandSCHelp method sendMessageToPlayer.

private void sendMessageToPlayer(String par1, ICommandSender par2) {
    ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(par1, new Object[0]);
    ((EntityPlayerMP) getPlayer(par2, par2.getCommandSenderName())).addChatComponentMessage(chatcomponenttranslation);
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 49 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.

the class BlockCageTrap method onEntityIntersected.

@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
    if (!world.isRemote) {
        TileEntityCageTrap tileEntity = (TileEntityCageTrap) world.getTileEntity(pos);
        boolean isPlayer = entity instanceof EntityPlayer;
        boolean shouldCaptureMobs = tileEntity.getOptionByName("captureMobs").asBoolean();
        if (isPlayer || (entity instanceof EntityMob && shouldCaptureMobs)) {
            if ((isPlayer && ((IOwnable) world.getTileEntity(pos)).getOwner().isOwner((EntityPlayer) entity)))
                return;
            if (BlockUtils.getBlockPropertyAsBoolean(world, pos, DEACTIVATED))
                return;
            BlockUtils.setBlockProperty(world, pos, DEACTIVATED, true);
            BlockUtils.setBlock(world, pos.up(4), SCContent.unbreakableIronBars);
            BlockUtils.setBlock(world, pos.getX() + 1, pos.getY() + 4, pos.getZ(), SCContent.unbreakableIronBars);
            BlockUtils.setBlock(world, pos.getX() - 1, pos.getY() + 4, pos.getZ(), SCContent.unbreakableIronBars);
            BlockUtils.setBlock(world, pos.getX(), pos.getY() + 4, pos.getZ() + 1, SCContent.unbreakableIronBars);
            BlockUtils.setBlock(world, pos.getX(), pos.getY() + 4, pos.getZ() - 1, SCContent.unbreakableIronBars);
            BlockUtils.setBlockInBox(world, pos.getX(), pos.getY(), pos.getZ(), SCContent.unbreakableIronBars);
            setTileEntities(world, pos.getX(), pos.getY(), pos.getZ(), ((IOwnable) world.getTileEntity(pos)).getOwner().getUUID(), ((IOwnable) world.getTileEntity(pos)).getOwner().getName());
            world.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "random.anvil_use", 3.0F, 1.0F);
            if (isPlayer)
                MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation("[" + EnumChatFormatting.BLACK + StatCollector.translateToLocal("tile.cageTrap.name") + EnumChatFormatting.RESET + "] " + StatCollector.translateToLocal("messages.cageTrap.captured").replace("#player", ((EntityPlayer) entity).getCommandSenderName()).replace("#location", Utils.getFormattedCoordinates(pos))));
        }
    }
}
Also used : TileEntityCageTrap(net.geforcemods.securitycraft.tileentity.TileEntityCageTrap) EntityMob(net.minecraft.entity.monster.EntityMob) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) EntityPlayer(net.minecraft.entity.player.EntityPlayer) IOwnable(net.geforcemods.securitycraft.api.IOwnable)

Example 50 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project Galacticraft by micdoodle8.

the class NEIServerUtils method givePlayerItem.

public static void givePlayerItem(EntityPlayerMP player, ItemStack stack, boolean infinite, boolean doGive) {
    if (stack.getItem() == null) {
        player.addChatComponentMessage(setColour(new ChatComponentTranslation("nei.chat.give.noitem"), EnumChatFormatting.WHITE));
        return;
    }
    int given = stack.stackSize;
    if (doGive) {
        if (infinite) {
            player.inventory.addItemStackToInventory(stack);
        } else {
            given -= InventoryUtils.insertItem(player.inventory, stack, false);
        }
    }
    sendNotice(player, new ChatComponentTranslation("commands.give.success", stack.getChatComponent(), infinite ? "\u221E" : Integer.toString(given), player.getName()), "notify-item");
    player.openContainer.detectAndSendChanges();
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation)

Aggregations

ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)89 ItemStack (net.minecraft.item.ItemStack)21 TileEntity (net.minecraft.tileentity.TileEntity)15 EntityPlayer (net.minecraft.entity.player.EntityPlayer)14 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)11 ChatComponentText (net.minecraft.util.ChatComponentText)6 ArrayList (java.util.ArrayList)5 Block (net.minecraft.block.Block)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 World (net.minecraft.world.World)4 Item1N4148 (club.nsdn.nyasamarailway.item.tool.Item1N4148)3 ItemNTP32Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP32Bit)3 ItemNTP8Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP8Bit)3 TileEntityActuator (club.nsdn.nyasamatelecom.api.tileentity.TileEntityActuator)3 BufferedImage (java.awt.image.BufferedImage)3 IChatComponent (net.minecraft.util.IChatComponent)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 Int3 (WayofTime.alchemicalWizardry.api.Int3)2 TEReagentConduit (WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit)2 TrainPacket (club.nsdn.nyasamarailway.network.TrainPacket)2