net.minecraft.client.gui.GuiScreen Java Examples

The following examples show how to use net.minecraft.client.gui.GuiScreen. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: PneumaticCraft   Author: MineMaarten   File: GuiProgrammer.java    License: GNU General Public License v3.0 6 votes vote down vote up
@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);
        }
    }
}
 
Example #2
Source Project: VanillaFix   Author: DimensionalDevelopment   File: GuiProblemScreen.java    License: MIT License 6 votes vote down vote up
@Override
protected void actionPerformed(GuiButton button) {
    if (button.id == 1) {
        try {
            if (hasteLink == null) {
                hasteLink = HasteUpload.uploadToHaste(ModConfig.crashes.hasteURL, "mccrash", report.getCompleteReport());
            }
            ReflectionHelper.findField(GuiScreen.class, "clickedLinkURI", "field_175286_t").set(this, new URI(hasteLink));
            mc.displayGuiScreen(new GuiConfirmOpenLink(this, hasteLink, 31102009, false));
        } catch (Throwable e) {
            log.error("Exception when crash menu button clicked:", e);
            button.displayString = I18n.format("vanillafix.gui.failed");
            button.enabled = false;
        }
    }
}
 
Example #3
Source Project: NotEnoughItems   Author: TheCBProject   File: LayoutManager.java    License: MIT License 6 votes vote down vote up
@Override
public boolean mouseClicked(GuiScreen gui, int mouseX, int mouseY, int button) {
    if (isHidden()) {
        return false;
    }

    if (!isEnabled()) {
        return options.contains(mouseX, mouseY) && options.handleClick(mouseX, mouseY, button);
    }

    for (Widget widget : controlWidgets) {
        widget.onGuiClick(mouseX, mouseY);
        if (widget.contains(mouseX, mouseY) ? widget.handleClick(mouseX, mouseY, button) : widget.handleClickExt(mouseX, mouseY, button)) {
            return true;
        }
    }

    return false;
}
 
Example #4
Source Project: NotEnoughItems   Author: TheCBProject   File: LayoutManager.java    License: MIT License 6 votes vote down vote up
@Override
public boolean lastKeyTyped(GuiScreen gui, char keyChar, int keyID) {
    if (KeyBindings.get("nei.options.keys.gui.hide").isActiveAndMatches(keyID)) {
        toggleBooleanSetting("inventory.hidden");
        //False, because we need to not consume the event.
        return false;
    }
    if (isEnabled() && !isHidden()) {
        for (Widget widget : controlWidgets) {
            if (inputFocused == null) {
                widget.lastKeyTyped(keyID, keyChar);
            }
        }
    }
    return false;
}
 
Example #5
Source Project: mocreaturesdev   Author: DrZhark   File: MoCClientTickHandler.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
    if (type.equals(EnumSet.of(TickType.CLIENT)))
    {
        GuiScreen curScreen = Minecraft.getMinecraft().currentScreen;
        if (curScreen != null)
        {
            onTickInGui(curScreen);
        }
        else
        {
            onTickInGame();
        }
    }

}
 
Example #6
Source Project: NotEnoughItems   Author: Chicken-Bones   File: TextField.java    License: MIT License 6 votes vote down vote up
@Override
public boolean handleKeyPress(int keyID, char keyChar) {
    if (!focused())
        return false;

    if (keyID == Keyboard.KEY_BACK) {
        if (text.length() > 0) {
            setText(text.substring(0, text.length() - 1));
            backdowntime = System.currentTimeMillis();
        }
    } else if (keyID == Keyboard.KEY_RETURN || keyID == Keyboard.KEY_ESCAPE) {
        setFocus(false);
        onExit();
    } else if (keyChar == 22)//paste
    {
        String pastestring = GuiScreen.getClipboardString();
        if (pastestring == null)
            pastestring = "";

        if (isValid(text + pastestring))
            setText(text + pastestring);
    } else if (isValid(text + keyChar))
        setText(text + keyChar);

    return true;
}
 
