Interface ICustomGui


public interface ICustomGui
  • Method Summary

    Modifier and Type Method Description
    IButton addButton​(int id, java.lang.String label, int x, int y)
    Add a regular, Minecraft style button to this GUI.
    IButton addButton​(int id, java.lang.String label, int x, int y, int width, int height)
    Add a regular, Minecraft style button to this GUI, with a defined width and height.
    IItemSlot addItemSlot​(int x, int y)
    Add an Item Slot to the GUI.
    IItemSlot addItemSlot​(int x, int y, IItemStack stack)
    Add an Item Slot to the GUI with an IItemStack already in it.
    ILabel addLabel​(int id, java.lang.String label, int x, int y, int width, int height)
    Add a Label to the GUI.
    ILabel addLabel​(int id, java.lang.String label, int x, int y, int width, int height, int color)
    Add a Label to the GUI.
    IScroll addScroll​(int id, int x, int y, int width, int height, java.lang.String[] list)
    Add a Scroll List to the GUI, for the player to select from.
    ITextField 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.
    IButton addTexturedButton​(int id, java.lang.String label, int x, int y, int width, int height, java.lang.String texture)
    Add a button with a custom texture to this GUI.
    IButton addTexturedButton​(int id, java.lang.String label, int x, int y, int width, int height, java.lang.String texture, int textureX, int textureY)
    Add a button with a custom texture to this GUI, with a texture offset.
    ITexturedRect addTexturedRect​(int id, java.lang.String texture, int x, int y, int width, int height)
    Add a texture to be drawn within the GUI.
    ITexturedRect addTexturedRect​(int id, java.lang.String texture, int x, int y, int width, int height, int textureX, int textureY)
    Add a texture to be drawn within the GUI.
    ICustomGuiComponent getComponent​(int id)
    Get a component from this GUI by it's ID.
    java.util.List<ICustomGuiComponent> getComponents()  
    int getHeight()  
    int getID()  
    java.util.List<IItemSlot> getSlots()  
    int getWidth()  
    void removeComponent​(int id)
    Remove component from this GUI by it's ID.
    void setBackgroundTexture​(java.lang.String resourceLocation)  
    void setDoesPauseGame​(boolean pauseGame)  
    void setSize​(int width, int height)  
    void showPlayerInventory​(int x, int y)
    Add a display of the Player's Inventory to the GUI.
    void update​(IPlayer player)
    Update the given player's CustomGUI with this one.
    void updateComponent​(ICustomGuiComponent component)
    Update a given component in this GUI, if a component with a matching ID exists.
  • Method Details

    • getID

      int getID()
    • getWidth

      int getWidth()
    • getHeight

      int getHeight()
    • getComponents

      java.util.List<ICustomGuiComponent> getComponents()
    • getSlots

      java.util.List<IItemSlot> getSlots()
    • setSize

      void setSize​(int width, int height)
    • setDoesPauseGame

      void setDoesPauseGame​(boolean pauseGame)
    • setBackgroundTexture

      void setBackgroundTexture​(java.lang.String resourceLocation)
    • addButton

      IButton addButton​(int id, java.lang.String label, int x, int y)
      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

      IButton addButton​(int id, java.lang.String label, int x, int y, int width, int height)
      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.
    • addTexturedButton

      IButton addTexturedButton​(int id, java.lang.String label, int x, int y, int width, int height, java.lang.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, java.lang.String label, int x, int y, int width, int height, java.lang.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

      ILabel addLabel​(int id, java.lang.String label, int x, int y, int width, int height)
      Add a Label 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

      ILabel addLabel​(int id, java.lang.String label, int x, int y, int width, int height, int color)
      Add a Label 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

      ITextField 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.
      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.
    • addTexturedRect

      ITexturedRect addTexturedRect​(int id, java.lang.String texture, int x, int y, int width, int height)
      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, java.lang.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.
    • addScroll

      IScroll addScroll​(int id, int x, int y, int width, int height, java.lang.String[] list)
      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.
    • addItemSlot

      IItemSlot addItemSlot​(int x, int y)
      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

      IItemSlot addItemSlot​(int x, int y, IItemStack stack)
      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.
    • showPlayerInventory

      void showPlayerInventory​(int x, int y)
      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.
    • getComponent

      ICustomGuiComponent getComponent​(int id)
      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.
    • removeComponent

      void removeComponent​(int id)
      Remove component from this GUI by it's ID.
      Parameters:
      id - - Component ID to match.
    • updateComponent

      void updateComponent​(ICustomGuiComponent component)
      Update a given component in this GUI, if a component with a matching ID exists.
      Parameters:
      component -
    • update

      void update​(IPlayer player)
      Update the given player's CustomGUI with this one.
      Parameters:
      player - - Player to send this CustomGUI to.