Class WPlayerInvPanel
java.lang.Object
io.github.cottonmc.cotton.gui.widget.WWidget
io.github.cottonmc.cotton.gui.widget.WPanel
io.github.cottonmc.cotton.gui.widget.WPanelWithInsets
io.github.cottonmc.cotton.gui.widget.WPlainPanel
io.github.cottonmc.cotton.gui.widget.WPlayerInvPanel
A player inventory widget that has a visually separate hotbar.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final WItemSlotA 9 by 1WItemSlotthat represents the player's hotbar.protected final WItemSlotA 9 by 3WItemSlotthat represents the player's inventory.The label seen aboveinventory.Fields inherited from class WPanelWithInsets
insets -
Constructor Summary
ConstructorsConstructorDescriptionWPlayerInvPanel(net.minecraft.world.entity.player.Inventory playerInventory) Constructs a player inventory panel with a label.WPlayerInvPanel(net.minecraft.world.entity.player.Inventory playerInventory, boolean hasLabel) Constructs a player inventory panel.WPlayerInvPanel(net.minecraft.world.entity.player.Inventory playerInventory, @Nullable WWidget label) Constructs a player inventory panel. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether this widget can be resized usingWWidget.setSize(int, int).static WLabelcreateInventoryLabel(net.minecraft.world.entity.player.Inventory playerInventory) Creates a vanilla-style inventory label for a player inventory.setBackgroundPainter(BackgroundPainter painter) Sets the background painter of this inventory widget's slots.voidCreates component peers and initializes animation data for this Widget and all its children.Methods inherited from class WPlainPanel
add, add, setInsetsMethods inherited from class WPanelWithInsets
expandToFit, getInsetsMethods inherited from class WPanel
addPainters, expandToFit, getBackgroundPainter, hit, layout, onHidden, onShown, paint, remove, setHost, streamChildren, tick, toStringMethods inherited from class WWidget
addNarrations, addTooltip, canFocus, canFocusForTextInput, canHover, getAbsoluteX, getAbsoluteY, getFocusModel, getHeight, getHost, getParent, getWidth, getX, getY, hoveredProperty, isActivationKey, isFocused, isHovered, isNarratable, isWithinBounds, onCharTyped, onClick, onFocusGained, onFocusLost, onKeyPressed, onKeyReleased, onMouseDown, onMouseDrag, onMouseMove, onMouseScroll, onMouseUp, onPreeditUpdated, releaseFocus, renderTooltip, requestFocus, setHovered, setLocation, setParent, setSize, shouldRenderInDarkMode
-
Field Details
-
inventory
-
hotbar
-
label
The label seen aboveinventory.In vanilla and
WPlayerInvPanel(Inventory), this label is always 'Inventory'- Since:
- 8.1.0
- See Also:
-
-
Constructor Details
-
WPlayerInvPanel
public WPlayerInvPanel(net.minecraft.world.entity.player.Inventory playerInventory) Constructs a player inventory panel with a label.- Parameters:
playerInventory- the player inventory
-
WPlayerInvPanel
public WPlayerInvPanel(net.minecraft.world.entity.player.Inventory playerInventory, boolean hasLabel) Constructs a player inventory panel.- Parameters:
playerInventory- the player inventoryhasLabel- whether there should be an "Inventory" label- Since:
- 2.0.0
-
WPlayerInvPanel
-
-
Method Details
-
canResize
public boolean canResize()Description copied from class:WWidgetChecks whether this widget can be resized usingWWidget.setSize(int, int). -
createInventoryLabel
public static WLabel createInventoryLabel(net.minecraft.world.entity.player.Inventory playerInventory) Creates a vanilla-style inventory label for a player inventory.- Parameters:
playerInventory- the player inventory- Returns:
- the created label
- Since:
- 3.1.0
-
setBackgroundPainter
Sets the background painter of this inventory widget's slots.- Overrides:
setBackgroundPainterin classWPanel- Parameters:
painter- the new painter- Returns:
- this panel
-
validate
Description copied from class:WPanelCreates component peers and initializes animation data for this Widget and all its children. The host screen handler must clear any heavyweight peers from its records before this method is called.This method must be called on the root panel of any screen once the widgets have been initialized.
Subclasses should call
super.validate(c)to ensure that children are validated.
-