Example #7
Source Project: NotEnoughItems   Author: TheCBProject   File: NEIClientEventHandler.java    License: MIT License 6 votes vote down vote up
@SubscribeEvent
public void drawScreenPost(DrawScreenEvent.Post event) {
    GuiScreen screen = event.getGui();

    Point mousePos = GuiDraw.getMousePosition();
    List<String> tooltip = new LinkedList<>();
    ItemStack stack = ItemStack.EMPTY;
    if (instanceTooltipHandlers != null) {
        instanceTooltipHandlers.forEach(handler -> handler.handleTooltip(screen, mousePos.x, mousePos.y, tooltip));
    }

    if (screen instanceof GuiContainer) {
        if (tooltip.isEmpty() && GuiHelper.shouldShowTooltip(screen)) {
            GuiContainer container = (GuiContainer) screen;
            stack = GuiHelper.getStackMouseOver(container, false);

            if (!stack.isEmpty()) {
                tooltip.clear();
                tooltip.addAll(GuiHelper.itemDisplayNameMultiline(stack, container, false));
            }
        }
    }

    GuiDraw.drawMultiLineTip(stack, mousePos.x + 10, mousePos.y - 12, tooltip);
}
 
Example #8
Source Project: ehacks-pro   Author: radioegor146   File: XRayAddGui.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void drawItem(ItemStack itemstack, int x, int y, String name) {
    GL11.glColor3ub((byte) -1, (byte) -1, (byte) -1);
    GL11.glDisable(2896);
    this.zLevel = 200.0f;
    GuiScreen.itemRender.zLevel = 200.0f;
    FontRenderer font = null;
    if (itemstack != null) {
        font = itemstack.getItem().getFontRenderer(itemstack);
    }
    if (font == null) {
        font = this.fontRendererObj;
    }
    GuiScreen.itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), itemstack, x, y);
    GuiScreen.itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), itemstack, x, y, name);
    this.zLevel = 0.0f;
    GuiScreen.itemRender.zLevel = 0.0f;
    GL11.glEnable(2896);
}
 
Example #9
Source Project: customstuff4   Author: cubex2   File: ToolTip.java    License: GNU General Public License v3.0 5 votes vote down vote up
private boolean isCorrectModeActive()
{
    switch (mode.toLowerCase())
    {
        case MODE_SHIFT:
            return GuiScreen.isShiftKeyDown();
        case MODE_CTRL:
            return GuiScreen.isCtrlKeyDown();
        case MODE_ALT:
            return GuiScreen.isAltKeyDown();
        case MODE_NO_SHIFT:
            return !GuiScreen.isShiftKeyDown();
        case MODE_NO_CTRL:
            return !GuiScreen.isCtrlKeyDown();
        case MODE_NO_ALT:
            return !GuiScreen.isAltKeyDown();
        default:
            return true;
    }
}
 
Example #10
Source Project: OpenPeripheral-Addons   Author: OpenMods   File: TerminalManagerClient.java    License: MIT License 5 votes vote down vote up
@SubscribeEvent
public void onKeyRepeatSet(GlassesSetKeyRepeatEvent evt) {
	GuiScreen gui = FMLClientHandler.instance().getClient().currentScreen;

	if (gui instanceof GuiCapture) {
		final GuiCapture capture = (GuiCapture)gui;
		long guid = capture.getGuid();
		if (guid == evt.guid) capture.setKeyRepeat(evt.repeat);
	}
}
 
Example #11
Source Project: NotEnoughItems   Author: TheCBProject   File: GuiOptionList.java    License: MIT License 5 votes vote down vote up
@Override
public void keyTyped(char c, int keycode) throws IOException {
    if (keycode == 1) {//esc
        GuiScreen p = parent;
        while (p instanceof GuiOptionList) {
            p = ((GuiOptionList) p).parent;
        }

        Minecraft.getMinecraft().displayGuiScreen(p);
    } else {
        super.keyTyped(c, keycode);
    }
}
 
Example #12
Source Project: ExtraCells1   Author: ExtraCells   File: GuiSolderingStation.java    License: MIT License 5 votes vote down vote up
public void keyTyped(char keyChar, int keyID)
{
	super.keyTyped(keyChar, keyID);
	if (keyID == Keyboard.KEY_ESCAPE || keyID == mc.gameSettings.keyBindInventory.keyCode)
	{
		this.mc.displayGuiScreen((GuiScreen) null);
		this.mc.setIngameFocus();
	}
}
 
