java.lang.Object
io.github.somesourcecode.someguiapi.scene.Pixel

public class Pixel extends Object
An instance of Pixel contains all the information needed to render a single item in a GUI.
Since:
2.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new empty pixel.
    Pixel(org.bukkit.Material material)
    Constructs a new pixel with the specified material.
    Pixel(org.bukkit.Material material, int index)
    Constructs a new pixel with the specified material and title.
    Pixel(org.bukkit.Material material, int index, net.kyori.adventure.text.Component title)
    Constructs a new pixel with the specified material and title.
    Pixel(org.bukkit.Material material, int index, net.kyori.adventure.text.Component title, Lore lore)
    Constructs a new pixel with the specified material, index, title, and lore.
    Pixel(org.bukkit.Material material, int index, net.kyori.adventure.text.Component title, Lore lore, boolean glow)
    Constructs a new pixel with the specified material, index, title, lore, and glow.
    Pixel(org.bukkit.Material material, net.kyori.adventure.text.Component title)
    Constructs a new pixel with the specified material and title.
    Pixel(org.bukkit.Material material, net.kyori.adventure.text.Component title, Lore lore)
    Constructs a new pixel with the specified material, title, and lore.
    Pixel(org.bukkit.Material material, net.kyori.adventure.text.Component title, Lore lore, boolean glow)
    Constructs a new pixel with the specified material, title, lore, and glow.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Pixel
    blank(org.bukkit.Material material)
    Creates a pixel with the specified material and empty title and lore.
    static Pixel
    Creates an empty pixel.
    int
    Returns the index of this pixel.
    Returns the lore of this pixel.
    org.bukkit.Material
    Returns the material of this pixel.
    net.kyori.adventure.text.Component
    Returns the title of this pixel.
    boolean
    Returns whether this pixel is empty.
    boolean
    Returns whether this pixel should glow.
    static Pixel
    of(org.bukkit.Material material)
    Creates a pixel with the specified material.
    org.bukkit.inventory.ItemStack
    Renders this pixel as an ItemStack.
    setGlow(boolean glow)
    Sets whether this pixel should glow.
    setIndex(int index)
    Sets the index of this pixel.
    setLore(Lore lore)
    Sets the lore of this pixel.
    setMaterial(org.bukkit.Material material)
    Sets the material of this pixel.
    setTitle(net.kyori.adventure.text.Component title)
    Sets the title of this pixel.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Pixel

      public Pixel()
      Constructs a new empty pixel.
      Since:
      2.0.0
    • Pixel

      public Pixel(org.bukkit.Material material)
      Constructs a new pixel with the specified material.
      Parameters:
      material - the material
      Since:
      2.0.0
    • Pixel

      public Pixel(org.bukkit.Material material, int index)
      Constructs a new pixel with the specified material and title.
      Parameters:
      material - the material
      index - the index
      Since:
      2.0.0
    • Pixel

      public Pixel(org.bukkit.Material material, int index, net.kyori.adventure.text.Component title)
      Constructs a new pixel with the specified material and title.
      Parameters:
      material - the material
      index - the index
      title - the title
      Since:
      2.0.0
    • Pixel

      public Pixel(org.bukkit.Material material, int index, net.kyori.adventure.text.Component title, Lore lore)
      Constructs a new pixel with the specified material, index, title, and lore.
      Parameters:
      material - the material
      index - the index
      title - the title
      lore - the lore
      Since:
      2.0.0
    • Pixel

      public Pixel(org.bukkit.Material material, int index, net.kyori.adventure.text.Component title, Lore lore, boolean glow)
      Constructs a new pixel with the specified material, index, title, lore, and glow.
      Parameters:
      material - the material
      index - the index
      title - the title
      lore - the lore
      glow - whether the pixel should glow
      Since:
      2.0.0
    • Pixel

      public Pixel(org.bukkit.Material material, net.kyori.adventure.text.Component title)
      Constructs a new pixel with the specified material and title.
      Parameters:
      material - the material
      title - the title
      Since:
      2.0.0
    • Pixel

      public Pixel(org.bukkit.Material material, net.kyori.adventure.text.Component title, Lore lore)
      Constructs a new pixel with the specified material, title, and lore.
      Parameters:
      material - the material
      title - the title
      lore - the lore
      Since:
      2.0.0
    • Pixel

      public Pixel(org.bukkit.Material material, net.kyori.adventure.text.Component title, Lore lore, boolean glow)
      Constructs a new pixel with the specified material, title, lore, and glow.
      Parameters:
      material - the material
      title - the title
      lore - the lore
      glow - whether the pixel should glow
      Since:
      2.0.0
  • Method Details

    • empty

      public static Pixel empty()
      Creates an empty pixel. Empty pixels will be rendered as air.
      Returns:
      the empty pixel
      Since:
      2.0.0
    • blank

      public static Pixel blank(org.bukkit.Material material)
      Creates a pixel with the specified material and empty title and lore.
      Parameters:
      material - the material
      Returns:
      the blank pixel
      Since:
      2.0.0
    • of

      public static Pixel of(org.bukkit.Material material)
      Creates a pixel with the specified material.
      Parameters:
      material - the material
      Returns:
      the pixel
      Since:
      2.0.0
    • getMaterial

      public org.bukkit.Material getMaterial()
      Returns the material of this pixel.
      Returns:
      the material
      Since:
      2.0.0
    • setMaterial

      public Pixel setMaterial(org.bukkit.Material material)
      Sets the material of this pixel.
      Parameters:
      material - the material
      Returns:
      the pixel for method chaining
      Since:
      2.0.0
    • getTitle

      public net.kyori.adventure.text.Component getTitle()
      Returns the title of this pixel.
      Returns:
      the title
      Since:
      2.0.0
    • setTitle

      public Pixel setTitle(net.kyori.adventure.text.Component title)
      Sets the title of this pixel.
      Parameters:
      title - the title
      Returns:
      the pixel for method chaining
      Since:
      2.0.0
    • getLore

      public Lore getLore()
      Returns the lore of this pixel.
      Returns:
      the lore
      Since:
      2.0.0
    • setLore

      public Pixel setLore(Lore lore)
      Sets the lore of this pixel.
      Parameters:
      lore - the lore
      Returns:
      the pixel for method chaining
      Since:
      2.0.0
    • getIndex

      public int getIndex()
      Returns the index of this pixel.
      Returns:
      the index
      Since:
      2.0.0
    • setIndex

      public Pixel setIndex(int index)
      Sets the index of this pixel.
      Parameters:
      index - the index
      Returns:
      the pixel for method chaining
      Since:
      2.0.0
    • isGlow

      public boolean isGlow()
      Returns whether this pixel should glow.
      Returns:
      whether this pixel should glow
      Since:
      2.0.0
    • setGlow

      public Pixel setGlow(boolean glow)
      Sets whether this pixel should glow.
      Parameters:
      glow - whether this pixel should glow
      Returns:
      the pixel for method chaining
      Since:
      2.0.0
    • isEmpty

      public boolean isEmpty()
      Returns whether this pixel is empty. A pixel is considered empty if its material is null or air or if its index is less than or equal to 0.
      Returns:
      whether this pixel is empty
      Since:
      2.0.0
    • renderItemStack

      public org.bukkit.inventory.ItemStack renderItemStack(RenderContext renderContext)
      Renders this pixel as an ItemStack.
      Parameters:
      renderContext - the render context
      Returns:
      the rendered ItemStack
      Since:
      2.0.0