net.minecraft.util.MovingObjectPosition#net.minecraft.client.gui.GuiScreen源码实例Demo

下面列出了net.minecraft.util.MovingObjectPosition#net.minecraft.client.gui.GuiScreen 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: PneumaticCraft   文件: GuiProgrammer.java
@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);
        }
    }
}
 
源代码2 项目: VanillaFix   文件: GuiProblemScreen.java
@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;
        }
    }
}
 
源代码3 项目: NotEnoughItems   文件: LayoutManager.java
@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;
}
 
源代码4 项目: NotEnoughItems   文件: LayoutManager.java
@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;
}
 
源代码5 项目: mocreaturesdev   文件: MoCClientTickHandler.java
@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();
        }
    }

}
 
源代码6 项目: NotEnoughItems   文件: TextField.java
@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;
}
 
源代码7 项目: NotEnoughItems   文件: NEIClientEventHandler.java
@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);
}
 
源代码8 项目: ehacks-pro   文件: XRayAddGui.java
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);
}
 
源代码9 项目: customstuff4   文件: ToolTip.java
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;
    }
}
 
@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);
	}
}
 
源代码11 项目: NotEnoughItems   文件: GuiOptionList.java
@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);
    }
}
 
源代码12 项目: ExtraCells1   文件: GuiSolderingStation.java
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();
	}
}
 
源代码13 项目: ToroQuest   文件: GuiConfigToroQuest.java
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();
}
 
@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);
	}
}
 
源代码15 项目: PneumaticCraft   文件: ProgWidgetBlockCondition.java
@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);
        }

    };
}
 
源代码16 项目: CodeChickenCore   文件: GuiCCTextField.java
@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);
}
 
源代码17 项目: NOVA-Core   文件: ClientProxy.java
@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;
}
 
源代码18 项目: PneumaticCraft   文件: ProgWidgetEntityCondition.java
@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;
        }
    };
}
 
源代码19 项目: NotEnoughItems   文件: NEIController.java
@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;
        }
    }
}
 
源代码20 项目: PneumaticCraft   文件: ProgWidgetCrafting.java
@Override
@SideOnly(Side.CLIENT)
public GuiScreen getOptionWindow(GuiProgrammer guiProgrammer){
    return new GuiProgWidgetImportExport(this, guiProgrammer){
        @Override
        protected boolean showSides(){
            return false;
        }
    };
}
 
源代码21 项目: NotEnoughItems   文件: NEIClientEventHandler.java
@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);
            }
        }
    }

}
 
源代码22 项目: Hyperium   文件: GuiDrawScreenEvent.java
public GuiDrawScreenEvent(GuiScreen screen, int mouseX, int mouseY, float partialTicks) {

        this.screen = screen;
        this.mouseX = mouseX;
        this.mouseY = mouseY;
        this.partialTicks = partialTicks;
    }
 
源代码23 项目: mapwriter   文件: MwGuiMarkerDialog.java
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;
  }
 
源代码24 项目: enderutilities   文件: GuiSoundBlock.java
@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));
    }
}
 
源代码25 项目: mapwriter   文件: MwGuiMarkerDialog.java
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;
  }
 
源代码26 项目: WirelessRedstone   文件: WRAddonCPH.java
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());
}
 
源代码27 项目: PneumaticCraft   文件: GuiPastebin.java
public GuiPastebin(GuiScreen parentScreen, String pastingString){
    xSize = 183;
    ySize = 202;
    this.pastingString = pastingString;
    this.parentScreen = parentScreen;
    Keyboard.enableRepeatEvents(true);
}
 
源代码28 项目: litematica   文件: SelectionManager.java
public void openEditGui(@Nullable GuiScreen parent)
{
    GuiBase gui = this.getEditGui();

    if (gui != null)
    {
        gui.setParent(parent);
        GuiBase.openGui(gui);
    }
}
 
源代码29 项目: WearableBackpacks   文件: BackpacksConfigScreen.java
/** 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));
}
 
public ModGuiConfig (GuiScreen parentScreen)
{
    super(parentScreen,
            new ConfigElement(ConfigurationHandler.instance().getConfigurationCategory()).getChildElements(),
            Reference.MOD_ID,
            false,
            false,
            GuiConfig.getAbridgedConfigPath(ConfigurationHandler.instance().toString()));
}