Search in sources :

Example 6 with GuiScreen

use of net.minecraft.client.gui.GuiScreen in project PneumaticCraft by MineMaarten.

the class GuiProgrammer method mouseClicked.

@Override
protected void mouseClicked(int x, int y, int par3) {
    ItemStack programmedItem = te.getStackInSlot(TileEntityProgrammer.PROGRAM_SLOT);
    if (nameField.isFocused() && programmedItem != null) {
        programmedItem.setStackDisplayName(nameField.getText());
        NetworkHandler.sendToServer(new PacketUpdateTextfield(te, 0));
    }
    super.mouseClicked(x, y, par3);
    if (par3 == 1 && showingWidgetProgress == 0) {
        IProgWidget widget = programmerUnit.getHoveredWidget(x, y);
        if (widget != null) {
            GuiScreen screen = widget.getOptionWindow(this);
            if (screen != null)
                mc.displayGuiScreen(screen);
        }
    }
}
Also used : PacketUpdateTextfield(pneumaticCraft.common.network.PacketUpdateTextfield) IProgWidget(pneumaticCraft.common.progwidgets.IProgWidget) GuiScreen(net.minecraft.client.gui.GuiScreen) ItemStack(net.minecraft.item.ItemStack)

Example 7 with GuiScreen

use of net.minecraft.client.gui.GuiScreen in project PneumaticCraft by MineMaarten.

the class GuiDroneDebuggerOptions method initGui.

@Override
public void initGui(IGuiScreen gui) {
    GuiScreen guiScreen = (GuiScreen) gui;
    screenWidth = guiScreen.width;
    screenHeight = guiScreen.height;
    if (PneumaticCraft.proxy.getPlayer() != null) {
        ItemStack helmet = PneumaticCraft.proxy.getPlayer().getCurrentArmor(3);
        if (helmet != null) {
            int entityId = NBTUtil.getInteger(helmet, NBTKeys.PNEUMATIC_HELMET_DEBUGGING_DRONE);
            Entity entity = PneumaticCraft.proxy.getClientWorld().getEntityByID(entityId);
            if (entity instanceof EntityDrone) {
                selectedDrone = (EntityDrone) entity;
            }
        }
    }
    int spacing = 20;
    programmingStartX = spacing;
    programmingWidth = guiScreen.width - spacing * 2;
    programmingHeight = guiScreen.height - spacing - PROGRAMMING_START_Y;
    programmerUnit = new DebugInfoProgrammerUnit(selectedDrone != null ? selectedDrone.getProgWidgets() : new ArrayList<IProgWidget>(), gui.getFontRenderer(), 0, 0, guiScreen.width, guiScreen.height, 100, programmingStartX, PROGRAMMING_START_Y, programmingWidth, programmingHeight, 0, 0, 0);
    if (selectedDrone != null) {
        for (IProgWidget widget : selectedDrone.getProgWidgets()) {
            if (widget instanceof ProgWidgetStart) {
                programmerUnit.gotoPiece(widget);
                break;
            }
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) IProgWidget(pneumaticCraft.common.progwidgets.IProgWidget) EntityDrone(pneumaticCraft.common.entity.living.EntityDrone) IGuiScreen(pneumaticCraft.api.client.pneumaticHelmet.IGuiScreen) GuiScreen(net.minecraft.client.gui.GuiScreen) ItemStack(net.minecraft.item.ItemStack) ProgWidgetStart(pneumaticCraft.common.progwidgets.ProgWidgetStart)

Example 8 with GuiScreen

use of net.minecraft.client.gui.GuiScreen in project PneumaticCraft by MineMaarten.

the class PacketSetGlobalVariable method handleClientSide.

@Override
@SideOnly(Side.CLIENT)
public void handleClientSide(PacketSetGlobalVariable message, EntityPlayer player) {
    handleServerSide(message, player);
    GuiScreen screen = Minecraft.getMinecraft().currentScreen;
    if (screen instanceof GuiRemote) {
        ((GuiRemote) screen).onGlobalVariableChange(message.varName);
    }
}
Also used : GuiRemote(pneumaticCraft.client.gui.GuiRemote) GuiScreen(net.minecraft.client.gui.GuiScreen) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 9 with GuiScreen

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

the class FMLClientHandler method showGuiScreen.

@Override
public void showGuiScreen(@Nullable Object clientGuiElement) {
    GuiScreen gui = (GuiScreen) clientGuiElement;
    client.displayGuiScreen(gui);
}
Also used : GuiScreen(net.minecraft.client.gui.GuiScreen)

Example 10 with GuiScreen

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

the class GuiModList method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) throws IOException {
    if (button.enabled) {
        SortType type = SortType.getTypeForButton(button);
        if (type != null) {
            for (GuiButton b : buttonList) {
                if (SortType.getTypeForButton(b) != null) {
                    b.enabled = true;
                }
            }
            button.enabled = false;
            sorted = false;
            sortType = type;
            this.mods = modList.getMods();
        } else {
            switch(button.id) {
                case 6:
                    {
                        this.mc.displayGuiScreen(this.mainMenu);
                        return;
                    }
                case 20:
                    {
                        try {
                            IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
                            GuiScreen newScreen = guiFactory.mainConfigGuiClass().getConstructor(GuiScreen.class).newInstance(this);
                            this.mc.displayGuiScreen(newScreen);
                        } catch (Exception e) {
                            FMLLog.log(Level.ERROR, e, "There was a critical issue trying to build the config GUI for %s", selectedMod.getModId());
                        }
                        return;
                    }
            }
        }
    }
    super.actionPerformed(button);
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) GuiScreen(net.minecraft.client.gui.GuiScreen) IOException(java.io.IOException)

Aggregations

GuiScreen (net.minecraft.client.gui.GuiScreen)14 SideOnly (cpw.mods.fml.relauncher.SideOnly)5 ItemStack (net.minecraft.item.ItemStack)3 IProgWidget (pneumaticCraft.common.progwidgets.IProgWidget)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 GuiContainer (net.minecraft.client.gui.inventory.GuiContainer)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 GuiHudCustomization (am2.guis.GuiHudCustomization)1 IAdvancedSilkyRemovable (com.bluepowermod.api.block.IAdvancedSilkyRemovable)1 ISilkyRemovable (com.bluepowermod.api.block.ISilkyRemovable)1 GuiCircuitTable (com.bluepowermod.client.gui.GuiCircuitTable)1 IPacketIDReceiver (com.builtbroken.mc.core.network.IPacketIDReceiver)1 IPacketReceiver (com.builtbroken.mc.core.network.IPacketReceiver)1 PacketIDException (com.builtbroken.mc.core.network.ex.PacketIDException)1 PacketTileReadException (com.builtbroken.mc.core.network.ex.PacketTileReadException)1 Location (com.builtbroken.mc.imp.transform.vector.Location)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 Side (cpw.mods.fml.relauncher.Side)1