Class GuiProgressIcon
java.lang.Object
codechicken.lib.gui.modular.lib.geometry.ConstrainedGeometry<GuiProgressIcon>
codechicken.lib.gui.modular.elements.GuiElement<GuiProgressIcon>
codechicken.lib.gui.modular.elements.GuiProgressIcon
- All Implemented Interfaces:
BackgroundRender,ElementEvents,GuiParent<GuiProgressIcon>,TooltipHandler<GuiProgressIcon>
This can be used to create a simple progress indicator like those used in machines like furnaces.
The background texture (if one is used) and the animated texture must be the same shape and size, They must be designed so that the animated texture can be rendered directly on top of the background texture with no offset. The animated texture should not have any empty space on ether end as the entire width of the texture is used in the animation.
Texture must be designed for left to right animation,
Created by brandon3055 on 04/09/2023
-
Field Summary
Fields inherited from class codechicken.lib.gui.modular.elements.GuiElement
hoverTime, initialized -
Constructor Summary
ConstructorsConstructorDescriptionGuiProgressIcon(@NotNull GuiParent<?> parent) GuiProgressIcon(@NotNull GuiParent<?> parent, Material animated) GuiProgressIcon(@NotNull GuiParent<?> parent, Material background, Material animated) GuiProgressIcon(@NotNull GuiParent<?> parent, Supplier<Material> animated) GuiProgressIcon(@NotNull GuiParent<?> parent, Supplier<Material> background, Supplier<Material> animated) -
Method Summary
Modifier and TypeMethodDescriptiondoublevoidrenderBackground(GuiRender render, double mouseX, double mouseY, float partialTicks) Used to render content behind this elements child elements.setAnimated(Material animated) Sets the texture that will be animated.setAnimated(Supplier<Material> animated) Sets the texture that will be animated.setBackground(@Nullable Material background) Sets the background texture, aka the "empty" texture.setBackground(@Nullable Supplier<Material> background) Sets the background texture, aka the "empty" texture.setDirection(Direction direction) Set the direction this progress icon is pointing, Default is RIGHTsetProgress(double progress) Set the current progress to a fixed value.setProgress(Supplier<Double> progress) Attach a supplier that returns the current progress value for this progress icon (0 to 1)setRotateToDirection(boolean rotateToDirection) The expected default direction for a progress texture is left-to-right e.g.Methods inherited from class codechicken.lib.gui.modular.elements.GuiElement
addChild, addJeiDropTargets, addJeiExclusions, adoptChild, applyQueuedChildUpdates, blockMouseEvents, blockMouseOver, bringChildToForeground, font, getChildren, getCombinedElementDepth, getJeiDropConsumer, getModularGui, getParent, getTooltip, getTooltipDelay, hoverTime, initElement, isDescendantOf, isEnabled, isJeiDropTarget, isJeiExcluded, isMouseOver, isOpaque, isRemoved, isTooltipEnabled, jeiExclude, mc, onScreenInit, removeChild, render, renderChild, renderOverlay, scaledScreenHeight, scaledScreenWidth, sendChildToBackground, sendChildToIndex, setEnabled, setEnabled, setEnableToolTip, setJeiDropTarget, setJeiExcluded, setOpaque, setRenderCull, setTooltip, setTooltipDelay, setZStacking, showToolTip, tick, toString, updateMouseOver, updateScreenData, zStackingMethods 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.BackgroundRender
getBackgroundDepthMethods 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
-
GuiProgressIcon
-
GuiProgressIcon
-
GuiProgressIcon
-
GuiProgressIcon
-
GuiProgressIcon
-
-
Method Details
-
setRotateToDirection
The expected default direction for a progress texture is left-to-right e.g. furnace arrow. The texture will then be rotated to the direction specified viasetDirection(Direction)If you do not want the texture to be rotated then set this to false. -
setDirection
Set the direction this progress icon is pointing, Default is RIGHT -
setBackground
Sets the background texture, aka the "empty" texture. -
setBackground
Sets the background texture, aka the "empty" texture. -
setAnimated
Sets the texture that will be animated. -
setAnimated
Sets the texture that will be animated. -
setProgress
Set the current progress to a fixed value.- See Also:
-
setProgress
Attach a supplier that returns the current progress value for this progress icon (0 to 1) -
getProgress
public double getProgress() -
renderBackground
Description copied from interface:BackgroundRenderUsed to render content behind this elements child elements. When rendering element content, always use thePoseStackavailable via the providedGuiRenderWhere applicable, always use push/pop to ensure the stack is returned to its original state after your rendering is complete.- Specified by:
renderBackgroundin interfaceBackgroundRender- Parameters:
render- Contains gui context information as well as essential render methods/utils including the PoseStack.
-