Example #13
Source Project: ToroQuest   Author: ToroCraft   File: GuiConfigToroQuest.java    License: GNU General Public License v3.0 5 votes vote down vote up
public GuiConfigToroQuest(GuiScreen parent) {
	super (parent, new ConfigElement(ConfigurationHandler.config.getCategory(Configuration.CATEGORY_CLIENT)).getChildElements(),
			ToroQuest.MODID,
			false,
			false,
			"ToroQuest");
	titleLine2 = ConfigurationHandler.config.getConfigFile().getAbsolutePath();
}
 
Example #14
Source Project: OpenPeripheral-Addons   Author: OpenMods   File: TerminalManagerClient.java    License: MIT License 5 votes vote down vote up
@SubscribeEvent
public void onDragParamsSet(GlassesSetDragParamsEvent evt) {
	GuiScreen gui = FMLClientHandler.instance().getClient().currentScreen;

	if (gui instanceof GuiCapture) {
		final GuiCapture capture = (GuiCapture)gui;
		long guid = capture.getGuid();
		if (guid == evt.guid) capture.setDragParameters(evt.threshold, evt.period);
	}
}
 
Example #15
Source Project: PneumaticCraft   Author: MineMaarten   File: ProgWidgetBlockCondition.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public GuiScreen getOptionWindow(GuiProgrammer guiProgrammer){
    return new GuiProgWidgetCondition(this, guiProgrammer){
        @Override
        public void initGui(){
            super.initGui();
            addWidget(new GuiCheckBox(500, guiLeft + 5, guiTop + 60, 0xFF000000, I18n.format("gui.progWidget.conditionBlock.checkForAir")).setChecked(checkingForAir).setTooltip(I18n.format("gui.progWidget.conditionBlock.checkForAir.tooltip")));
            addWidget(new GuiCheckBox(501, guiLeft + 5, guiTop + 72, 0xFF000000, I18n.format("gui.progWidget.conditionBlock.checkForLiquids")).setChecked(checkingForLiquids).setTooltip(I18n.format("gui.progWidget.conditionBlock.checkForLiquids.tooltip")));
        }

        @Override
        protected boolean requiresNumber(){
            return false;
        }

        @Override
        protected boolean isSidedWidget(){
            return false;
        }

        @Override
        public void actionPerformed(IGuiWidget widget){
            if(widget.getID() == 500) checkingForAir = !checkingForAir;
            if(widget.getID() == 501) checkingForLiquids = !checkingForLiquids;
            else super.actionPerformed(widget);
        }

    };
}
 
Example #16
Source Project: CodeChickenCore   Author: Chicken-Bones   File: GuiCCTextField.java    License: MIT License 5 votes vote down vote up
@Override
public void keyTyped(char c, int keycode)
{
    if(!isEnabled || !isFocused)
        return;

    /*if(c == '\t')//tab
    {
        parentGuiScreen.selectNextField();
    }*/
    if(c == '\026')//paste
    {
        String s = GuiScreen.getClipboardString();
        if(s == null || s.equals(""))
            return;

        for(int i = 0; i < s.length(); i++)
        {
            if(text.length() == maxStringLength)
                return;

            char tc = s.charAt(i);
            if(canAddChar(tc))
                setText(text + tc);
        }
    }
    if(keycode == Keyboard.KEY_RETURN)
    {
        setFocused(false);
        sendAction(actionCommand, getText());
    }

    if(keycode == Keyboard.KEY_BACK && text.length() > 0)
        setText(text.substring(0, text.length() - 1));

    if((text.length() < maxStringLength || maxStringLength == 0) && canAddChar(c))
        setText(text + c);
}
 
Example #17
Source Project: NOVA-Core   Author: NOVA-Team   File: ClientProxy.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean isPaused() {
	if (FMLClientHandler.instance().getClient().isSingleplayer() && !FMLClientHandler.instance().getClient().getIntegratedServer().getPublic()) {
		GuiScreen screen = FMLClientHandler.instance().getClient().currentScreen;
		if (screen != null) {
			if (screen.doesGuiPauseGame()) {
				return true;
			}
		}
	}
	return false;
}
 
