Search in sources :

Example 51 with ChatComponentText

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

the class TileLauncherScreen method onPlayerActivated.

@Override
public boolean onPlayerActivated(EntityPlayer player, int side, Pos hit) {
    if (isServer()) {
        boolean notNull = player.getHeldItem() != null;
        if (notNull && player.getHeldItem().getItem() == Items.redstone) {
            if (canLaunch()) {
                launch();
            } else {
                player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.failedToFire")));
                String translation = LanguageUtility.getLocal("chat.launcher.status");
                translation = translation.replace("%1", getStatus());
                player.addChatComponentMessage(new ChatComponentText(translation));
            }
        } else if (notNull && player.getHeldItem().getItem() instanceof ItemRemoteDetonator) {
            ((ItemRemoteDetonator) player.getHeldItem().getItem()).setBroadCastHz(player.getHeldItem(), getFrequency());
            player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.toolFrequencySet").replace("%1", "" + getFrequency())));
        } else if (notNull && player.getHeldItem().getItem() instanceof IWorldPosItem) {
            IWorldPosition location = ((IWorldPosItem) player.getHeldItem().getItem()).getLocation(player.getHeldItem());
            if (location != null) {
                if (location.world() == world()) {
                    setTarget(new Pos(location.x(), location.y(), location.z()));
                    player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.toolTargetSet")));
                } else {
                    player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.toolWorldNotMatch")));
                }
            } else {
                player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.noTargetInTool")));
            }
        } else {
            player.openGui(ICBMClassic.INSTANCE, 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
        }
    }
    return true;
}
Also used : Pos(com.builtbroken.mc.imp.transform.vector.Pos) IWorldPosition(com.builtbroken.mc.api.IWorldPosition) IWorldPosItem(com.builtbroken.mc.api.items.tools.IWorldPosItem) ChatComponentText(net.minecraft.util.ChatComponentText) ItemRemoteDetonator(icbm.classic.content.items.ItemRemoteDetonator)

Example 52 with ChatComponentText

use of net.minecraft.util.ChatComponentText in project LogisticsPipes by RS485.

the class MeCommand method executeCommand.

@Override
public void executeCommand(ICommandSender sender, String[] args) {
    DebugGuiController.instance().startWatchingOf(sender, (EntityPlayer) sender);
    sender.addChatMessage(new ChatComponentText("Starting SelfDebuging"));
}
Also used : ChatComponentText(net.minecraft.util.ChatComponentText)

Example 53 with ChatComponentText

use of net.minecraft.util.ChatComponentText in project LogisticsPipes by RS485.

the class PipeCommand method executeCommand.

@Override
public void executeCommand(ICommandSender sender, String[] args) {
    if (args.length != 1) {
        sender.addChatMessage(new ChatComponentText("Wrong amount of arguments"));
        return;
    }
    if (args[0].equalsIgnoreCase("help")) {
        sender.addChatMessage(new ChatComponentText("client, server, both or console"));
    } else if (args[0].equalsIgnoreCase("both")) {
        MainProxy.sendPacketToPlayer(PacketHandler.getPacket(PipeDebugAskForTarget.class).setServer(true), (EntityPlayer) sender);
        MainProxy.sendPacketToPlayer(PacketHandler.getPacket(PipeDebugAskForTarget.class).setServer(false), (EntityPlayer) sender);
        sender.addChatMessage(new ChatComponentText("Asking for Target."));
    } else if (args[0].equalsIgnoreCase("console") || args[0].equalsIgnoreCase("c")) {
        MainProxy.sendPacketToPlayer(PacketHandler.getPacket(PipeDebugLogAskForTarget.class), (EntityPlayer) sender);
        sender.addChatMessage(new ChatComponentText("Asking for Target."));
    } else {
        boolean isClient = args[0].equalsIgnoreCase("client");
        MainProxy.sendPacketToPlayer(PacketHandler.getPacket(PipeDebugAskForTarget.class).setServer(!isClient), (EntityPlayer) sender);
        sender.addChatMessage(new ChatComponentText("Asking for Target."));
    }
}
Also used : PipeDebugLogAskForTarget(logisticspipes.network.packets.debug.PipeDebugLogAskForTarget) PipeDebugAskForTarget(logisticspipes.network.packets.pipe.PipeDebugAskForTarget) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 54 with ChatComponentText

use of net.minecraft.util.ChatComponentText in project LogisticsPipes by RS485.

the class ShowCommand method executeCommand.

@Override
public void executeCommand(ICommandSender sender, String[] args) {
    if (args.length != 1) {
        sender.addChatMessage(new ChatComponentText("Wrong amount of arguments"));
        return;
    }
    String name = args[0];
    List<AbstractWrapper> list = new ArrayList<>(LogisticsWrapperHandler.wrapperController);
    Iterator<AbstractWrapper> iter = list.iterator();
    while (iter.hasNext()) {
        AbstractWrapper item = iter.next();
        if (item.getState() != WrapperState.Exception) {
            iter.remove();
        }
    }
    iter = list.iterator();
    while (iter.hasNext()) {
        AbstractWrapper item = iter.next();
        if (!(item.getName() + item.getTypeName()).startsWith(name)) {
            iter.remove();
        }
    }
    if (list.size() > 1) {
        sender.addChatMessage(new ChatComponentText("Possible: "));
        for (AbstractWrapper can : list) {
            sender.addChatMessage(new ChatComponentText(can.getName() + can.getTypeName()));
        }
    } else if (list.isEmpty()) {
        sender.addChatMessage(new ChatComponentText("No match found"));
    } else {
        AbstractWrapper wrapper = list.get(0);
        Throwable t = wrapper.getReason();
        if (t == null) {
            sender.addChatMessage(new ChatComponentText("null"));
            return;
        } else {
            sender.addChatMessage(new ChatComponentText("-----------------------------------------------------"));
            sender.addChatMessage(new ChatComponentText(t.toString()));
            for (StackTraceElement s : t.getStackTrace()) {
                sender.addChatMessage(new ChatComponentText(" " + s.toString()));
            }
            t.printStackTrace();
        }
    }
}
Also used : AbstractWrapper(logisticspipes.asm.wrapper.AbstractWrapper) ArrayList(java.util.ArrayList) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 55 with ChatComponentText

use of net.minecraft.util.ChatComponentText in project LogisticsPipes by RS485.

the class ChangelogCommand method executeCommand.

@Override
public void executeCommand(ICommandSender sender, String[] args) {
    VersionChecker versionChecker = LogisticsPipes.versionChecker;
    String statusMessage = versionChecker.getVersionCheckerStatus();
    if (versionChecker.isVersionCheckDone() && versionChecker.getVersionInfo().isNewVersionAvailable()) {
        VersionChecker.VersionInfo versionInfo = versionChecker.getVersionInfo();
        MorePageDisplay display = new MorePageDisplay(new String[] { "(The newest version is #" + versionInfo.getNewestBuild() + ")", "< Changelog Page %/$ >" }, sender);
        if (versionInfo.getChangelog().isEmpty()) {
            display.append("No commits since your version.");
        } else {
            versionInfo.getChangelog().forEach(display::append);
        }
        display.display(sender);
    } else {
        sender.addChatMessage(new ChatComponentText(statusMessage));
    }
}
Also used : VersionChecker(logisticspipes.ticks.VersionChecker) ChatComponentText(net.minecraft.util.ChatComponentText) MorePageDisplay(logisticspipes.commands.chathelper.MorePageDisplay)

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