Record Class PixelIcon

java.lang.Object
java.lang.Record
net.ixdarklord.folios.internal.client.paint.PixelIcon

public record PixelIcon(net.minecraft.resources.ResourceLocation texture, int width, int height, int frames) extends Record
One of the books' small pixel-art icons: a white image (its softer pixels part see-through), drawn at its own size, a pixel to a pixel, tinted with the colour it is drawn in. Read from assets/folios/textures/gui/icons/, so a resource pack can redraw any of them (kept the same size). An icon with frames is a flipbook: its frames stacked top to bottom in the one image, each width by height.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PixelIcon(net.minecraft.resources.ResourceLocation texture, int width, int height, int frames)
    Creates an instance of a PixelIcon record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    draw(GuidePainter painter, int x, int y, int color)
    Draws it with its top left at (x, y), in the colour given.
    void
    draw(GuidePainter painter, int x, int y, int frame, int color)
    Draws one of its frames (0 for the top one).
    void
    draw(GuiGraphicsExtractor graphics, int x, int y, int color)
    The same, straight to the screen.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the frames record component.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    static PixelIcon
    of(String name, int width, int height)
     
    static PixelIcon
    of(String name, int width, int height, int frames)
    A flipbook of frames frames, stacked top to bottom.
    net.minecraft.resources.ResourceLocation
    Returns the value of the texture record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the width record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PixelIcon

      public PixelIcon(net.minecraft.resources.ResourceLocation texture, int width, int height, int frames)
      Creates an instance of a PixelIcon record class.
      Parameters:
      texture - the value for the texture record component
      width - the value for the width record component
      height - the value for the height record component
      frames - the value for the frames record component
  • Method Details

    • of

      public static PixelIcon of(String name, int width, int height)
    • of

      public static PixelIcon of(String name, int width, int height, int frames)
      A flipbook of frames frames, stacked top to bottom.
    • draw

      public void draw(GuidePainter painter, int x, int y, int color)
      Draws it with its top left at (x, y), in the colour given.
    • draw

      public void draw(GuidePainter painter, int x, int y, int frame, int color)
      Draws one of its frames (0 for the top one).
    • draw

      public void draw(GuiGraphicsExtractor graphics, int x, int y, int color)
      The same, straight to the screen.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • texture

      public net.minecraft.resources.ResourceLocation texture()
      Returns the value of the texture record component.
      Returns:
      the value of the texture record component
    • width

      public int width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public int height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • frames

      public int frames()
      Returns the value of the frames record component.
      Returns:
      the value of the frames record component