Example #18
Source Project: PneumaticCraft   Author: MineMaarten   File: ProgWidgetEntityCondition.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public GuiScreen getOptionWindow(GuiProgrammer guiProgrammer){
    return new GuiProgWidgetCondition(this, guiProgrammer){
        @Override
        protected boolean isSidedWidget(){
            return false;
        }

        @Override
        protected boolean isUsingAndOr(){
            return false;
        }
    };
}
 
Example #19
Source Project: NotEnoughItems   Author: TheCBProject   File: NEIController.java    License: MIT License 5 votes vote down vote up
@Override
public void onMouseClickedPost(GuiScreen gui, int mouseX, int mouseY, int button) {
    if (!(gui instanceof GuiContainer) || !NEIClientConfig.isEnabled()) {
        return;
    }
    Slot slot = GuiHelper.getSlotMouseOver(((GuiContainer) gui));
    if (slot != null) {

        ItemStack nowHeld = NEIClientUtils.getHeldItem();

        if (heldTracker != nowHeld) {
            pickedUpFromSlot = slot.slotNumber;
        }
    }
}
 
Example #20
Source Project: PneumaticCraft   Author: MineMaarten   File: ProgWidgetCrafting.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public GuiScreen getOptionWindow(GuiProgrammer guiProgrammer){
    return new GuiProgWidgetImportExport(this, guiProgrammer){
        @Override
        protected boolean showSides(){
            return false;
        }
    };
}
 
Example #21
Source Project: NotEnoughItems   Author: TheCBProject   File: NEIClientEventHandler.java    License: MIT License 5 votes vote down vote up
@SubscribeEvent
public void onKeyTypedPost(KeyboardInputEvent.Post event) {

    GuiScreen gui = event.getGui();
    if (gui instanceof GuiContainer) {
        char c = Keyboard.getEventCharacter();
        int eventKey = Keyboard.getEventKey();

        if (eventKey == 0 && c >= 32 || Keyboard.getEventKeyState()) {

            if (eventKey != 1) {
                for (IInputHandler inputhander : inputHandlers) {
                    if (inputhander.lastKeyTyped(gui, c, eventKey)) {
                        event.setCanceled(true);
                        return;
                    }
                }
            }

            if (KeyBindings.get("nei.options.keys.gui.enchant").isActiveAndMatches(eventKey) && canPerformAction("enchant")) {
                NEIClientPacketHandler.sendOpenEnchantmentWindow();
                event.setCanceled(true);
            }
            if (KeyBindings.get("nei.options.keys.gui.potion").isActiveAndMatches(eventKey) && canPerformAction("potion")) {
                NEIClientPacketHandler.sendOpenPotionWindow();
                event.setCanceled(true);
            }
        }
    }

}
 
Example #22
Source Project: Hyperium   Author: HyperiumClient   File: GuiDrawScreenEvent.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
public GuiDrawScreenEvent(GuiScreen screen, int mouseX, int mouseY, float partialTicks) {

        this.screen = screen;
        this.mouseX = mouseX;
        this.mouseY = mouseY;
        this.partialTicks = partialTicks;
    }
 
Example #23
Source Project: mapwriter   Author: daveyliam   File: MwGuiMarkerDialog.java    License: MIT License 5 votes vote down vote up
public MwGuiMarkerDialog(GuiScreen parentScreen, MarkerManager markerManager, Marker editingMarker) {
      super(parentScreen, "Edit Marker Name:", editingMarker.name, "marker must have a name");
      this.markerManager = markerManager;
this.editingMarker = editingMarker;
this.markerName = editingMarker.name;
this.markerGroup = editingMarker.groupName;
this.markerX = editingMarker.x;
this.markerY = editingMarker.y;
this.markerZ = editingMarker.z;
this.dimension = editingMarker.dimension;
  }
 
