Class GuiItemStack
java.lang.Object
codechicken.lib.gui.modular.lib.geometry.ConstrainedGeometry<GuiItemStack>
codechicken.lib.gui.modular.elements.GuiElement<GuiItemStack>
codechicken.lib.gui.modular.elements.GuiItemStack
- All Implemented Interfaces:
BackgroundRender,ElementEvents,GuiParent<GuiItemStack>,TooltipHandler<GuiItemStack>
A simple gui element that renders an item stack.
This width and height of this element should be constrained to the same value,
The stack size is based on the element size.
constrain size to 16x16 for the standard gui stack size.
Created by brandon3055 on 03/09/2023
-
Field Summary
Fields inherited from class codechicken.lib.gui.modular.elements.GuiElement
hoverTime, initialized -
Constructor Summary
ConstructorsConstructorDescriptionGuiItemStack(GuiParent<?> parent) GuiItemStack(GuiParent<?> parent, Supplier<net.minecraft.world.item.ItemStack> provider) GuiItemStack(GuiParent<?> parent, net.minecraft.world.item.ItemStack itemStack) -
Method Summary
Modifier and TypeMethodDescriptionenableStackDecoration(boolean enableDecoration) Enable item stack decorations.enableStackDecoration(Supplier<Boolean> enableDecoration) Enable item stack decorations.enableStackToolTip(boolean enableToolTip) Enable the default item stack tooltip.enableStackToolTip(Supplier<Boolean> enableToolTip) Enable the default item stack tooltip.voidrenderBehind(net.minecraft.client.gui.GuiGraphics render, double mouseX, double mouseY, float partialTicks) Used to render content behind this elements child elements.booleanrenderOverlay(net.minecraft.client.gui.GuiGraphics graphics, double mouseX, double mouseY, float partialTicks, boolean consumed) Used to render overlay's such as hover text.setStack(net.minecraft.world.item.ItemStack stack) Methods inherited from class codechicken.lib.gui.modular.elements.GuiElement
addChild, addJeiDropTargets, addJeiExclusions, adoptChild, applyQueuedChildUpdates, blockMouseEvents, blockMouseOver, bringChildToForeground, font, getChildren, getJeiDropConsumer, getModularGui, getParent, getTooltip, getTooltipDelay, hoverTime, initElement, isDescendantOf, isEnabled, isJeiDropTarget, isJeiExcluded, isMouseOver, isOpaque, isRemoved, isTooltipEnabled, jeiExclude, mc, onScreenInit, removeChild, render, renderChild, scaledScreenHeight, scaledScreenWidth, sendChildToBackground, sendChildToIndex, setEnabled, setEnabled, setEnableToolTip, setJeiDropTarget, setJeiExcluded, setOpaque, setRenderCull, setTooltip, setTooltipDelay, showToolTip, tick, toString, updateMouseOver, updateScreenDataMethods inherited from class codechicken.lib.gui.modular.lib.geometry.ConstrainedGeometry
addBoundsToRect, clearConstraints, clearGeometryCache, constrain, get, getChildBounds, getEnclosingRect, getParent, getPosition, getRectangle, placeInside, placeInside, placeOutside, placeOutside, setHeight, setPos, setSize, setWidth, setXPos, setYPos, strictMode, validate, xCenter, xMax, xMin, xSize, yCenter, yMax, yMin, ySizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface codechicken.lib.gui.modular.lib.ElementEvents
charTyped, charTyped, keyPressed, keyPressed, keyReleased, keyReleased, mouseClicked, mouseClicked, mouseMoved, mouseReleased, mouseReleased, mouseScrolled, mouseScrolledMethods inherited from interface codechicken.lib.gui.modular.lib.geometry.GuiParent
addChild, getValueMethods inherited from interface codechicken.lib.gui.modular.lib.TooltipHandler
renderTooltip, setTooltip, setTooltip, setTooltip, setTooltipSingle, setTooltipSingle
-
Constructor Details
-
GuiItemStack
-
GuiItemStack
-
GuiItemStack
-
-
Method Details
-
setStack
-
setStack
-
enableStackDecoration
Enable item stack decorations. Meaning, Damage bar, Stack size, Item cool down, etc. (Default Enabled) -
enableStackDecoration
Enable item stack decorations. Meaning, Damage bar, Stack size, Item cool down, etc. (Default Enabled) -
enableStackToolTip
Enable the default item stack tooltip. (Default Enabled) Note: If theGuiItemStackelement has a tooltip applied via one of the element #setTooltip methods, That will override the item stack tool tip. -
enableStackToolTip
Enable the default item stack tooltip. (Default Enabled) Note: If theGuiItemStackelement has a tooltip applied via one of the element #setTooltip methods, That will override the item stack tool tip. -
renderBehind
public void renderBehind(net.minecraft.client.gui.GuiGraphics render, double mouseX, double mouseY, float partialTicks) Description copied from interface:BackgroundRenderUsed to render content behind this elements child elements. When rendering element content, always use thePoseStackavailable via the providedWhere applicable, always use push/pop to ensure the stack is returned to its original state after your rendering is complete.invalid reference
GuiRender- Specified by:
renderBehindin interfaceBackgroundRender- Parameters:
render- Contains gui context information as well as essential render methods/utils including the PoseStack.
-
renderOverlay
public boolean renderOverlay(net.minecraft.client.gui.GuiGraphics graphics, double mouseX, double mouseY, float partialTicks, boolean consumed) Description copied from class:GuiElementUsed to render overlay's such as hover text. Anything rendered in this method will be rendered on top of everything else on the screen. Only one overlay should be rendered at a time, When an element renders content via the overlay method it must return true to indicate the render call has been 'consumed' If the render call has already been consumed (Check via the consumed boolean) then this element should avoid rendering its overlay.When rendering overlay content, always use the
PoseStackavailable via the providedThis stack will already have the correct Z translation to ensure the overlay renders above everything else on the screen.invalid reference
GuiRenderTo check if the cursor is over this element, use 'render.hoveredElement() == this'
GuiElement.isMouseOver()Will also work, but may be problematic when multiple, stacked elements have overlay content.- Overrides:
renderOverlayin classGuiElement<GuiItemStack>- Parameters:
graphics- Contains gui context information as well as essential render methods/utils including the PoseStack.mouseX- Current mouse X positionmouseY- Current mouse Y positionpartialTicks- Partial render ticksconsumed- Will be true if the overlay render call has already been consumed by another element.- Returns:
- true if the render call has been consumed.
-