codechicken.lib.gui.GuiDraw Java Examples
The following examples show how to use
codechicken.lib.gui.GuiDraw.
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 File: GuiItemIconDumper.java From NotEnoughItems with MIT License | 6 votes |
private void drawItems() { Dimension d = GuiDraw.displayRes(); GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.loadIdentity(); GlStateManager.ortho(0, d.width*16D/iconSize, d.height*16D/iconSize, 0, 1000, 3000); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.clearColor(0, 0, 0, 0); GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); int rows = d.height / boxSize; int cols = d.width / boxSize; int fit = rows*cols; RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.color(1, 1, 1, 1); for(int i = 0; drawIndex < ItemPanel.items.size() && i < fit; drawIndex++, i++) { int x = i%cols * 18; int y = i/cols * 18; GuiContainerManager.drawItem(x+1, y+1, ItemPanel.items.get(drawIndex)); } GL11.glFlush(); }
Example #2
Source File: ItemPanel.java From NotEnoughItems with MIT License | 6 votes |
@Override public boolean handleKeyPress(int keyID, char keyChar) { if (KeyBindings.get("nei.options.keys.gui.next").isActiveAndMatches(keyID)) { scroll(1); return true; } if (KeyBindings.get("nei.options.keys.gui.prev").isActiveAndMatches(keyID)) { scroll(-1); return true; } Point mouse = GuiDraw.getMousePosition(); ItemPanelSlot hoverSlot = getSlotMouseOver(mouse.x, mouse.y); if (hoverSlot != null && draggedStack.isEmpty()) { ItemStack item = hoverSlot.item; if (KeyBindings.get("nei.options.keys.gui.recipe").isActiveAndMatches(keyID)) { JEIIntegrationManager.openRecipeGui(item); return true; } else if (KeyBindings.get("nei.options.keys.gui.usage").isActiveAndMatches(keyID)) { JEIIntegrationManager.openUsageGui(item); return true; } } return false; }
Example #3
Source File: GuiItemIconDumper.java From NotEnoughItems with MIT License | 6 votes |
private void drawItems() { Dimension d = GuiDraw.getDisplayRes(); GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.loadIdentity(); GlStateManager.ortho(0, d.width * 16D / iconSize, d.height * 16D / iconSize, 0, 1000, 3000); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.clearColor(0, 0, 0, 0); GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); int rows = d.height / boxSize; int cols = d.width / boxSize; int fit = rows * cols; RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.color(1, 1, 1, 1); for (int i = 0; drawIndex < ItemPanel.items.size() && i < fit; drawIndex++, i++) { int x = i % cols * 18; int y = i / cols * 18; GuiHelper.drawItem(x + 1, y + 1, ItemPanel.items.get(drawIndex)); } GL11.glFlush(); }
Example #4
Source File: NEIClientEventHandler.java From NotEnoughItems with MIT License | 6 votes |
@SubscribeEvent public void foregroundRenderEvent(GuiContainerEvent.DrawForeground event) { GuiContainer container = event.getGuiContainer(); GlStateTracker.pushState(); Point mousePos = GuiDraw.getMousePosition(); GlStateManager.translate(-container.getGuiLeft(), -container.getGuiTop(), 100F); drawHandlers.forEach(handler -> handler.renderObjects(container, mousePos.x, mousePos.y)); drawHandlers.forEach(handler -> handler.postRenderObjects(container, mousePos.x, mousePos.y)); GlStateManager.translate(container.getGuiLeft(), container.getGuiTop(), -100F); GuiHelper.enable3DRender(); GlStateManager.pushMatrix(); for (Slot slot : container.inventorySlots.inventorySlots) { GlStateTracker.pushState(); drawHandlers.forEach(handler -> handler.renderSlotOverlay(container, slot)); GlStateTracker.popState(); } GlStateManager.popMatrix(); GlStateTracker.popState(); }
Example #5
Source File: NEIClientEventHandler.java From NotEnoughItems with MIT License | 6 votes |
@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 #6
Source File: ContainerEventHandler.java From NotEnoughItems with MIT License | 6 votes |
@SubscribeEvent (priority = EventPriority.LOWEST)//We need to be called after JEI as this is is a render overlay. public void onDrawBackgroundEventPost(BackgroundDrawnEvent event) { GuiTextFieldFilter fieldFilter = JEIIntegrationManager.getTextFieldFilter(); if (!ClientUtils.inWorld() || !isNEIInWorld() || fieldFilter == null || !SearchField.searchInventories() || JEIIntegrationManager.searchBoxOwner != EnumItemBrowser.JEI || JEIIntegrationManager.itemPanelOwner == EnumItemBrowser.NEI) { return; } int x = fieldFilter.x; int y = fieldFilter.y; int h = fieldFilter.height; int w = fieldFilter.width; GuiDraw.drawGradientRect(x - 1, y - 1, 1, h + 2, 0xFFFFFF00, 0xFFC0B000);//Left GuiDraw.drawGradientRect(x - 1, y - 1, w + 2, 1, 0xFFFFFF00, 0xFFC0B000);//Top GuiDraw.drawGradientRect(x + w, y - 1, 1, h + 2, 0xFFFFFF00, 0xFFC0B000);//Left GuiDraw.drawGradientRect(x - 1, y + h, w + 2, 1, 0xFFFFFF00, 0xFFC0B000);//Bottom }
Example #7
Source File: ContainerEventHandler.java From NotEnoughItems with MIT License | 6 votes |
@SubscribeEvent (priority = EventPriority.LOWEST, receiveCanceled = true)//We need to be called before JEI. public void onGuiMouseEventpre(MouseInputEvent.Pre event) { if (Mouse.getEventButton() == -1 || event.getGui() == null || !Mouse.getEventButtonState()) { return; } Point mouse = GuiDraw.getMousePosition(); int eventButton = Mouse.getEventButton(); if (JEIIntegrationManager.searchBoxOwner == EnumItemBrowser.JEI) { GuiTextFieldFilter fieldFilter = JEIIntegrationManager.getTextFieldFilter(); if (fieldFilter != null && fieldFilter.isMouseOver(mouse.x, mouse.y)) { if (eventButton == 0) { if (fieldFilter.isFocused() && (System.currentTimeMillis() - lastSearchBoxClickTime < 500)) {//double click NEIClientConfig.world.nbt.setBoolean("searchinventories", !SearchField.searchInventories()); NEIClientConfig.world.saveNBT(); lastSearchBoxClickTime = 0L; } else { lastSearchBoxClickTime = System.currentTimeMillis(); } } else if (eventButton == 1) { NEIClientConfig.setSearchExpression("", false); LayoutManager.searchField.setText("", false); } } } }
Example #8
Source File: PneumaticCraftPlugins.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@Override public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip, int recipe){ // super.handleTooltip(guiRecipe, currenttip, recipe); MultipleInputOutputRecipe r = (MultipleInputOutputRecipe)arecipes.get(recipe); if(GuiContainerManager.shouldShowTooltip(guiRecipe)) { Point mouse = GuiDraw.getMousePosition(); Point offset = guiRecipe.getRecipePosition(recipe); Point relMouse = new Point(mouse.x - (guiRecipe.width - 176) / 2 - offset.x, mouse.y - (guiRecipe.height - 166) / 2 - offset.y); for(IGuiWidget widget : r.tooltipWidgets) { if(widget.getBounds().contains(relMouse)) { widget.addTooltip(mouse.x, mouse.y, currenttip, false); } } if(r.tempWidget != null) { if(r.tempWidget.getBounds().contains(relMouse)) { r.heatExchanger.setTemperature(r.tempWidget.getScales()[0]); r.tempWidget.addTooltip(mouse.x, mouse.y, currenttip, false); } } } return currenttip; }
Example #9
Source File: GuiModListScroll.java From CodeChickenCore with MIT License | 6 votes |
private static void screenshotStencil(int x) { Dimension d = GuiDraw.displayRes(); ByteBuffer buf = BufferUtils.createByteBuffer(d.width * d.height); BufferedImage img = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB); glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glReadPixels(0, 0, d.width, d.height, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, buf); for(int i = 0; i < d.width; i++) for(int j = 0; j < d.height; j++) img.setRGB(i, d.height-j-1, buf.get(j * d.width + i) == 0 ? 0 : 0xFFFFFF); try { ImageIO.write(img, "png", new File("stencil"+x+".png")); } catch (IOException e) { e.printStackTrace(); } }
Example #10
Source File: PluginGT5IEVeinStat.java From GTNEIOrePlugin with MIT License | 6 votes |
@Override public void drawExtras(int recipe) { CachedIEVeinStatRecipe crecipe = (CachedIEVeinStatRecipe) this.arecipes.get(recipe); OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); int stringLength1 = GuiDraw.getStringWidth(I18n.format("gtnop.gui.nei.weightedChance") + ": "); int stringLength2 = GuiDraw.getStringWidth("40%"); int beginXCoord = (stringLength1+stringLength2)/2; GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.ieVeinComponent") + ": ", 2, 31, 0x404040, false); GuiDraw.drawStringR("40.00%", beginXCoord+5, 44, 0x404040, false); GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2+stringLength1, 44, 0x404040, false); GuiDraw.drawStringR("40.00%", beginXCoord+5, 57, 0x404040, false); GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2+stringLength1, 57, 0x404040, false); GuiDraw.drawStringR("15.00%", beginXCoord+5, 70, 0x404040, false); GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2+stringLength1, 70, 0x404040, false); GuiDraw.drawStringR("5.00%", beginXCoord+5, 83, 0x404040, false); GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2+stringLength1, 83, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedIEChance, 2, 96, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.fromMod") + ": " + "Immersive Engineering", 2, 109, 0x404040, false); GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); }
Example #11
Source File: RecipeHandlerBase.java From NEI-Integration with MIT License | 6 votes |
protected boolean transferFluidTank(GuiRecipe guiRecipe, int recipe, boolean usage) { CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe); Point mousepos = GuiDraw.getMousePosition(); Point offset = guiRecipe.getRecipePosition(recipe); Point relMouse = new Point(mousepos.x - (guiRecipe.width - 176) / 2 - offset.x, mousepos.y - (guiRecipe.height - 166) / 2 - offset.y); if (crecipe.getFluidTanks() != null) { for (PositionedFluidTank tank : crecipe.getFluidTanks()) { if (tank.position.contains(relMouse)) { return tank.transfer(usage); } } } return false; }
Example #12
Source File: GuiContainerWidget.java From CodeChickenCore with MIT License | 5 votes |
@Override public void handleMouseInput() throws IOException { super.handleMouseInput(); int i = Mouse.getEventDWheel(); if (i != 0) { Point p = GuiDraw.getMousePosition(); int scroll = i > 0 ? 1 : -1; for (GuiWidget widget : widgets) widget.mouseScrolled(p.x, p.y, scroll); } }
Example #13
Source File: GuiScreenWidget.java From CodeChickenCore with MIT License | 5 votes |
@Override public void handleMouseInput() throws IOException { super.handleMouseInput(); int i = Mouse.getEventDWheel(); if (i != 0) { Point p = GuiDraw.getMousePosition(); int scroll = i > 0 ? 1 : -1; for (GuiWidget widget : widgets) widget.mouseScrolled(p.x, p.y, scroll); } }
Example #14
Source File: RecipeHandlerBase.java From NEI-Integration with MIT License | 5 votes |
@Override public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip, int recipe) { super.handleTooltip(guiRecipe, currenttip, recipe); CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe); if (GuiContainerManager.shouldShowTooltip(guiRecipe)) { Point mouse = GuiDraw.getMousePosition(); Point offset = guiRecipe.getRecipePosition(recipe); Point relMouse = new Point(mouse.x - (guiRecipe.width - 176) / 2 - offset.x, mouse.y - (guiRecipe.height - 166) / 2 - offset.y); currenttip = this.provideTooltip(guiRecipe, currenttip, crecipe, relMouse); } return currenttip; }
Example #15
Source File: RecipeHandlerBase.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawForeground(int recipe) { super.drawForeground(recipe); this.drawFluidTanks(recipe); if (recipe % this.recipiesPerPage() == 0 && this.getRecipeSubName() != null) { GuiDraw.drawStringC(this.getRecipeSubName(), 83, -2, 0x404040, false); } this.changeToGuiTexture(); }
Example #16
Source File: RecipeHandlerBlastFurnace.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawExtras(int recipe) { GuiDraw.drawStringC(((CachedBlastFurnaceRecipe) this.arecipes.get(recipe)).cookTime + " " + Utils.translate("ticks"), 120, 6, 0x808080, false); this.changeToGuiTexture(); this.drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7); this.drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0); }
Example #17
Source File: RecipeHandlerCyaniteReprocessor.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(0, 0, 8, 16, 160, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(0, 0, 0, 96, 18, 64); }
Example #18
Source File: RecipeHandlerComposter.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(0, 0, 11, 13, 160, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(76, 25, 0, 15, 22, 15); }
Example #19
Source File: RecipeHandlerBase.java From NEI-Integration with MIT License | 5 votes |
@Override public List<String> handleItemTooltip(GuiRecipe guiRecipe, ItemStack itemStack, List<String> currenttip, int recipe) { super.handleItemTooltip(guiRecipe, itemStack, currenttip, recipe); CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe); Point mouse = GuiDraw.getMousePosition(); Point offset = guiRecipe.getRecipePosition(recipe); Point relMouse = new Point(mouse.x - (guiRecipe.width - 176) / 2 - offset.x, mouse.y - (guiRecipe.height - 166) / 2 - offset.y); currenttip = this.provideItemTooltip(guiRecipe, itemStack, currenttip, crecipe, relMouse); return currenttip; }
Example #20
Source File: RecipeHandlerLaserDrill.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawExtras(int recipe) { GuiDraw.drawTexturedModalRect(111, 2, 176, 0, 16, 60); this.drawProgressBar(139, 0, 176, 58, 8, 62, 1.0F, 3); this.drawProgressBar(149, 0, 185, 58, 8, 62, 60, 3); CachedLaserDrillRecipe crecipe = (CachedLaserDrillRecipe) this.arecipes.get(recipe); NumberFormat percentFormat = NumberFormat.getPercentInstance(); percentFormat.setMaximumFractionDigits(2); GuiDraw.drawStringC(percentFormat.format(crecipe.chance), 83, 44, 0x808080, false); GuiDraw.drawStringC(Utils.translate("handler.laserdrill.focus"), 29, 44, 0x808080, false); }
Example #21
Source File: RecipeHandlerLaserDrill.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(0, 0, 11, 13, 160, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(19, 23, 0, 30, 18, 18); GuiDraw.drawTexturedModalRect(104, 25, 0, 15, 22, 15); }
Example #22
Source File: RecipeHandlerBioReactor.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(8, 5, 7, 14, 54, 54); GuiDraw.drawTexturedModalRect(120, 0, 131, 13, 38, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(80, 25, 0, 0, 22, 15); }
Example #23
Source File: RecipeHandlerMeatPacker.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(0, 0, 11, 13, 160, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(76, 25, 0, 15, 22, 15); }
Example #24
Source File: RecipeHandlerSlaughterhouse.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(0, 0, 11, 13, 160, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(56, 25, 0, 0, 22, 15); GuiDraw.drawTexturedModalRect(28, 24, 0, 64, 16, 16); }
Example #25
Source File: RecipeHandlerSewer.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(0, 0, 11, 13, 160, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(76, 25, 0, 0, 22, 15); if (!((CachedSewerRecipe) this.arecipes.get(recipe)).essenceRecipe) { GuiDraw.drawTexturedModalRect(48, 24, 0, 64, 16, 16); } else { GuiDraw.drawTexturedModalRect(48, 24, 0, 80, 16, 16); } }
Example #26
Source File: RecipeHandlerSludgeBoiler.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawExtras(int recipe) { this.drawProgressBar(129, 0, 176, 58, 8, 62, 1.0F, 3); this.drawProgressBar(139, 0, 185, 58, 8, 62, 40, 3); CachedSludgeBoilerRecipe crecipe = (CachedSludgeBoilerRecipe) this.arecipes.get(recipe); NumberFormat percentFormat = NumberFormat.getPercentInstance(); percentFormat.setMaximumFractionDigits(2); GuiDraw.drawStringC(percentFormat.format(crecipe.chance), 57, 44, 0x808080, false); }
Example #27
Source File: RecipeHandlerSludgeBoiler.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(0, 0, 11, 13, 160, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(76, 25, 0, 15, 22, 15); }
Example #28
Source File: RecipeHandlerGrinder.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(0, 0, 11, 13, 160, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(74, 25, 0, 0, 22, 15); GuiDraw.drawTexturedModalRect(44, 24, 16, 64, 16, 16); }
Example #29
Source File: RecipeHandlerHarvester.java From NEI-Integration with MIT License | 5 votes |
@Override public void drawBackground(int recipe) { this.changeToGuiTexture(); GuiDraw.drawTexturedModalRect(0, 0, 11, 13, 160, 65); this.changeToOverlayTexture(); GuiDraw.drawTexturedModalRect(48, 24, 0, 48, 16, 16); GuiDraw.drawTexturedModalRect(76, 25, 0, 0, 22, 15); }
Example #30
Source File: RecipeHandlerChisel.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
@Override public void drawBackground(int recipeIndex) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GuiDraw.changeTexture(getGuiTexture()); GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 130); Point focus = ((CachedChiselRecipe) this.arecipes.get(recipeIndex)).focus; if (focus != null) { GuiDraw.drawTexturedModalRect(focus.x, focus.y, 166, 0, 18, 18); } }