Example #24
Source Project: enderutilities   Author: maruohon   File: GuiSoundBlock.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void actionPerformedWithButton(GuiButton button, int mouseButton) throws IOException
{
    int dim = this.player.getEntityWorld().provider.getDimension();
    int amount = 0;

    if (mouseButton == 0 || mouseButton == 11)
    {
        amount = 1;
    }
    else if (mouseButton == 1 || mouseButton == 9)
    {
        amount = -1;
    }

    // Pitch and Volume
    if (button.id == 1 || button.id == 2)
    {
        if (GuiScreen.isShiftKeyDown()) { amount *= 10; }
        if (GuiScreen.isCtrlKeyDown())  { amount *= 100; }
    }
    // Clear the search field
    if (button.id == 20)
    {
        this.searchField.setText("");
        this.applyFilterString();
    }
    else
    {
        PacketHandler.INSTANCE.sendToServer(new MessageGuiAction(dim, this.tesb.getPos(),
                ReferenceGuiIds.GUI_ID_TILE_ENTITY_GENERIC, button.id, amount));
    }
}
 
Example #25
Source Project: mapwriter   Author: daveyliam   File: MwGuiMarkerDialog.java    License: MIT License 5 votes vote down vote up
public MwGuiMarkerDialog(GuiScreen parentScreen, MarkerManager markerManager, String markerName, String markerGroup, int x, int y, int z, int dimension) {
      super(parentScreen, "Marker Name:", markerName, "marker must have a name");
this.markerManager = markerManager;
this.markerName = markerName;
this.markerGroup = markerGroup;
this.markerX = x;
this.markerY = y;
this.markerZ = z;
this.editingMarker = null;
this.dimension = dimension;
  }
 
Example #26
Source Project: WirelessRedstone   Author: Chicken-Bones   File: WRAddonCPH.java    License: MIT License 5 votes vote down vote up
private static void processSnifferFreqUpdate(PacketCustom packet) {
    GuiScreen currentscreen = Minecraft.getMinecraft().currentScreen;
    if (currentscreen == null || !(currentscreen instanceof GuiWirelessSniffer))
        return;

    GuiWirelessSniffer sniffergui = ((GuiWirelessSniffer) currentscreen);
    sniffergui.setEtherFreq(packet.readUShort(), packet.readBoolean());
}
 
Example #27
Source Project: PneumaticCraft   Author: MineMaarten   File: GuiPastebin.java    License: GNU General Public License v3.0 5 votes vote down vote up
public GuiPastebin(GuiScreen parentScreen, String pastingString){
    xSize = 183;
    ySize = 202;
    this.pastingString = pastingString;
    this.parentScreen = parentScreen;
    Keyboard.enableRepeatEvents(true);
}
 
Example #28
Source Project: litematica   Author: maruohon   File: SelectionManager.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
public void openEditGui(@Nullable GuiScreen parent)
{
    GuiBase gui = this.getEditGui();

    if (gui != null)
    {
        gui.setParent(parent);
        GuiBase.openGui(gui);
    }
}
 
Example #29
Source Project: WearableBackpacks   Author: copygirl   File: BackpacksConfigScreen.java    License: MIT License 5 votes vote down vote up
/** Creates a config GUI screen for Wearable Backpacks (and its GENERAL category). */
public BackpacksConfigScreen(GuiScreen parentScreen) {
	this(parentScreen, (String)null);
	
	// Add all settings from the GENERAL category to the entry list.
	for (Setting<?> setting : WearableBackpacks.CONFIG.getSettingsGeneral())
		addEntry(CreateEntryFromSetting(setting));
	
	// After adding all settings from the GENERAL category, add its sub-categories.
	for (String cat : WearableBackpacks.CONFIG.getCategories())
		addEntry(new EntryCategory(this, cat));
}
 
Example #30
Source Project: Fullscreen-Windowed-Minecraft   Author: hancin   File: ModGuiConfig.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ModGuiConfig (GuiScreen parentScreen)
{
    super(parentScreen,
            new ConfigElement(ConfigurationHandler.instance().getConfigurationCategory()).getChildElements(),
            Reference.MOD_ID,
            false,
            false,
            GuiConfig.getAbridgedConfigPath(ConfigurationHandler.instance().toString()));
}