Package noppes.npcs.api.gui
Interface IComponentsWrapper
- All Known Subinterfaces:
IComponentsScrollableWrapper
,ICustomGui
public interface IComponentsWrapper
-
Method Summary
Modifier and TypeMethodDescriptionaddAssetsSelector
(int id, int x, int y, int width, int height) Add a Scroll List to the GUI, for the player to select from.Add a regular, Minecraft style button to this GUI.Add a regular, Minecraft style button to this GUI, with a defined width and height.addButtonList
(int id, int x, int y, int width, int height) Add a button which can cycle through values.addColoredLine
(int id, int xStart, int yStart, int xEnd, int yEnd, int color, float thickness) Add a colored linevoid
addComponent
(ICustomGuiComponent button) addEntityDisplay
(int id, int x, int y, IEntity entity) Add an entity displayaddItemRenderer
(int id, int x, int y, int width, int height, IItemStack stack) Add an ItemRendereraddItemSlot
(int x, int y) Add an Item Slot to the GUI.addItemSlot
(int x, int y, IItemStack stack) Add an Item Slot to the GUI with an IItemStack already in it.Add a OverlayLabelComponent to the GUI.Add a OverlayLabelComponent to the GUI.Add a Scroll List to the GUI, for the player to select from.Add a Scroll List to the GUI, for the player to select from.addTextArea
(int id, int x, int y, int width, int height) Add a Text Field input to the GUI, that the player can type into.addTextField
(int id, int x, int y, int width, int height) Add a Text Field input to the GUI, that the player can type into.addTexturedButton
(int id, String label, int x, int y, int width, int height, String texture) Add a button with a custom texture to this GUI.addTexturedButton
(int id, String label, int x, int y, int width, int height, String texture, int textureX, int textureY) Add a button with a custom texture to this GUI, with a texture offset.addTexturedRect
(int id, String texture, int x, int y, int width, int height) Add a texture to be drawn within the GUI.addTexturedRect
(int id, String texture, int x, int y, int width, int height, int textureX, int textureY) Add a texture to be drawn within the GUI.getComponent
(int id) Get a component from this GUI by it's ID.getSlots()
void
removeComponent
(int id) Remove component from this GUI by it's ID.void
removeItemSlot
(IItemSlot slot) void
showPlayerInventory
(int x, int y) Deprecated.showPlayerInventory
(int x, int y, boolean full) Add a display of the Player's Inventory to the GUI.
-
Method Details
-
addButton
Add a regular, Minecraft style button to this GUI. Uses default width and height.- Parameters:
id
- - Unique ID for identifying this button.label
- - String to display on this button.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.
-
addButton
Add a regular, Minecraft style button to this GUI, with a defined width and height.- Parameters:
id
- - Unique ID for identifying this button.label
- - String to display on this button.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of this button.height
- - Height of this button.
-
addButtonList
Add a button which can cycle through values.- Parameters:
id
- - Unique ID for identifying this button.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of this button.height
- - Height of this button.
-
addTexturedButton
IButton addTexturedButton(int id, String label, int x, int y, int width, int height, String texture) Add a button with a custom texture to this GUI. Hover Texture is taken from directly beneath the base texture. For examples, look at Vanilla Minecraft button textures.- Parameters:
id
- - Unique ID for identifying this button.label
- - String to display on this button.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of this button and texture.height
- - Height of this button and texture.texture
- - Resource Location of the texture to use. (For Example: "minecraft:textures/gui/widgets.png")
-
addTexturedButton
IButton addTexturedButton(int id, String label, int x, int y, int width, int height, String texture, int textureX, int textureY) Add a button with a custom texture to this GUI, with a texture offset. Hover Texture is taken from directly beneath the base texture. For examples, look at Vanilla Minecraft button textures.- Parameters:
id
- - Unique ID for identifying this button.label
- - String to display on this button.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of this button and texture.height
- - Height of this button and texture.texture
- - Resource Location of the texture to use. (For Example: "minecraft:textures/gui/widgets.png")textureX
- - X offset of the desired texture within the defined texture file. Should refer to the Top-Left of the desired texture.textureY
- - Y offset of the desired texture within the defined texture file. Should refer to the Top-Left of the desired texture.
-
addLabel
Add a OverlayLabelComponent to the GUI.- Parameters:
id
- - Unique ID for identifying this label.label
- - String to display.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of this label. (Does Not Change the font size.)height
- - Height of this label. (Does Not Change the font size.)
-
addLabel
Add a OverlayLabelComponent to the GUI.- Parameters:
id
- - Unique ID for identifying this label.label
- - String to display.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of this label. (Does Not Change the font size.)height
- - Height of this label. (Does Not Change the font size.)color
- - Color to be applied;
-
addTextField
Add a Text Field input to the GUI, that the player can type into.- Parameters:
id
- - Unique ID for identifying this label.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of this Text Field.height
- - Height of this Text Field.
-
addTextArea
Add a Text Field input to the GUI, that the player can type into.- Parameters:
id
- - Unique ID for identifying this label.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of this Text Field.height
- - Height of this Text Field.
-
addScroll
Add a Scroll List to the GUI, for the player to select from.- Parameters:
id
- - Unique ID for identifying this scroll.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of the Scroll List.height
- - Height of the Scroll List.list
- - List of String options for the player to choose from.
-
addSlider
Add a Scroll List to the GUI, for the player to select from.- Parameters:
id
- - Unique ID for identifying this scroll.format
- - String format for displayx
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of the Scroll List.height
- - Height of the Scroll List.
-
addEntityDisplay
Add an entity display- Parameters:
id
- - Unique ID for identifying this component.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.entity
- - Entity for display
-
addColoredLine
IColoredLine addColoredLine(int id, int xStart, int yStart, int xEnd, int yEnd, int color, float thickness) Add a colored line- Parameters:
id
- - Unique ID for identifying this component.xStart
- - Start X Position, relative to the Left side of the GUI window.yStart
- - Start Y Position, relative to the Top of the GUI window.xEnd
- - End X Position, relative to the Left side of the GUI window.yEnd
- - End Y Position, relative to the Top of the GUI window.color
- - Color in RGBA formatthickness
- - Line thickness in pixels
-
addItemRenderer
Add an ItemRenderer- Parameters:
id
- - Unique ID for identifying this component.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of the ItemRenderer hover box.height
- - Height of the ItemRenderer hover box.stack
- - ItemStack to display
-
addAssetsSelector
Add a Scroll List to the GUI, for the player to select from.- Parameters:
id
- - Unique ID for identifying this component.x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of the component.height
- - Height of the component.
-
addTexturedRect
Add a texture to be drawn within the GUI.- Parameters:
id
- - Unique ID for identifying this texture.texture
- - Resource Location of the texture to use. (For Example: "minecraft:textures/gui/widgets.png")x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of the texture.height
- - Height of the texture.
-
addTexturedRect
ITexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height, int textureX, int textureY) Add a texture to be drawn within the GUI.- Parameters:
id
- - Unique ID for identifying this texture.texture
- - Resource Location of the texture to use. (For Example: "minecraft:textures/gui/widgets.png")x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.width
- - Width of the texture.height
- - Height of the texture.textureX
- - X offset of the desired texture within the defined texture file. Should refer to the Top-Left of the desired texture.textureY
- - Y offset of the desired texture within the defined texture file. Should refer to the Top-Left of the desired texture.
-
getComponents
List<ICustomGuiComponent> getComponents() -
getComponent
Get a component from this GUI by it's ID.- Parameters:
id
- - Component ID to match.- Returns:
- First ICustomGuiComponent with a matching ID, otherwise null.
-
addComponent
-
removeComponent
void removeComponent(int id) Remove component from this GUI by it's ID.- Parameters:
id
- - Component ID to match.
-
getSlots
-
getPlayerSlots
-
addItemSlot
Add an Item Slot to the GUI. CAUTION: Handling Item Storage can be complicated. Once the GUI closes, any items in it will be lost unless you handle storing/saving this information yourself.- Parameters:
x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.
-
addItemSlot
Add an Item Slot to the GUI with an IItemStack already in it. CAUTION: Handling Item Storage can be complicated. Once the GUI closes, any items in it will be lost unless you handle storing/saving this information yourself.- Parameters:
x
- - X Position, relative to the Left side of the GUI window.y
- - Y Position, relative to the Top of the GUI window.stack
- - IItemStack to be in this slot upon opening the GUI.
-
removeItemSlot
-
showPlayerInventory
Deprecated. -
showPlayerInventory
Add a display of the Player's Inventory to the GUI. A Player's inventory is around 162 Wide, and 58 Tall. Take this into consideration when placing this.- Parameters:
x
- - X Position of the Top-Left corner, relative to the Left side of the GUI window.y
- - Y Position of the Top-Left corner, relative to the Top of the GUI window.full
- - Show the full inventory or just the hotbar
-