Search in sources :

Example 76 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.

the class ChargeCommand method processCommand.

@Override
public void processCommand(ICommandSender sender, String[] args) {
    if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) {
        EntityPlayerMP player = (EntityPlayerMP) sender;
        if (args == null || args.length == 0) {
            sender.addChatMessage(new ChatComponentText("Charge amount: " + TecTech.anomalyHandler.getCharge(player)));
            return;
        }
        double amount;
        try {
            amount = Double.parseDouble(args[0]);
        } catch (NumberFormatException e) {
            sender.addChatMessage(new ChatComponentText("Cannot parse amount!"));
            return;
        }
        if (player.capabilities.isCreativeMode) {
            sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!"));
        } else {
            TecTech.anomalyHandler.setCharge(player, amount);
            sender.addChatMessage(new ChatComponentText("Charge set to: " + amount));
        }
    }
}
Also used : EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 77 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.

the class ConvertInteger method processCommand.

@Override
public void processCommand(ICommandSender sender, String[] args) {
    if (!sender.getEntityWorld().isRemote) {
        if (args.length == 1) {
            try {
                int value = Integer.parseInt(args[0]);
                sender.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + TT_Utility.intBitsToShortString(value) + " " + EnumChatFormatting.RESET + EnumChatFormatting.BLUE + value));
            } catch (Exception e) {
                sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Invalid Integer " + args[0]));
            }
        } else {
            sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
        }
    }
}
Also used : ChatComponentText(net.minecraft.util.ChatComponentText)

Example 78 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.

the class EMList method listClasses.

private void listClasses(ICommandSender sender) {
    sender.addChatMessage(new ChatComponentText("    Available Direct: name (use as parameter to learn more"));
    TecTech.definitionsRegistry.getDirectTypes().forEach((aClass, emDirectType) -> sender.addChatMessage(new ChatComponentText(emDirectType.getLocalizedName())));
    sender.addChatMessage(new ChatComponentText("    Available Indirect: tag - name"));
    TecTech.definitionsRegistry.getIndirectBinds().forEach((bind, emIndirectType) -> sender.addChatMessage(new ChatComponentText(bind + " - " + emIndirectType.getLocalizedName())));
}
Also used : ChatComponentText(net.minecraft.util.ChatComponentText)

Example 79 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.

the class CancerCommand method processCommand.

@Override
public void processCommand(ICommandSender sender, String[] args) {
    if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) {
        EntityPlayerMP player = (EntityPlayerMP) sender;
        if (args == null || args.length == 0) {
            sender.addChatMessage(new ChatComponentText("Cancer amount: " + TecTech.anomalyHandler.getCancer(player)));
            return;
        }
        double amount;
        try {
            amount = Double.parseDouble(args[0]);
        } catch (NumberFormatException e) {
            sender.addChatMessage(new ChatComponentText("Cannot parse amount!"));
            return;
        }
        if (player.capabilities.isCreativeMode) {
            sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!"));
        } else {
            TecTech.anomalyHandler.setCancer(player, amount);
            sender.addChatMessage(new ChatComponentText("Cancer set to: " + amount));
        }
    }
}
Also used : EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 80 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.

the class ConvertFloat method processCommand.

@Override
public void processCommand(ICommandSender sender, String[] args) {
    if (!sender.getEntityWorld().isRemote) {
        if (args.length == 1) {
            try {
                float value = Float.parseFloat(args[0]);
                sender.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + TT_Utility.intBitsToShortString(Float.floatToIntBits(value)) + " " + EnumChatFormatting.RESET + EnumChatFormatting.BLUE + value));
            } catch (Exception e) {
                sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Invalid Float " + args[0]));
            }
        } else {
            sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
        }
    }
}
Also used : ChatComponentText(net.minecraft.util.ChatComponentText)

Aggregations

ChatComponentText (net.minecraft.util.ChatComponentText)383 IChatComponent (net.minecraft.util.IChatComponent)55 EntityPlayer (net.minecraft.entity.player.EntityPlayer)43 ChatStyle (net.minecraft.util.ChatStyle)39 ItemStack (net.minecraft.item.ItemStack)36 ClickEvent (net.minecraft.event.ClickEvent)31 World (net.minecraft.world.World)28 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)26 TileEntity (net.minecraft.tileentity.TileEntity)25 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)25 HoverEvent (net.minecraft.event.HoverEvent)23 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)21 ArrayList (java.util.ArrayList)17 RfToolsDimensionManager (mcjty.rftools.dimension.RfToolsDimensionManager)16 Block (net.minecraft.block.Block)15 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)15 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)14 Entity (net.minecraft.entity.Entity)14 DimensionInformation (mcjty.rftools.dimension.DimensionInformation)13 File (java.io.File)12