Search in sources :

Example 1 with GuiChat

use of net.minecraft.client.gui.GuiChat in project MinecraftForge by MinecraftForge.

the class ClientCommandHandler method autoComplete.

public void autoComplete(String leftOfCursor) {
    latestAutoComplete = null;
    if (leftOfCursor.charAt(0) == '/') {
        leftOfCursor = leftOfCursor.substring(1);
        Minecraft mc = FMLClientHandler.instance().getClient();
        if (mc.currentScreen instanceof GuiChat) {
            List<String> commands = getTabCompletions(mc.player, leftOfCursor, mc.player.getPosition());
            if (!commands.isEmpty()) {
                if (leftOfCursor.indexOf(' ') == -1) {
                    for (int i = 0; i < commands.size(); i++) {
                        commands.set(i, GRAY + "/" + commands.get(i) + RESET);
                    }
                } else {
                    for (int i = 0; i < commands.size(); i++) {
                        commands.set(i, GRAY + commands.get(i) + RESET);
                    }
                }
                latestAutoComplete = commands.toArray(new String[commands.size()]);
            }
        }
    }
}
Also used : GuiChat(net.minecraft.client.gui.GuiChat) Minecraft(net.minecraft.client.Minecraft)

Example 2 with GuiChat

use of net.minecraft.client.gui.GuiChat in project Railcraft by Railcraft.

the class AuraKeyHandler method tick.

@SubscribeEvent
public void tick(TickEvent.ClientTickEvent event) {
    if (Minecraft.getMinecraft().currentScreen instanceof GuiChat)
        return;
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    for (Map.Entry<GoggleAura, KeyBinding> keyBinding : keyBindings.entrySet()) {
        if (keyBinding.getValue().isPressed()) {
            GoggleAura aura = keyBinding.getKey();
            if (isAuraEnabled(aura)) {
                activeAuras.remove(aura);
                ChatPlugin.sendLocalizedChat(player, "gui.railcraft.aura.disable", "§5" + aura + "§7");
            } else {
                activeAuras.add(aura);
                ChatPlugin.sendLocalizedChat(player, "gui.railcraft.aura.enable", "§5" + aura + "§7");
            }
        }
    }
}
Also used : KeyBinding(net.minecraft.client.settings.KeyBinding) EntityPlayer(net.minecraft.entity.player.EntityPlayer) GuiChat(net.minecraft.client.gui.GuiChat) GoggleAura(mods.railcraft.common.items.ItemGoggles.GoggleAura) EnumMap(java.util.EnumMap) Map(java.util.Map) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 3 with GuiChat

use of net.minecraft.client.gui.GuiChat in project SimplyJetpacks by Tonius.

the class HUDTickHandler method tickEnd.

private static void tickEnd() {
    if (mc.thePlayer != null) {
        if ((mc.currentScreen == null || Config.showHUDWhileChatting && mc.currentScreen instanceof GuiChat) && !mc.gameSettings.hideGUI && !mc.gameSettings.showDebugInfo) {
            ItemStack chestplate = mc.thePlayer.getCurrentArmor(2);
            if (chestplate != null && chestplate.getItem() instanceof IHUDInfoProvider) {
                IHUDInfoProvider provider = (IHUDInfoProvider) chestplate.getItem();
                List<String> info = new ArrayList<String>();
                provider.addHUDInfo(info, chestplate, Config.enableFuelHUD, Config.enableStateHUD);
                if (info.isEmpty()) {
                    return;
                }
                GL11.glPushMatrix();
                mc.entityRenderer.setupOverlayRendering();
                GL11.glScaled(Config.HUDScale, Config.HUDScale, 1.0D);
                int i = 0;
                for (String s : info) {
                    RenderUtils.drawStringAtHUDPosition(s, HUDPositions.values()[Config.HUDPosition], mc.fontRenderer, Config.HUDOffsetX, Config.HUDOffsetY, Config.HUDScale, 0xeeeeee, true, i);
                    i++;
                }
                GL11.glPopMatrix();
            }
        }
    }
}
Also used : IHUDInfoProvider(tonius.simplyjetpacks.item.IHUDInfoProvider) ArrayList(java.util.ArrayList) GuiChat(net.minecraft.client.gui.GuiChat) ItemStack(net.minecraft.item.ItemStack)

Aggregations

GuiChat (net.minecraft.client.gui.GuiChat)3 ArrayList (java.util.ArrayList)1 EnumMap (java.util.EnumMap)1 Map (java.util.Map)1 GoggleAura (mods.railcraft.common.items.ItemGoggles.GoggleAura)1 Minecraft (net.minecraft.client.Minecraft)1 KeyBinding (net.minecraft.client.settings.KeyBinding)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 IHUDInfoProvider (tonius.simplyjetpacks.item.IHUDInfoProvider)1