Class AbstractPainter

java.lang.Object
net.ixdarklord.folios.internal.client.paint.AbstractPainter
All Implemented Interfaces:
FoliosPainter
Direct Known Subclasses:
ScreenPainter, WorldPainter

public abstract class AbstractPainter extends Object implements FoliosPainter
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
     
    static interface 
     

    Nested classes/interfaces inherited from interface net.ixdarklord.folios.api.client.page.FoliosPainter

    FoliosPainter.Drag, FoliosPainter.Scroll
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final net.minecraft.client.gui.Font
     
     
    protected final FoliosPalette
     
    protected final FoliosSession
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractPainter(FoliosPalette palette, FoliosSession session, AbstractPainter.Navigator navigator, float time, float pointerX, float pointerY, List<AbstractPainter.Hit> hits)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    boolean
    action(int x, int y, int width, int height, @Nullable net.minecraft.network.chat.Component tooltip, Runnable onPress)
    Makes a rectangle run something when pressed (on the client, during the press).
    boolean
    drag(int x, int y, int width, int height, FoliosPainter.Drag drag)
    Makes a rectangle draggable: held with the left button, it is told how far the pointer moves until let go.
    protected abstract void
    drawItem(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
     
    net.minecraft.client.gui.Font
     
    static void
    hold(@Nullable AbstractPainter.Hit hit)
     
    boolean
    hovered(int x, int y, int width, int height)
    Whether the pointer is over a rectangle; never while the page is turning or covered.
    void
    item(net.minecraft.world.item.ItemStack stack, int x, int y)
    An item's icon, 16 pixels square; hovering shows its tooltip, and it links to the book's entry about it, if any.
    void
    item(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
    As FoliosPainter.item(ItemStack, int, int), tinted by argb: its alpha fades the item, its colour tints it (white leaves it as it is).
    boolean
    link(int x, int y, int width, int height, String target)
    Makes a rectangle open a link when pressed: entry:<id>, entry:<id>#<marker>, category:<id>, http(s)://..., or a bare entry id.
    int
     
    protected float
     
    int
    The size of the page being drawn: the default page's unless the book's pages are larger (a screen book at a small GUI scale).
    protected float
    pageX(float x)
     
    protected float
    pageY(float y)
     
     
    void
    pop()
     
    protected abstract void
     
    @Nullable FoliosPopup
     
    void
     
    protected abstract void
     
    void
    quietItem(net.minecraft.world.item.ItemStack stack, int x, int y)
    As FoliosPainter.item(ItemStack, int, int), with no tooltip and no link: for an icon that only decorates, like a page's heading.
    void
    quietItem(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
     
    void
    scale(float factor)
     
    protected abstract void
    scaled(float factor)
     
    boolean
    scroll(int x, int y, int width, int height, FoliosPainter.Scroll scroll)
    Makes a rectangle take the mouse wheel while the pointer is over it, rather than the wheel turning the page.
    void
    silhouette(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
    An item's shape tinted by argb (dark, for a silhouette), with nothing of what it is: no count, no tooltip, no link.
    float
    Seconds since the book was opened: for what moves or cycles on a page.
    float
    time(float step)
    The time, held still between multiples of step seconds: for something that changes only every step seconds, like an item cycling through a tag.
    void
    tooltip(List<net.minecraft.network.chat.Component> lines)
    A tooltip of several lines: a name, then lines saying more.
    void
    tooltip(net.minecraft.network.chat.Component text)
    Shows a tooltip at the pointer this frame.
    void
    tooltip(net.minecraft.world.item.ItemStack stack)
     
    @Nullable List<net.minecraft.network.chat.Component>
     
    void
    translate(float x, float y)
     
    protected abstract void
    translated(float x, float y)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.ixdarklord.folios.api.client.page.FoliosPainter

    centeredText, clip, contentBottom, contentRight, fill, flat, scene, scene, scene, text, text, texture
  • Field Details

  • Constructor Details

  • Method Details

    • pageWidth

      public int pageWidth()
      Description copied from interface: FoliosPainter
      The size of the page being drawn: the default page's unless the book's pages are larger (a screen book at a small GUI scale).
      Specified by:
      pageWidth in interface FoliosPainter
    • pageHeight

      public int pageHeight()
      Specified by:
      pageHeight in interface FoliosPainter
    • font

      public net.minecraft.client.gui.Font font()
      Specified by:
      font in interface FoliosPainter
    • palette

      public FoliosPalette palette()
      Specified by:
      palette in interface FoliosPainter
    • time

      public float time()
      Description copied from interface: FoliosPainter
      Seconds since the book was opened: for what moves or cycles on a page.
      Specified by:
      time in interface FoliosPainter
    • time

      public float time(float step)
      Description copied from interface: FoliosPainter
      The time, held still between multiples of step seconds: for something that changes only every step seconds, like an item cycling through a tag. Lets a painter keep what it drew until the next step.
      Specified by:
      time in interface FoliosPainter
    • popup

      @Nullable public @Nullable FoliosPopup popup()
    • tooltipLines

      @Nullable public @Nullable List<net.minecraft.network.chat.Component> tooltipLines()
    • push

      public void push()
      Specified by:
      push in interface FoliosPainter
    • pop

      public void pop()
      Specified by:
      pop in interface FoliosPainter
    • translate

      public void translate(float x, float y)
      Specified by:
      translate in interface FoliosPainter
    • scale

      public void scale(float factor)
      Specified by:
      scale in interface FoliosPainter
    • pageX

      protected float pageX(float x)
    • pageY

      protected float pageY(float y)
    • pageScale

      protected float pageScale()
    • pushed

      protected abstract void pushed()
    • popped

      protected abstract void popped()
    • translated

      protected abstract void translated(float x, float y)
    • scaled

      protected abstract void scaled(float factor)
    • hovered

      public boolean hovered(int x, int y, int width, int height)
      Description copied from interface: FoliosPainter
      Whether the pointer is over a rectangle; never while the page is turning or covered.
      Specified by:
      hovered in interface FoliosPainter
    • link

      public boolean link(int x, int y, int width, int height, String target)
      Description copied from interface: FoliosPainter
      Makes a rectangle open a link when pressed: entry:<id>, entry:<id>#<marker>, category:<id>, http(s)://..., or a bare entry id. Hovering it shows where it goes.
      Specified by:
      link in interface FoliosPainter
      Returns:
      whether it is hovered
    • action

      public boolean action(int x, int y, int width, int height, @Nullable @Nullable net.minecraft.network.chat.Component tooltip, Runnable onPress)
      Description copied from interface: FoliosPainter
      Makes a rectangle run something when pressed (on the client, during the press).
      Specified by:
      action in interface FoliosPainter
      tooltip - shown while it is hovered; null for none
      Returns:
      whether it is hovered
    • drag

      public boolean drag(int x, int y, int width, int height, FoliosPainter.Drag drag)
      Description copied from interface: FoliosPainter
      Makes a rectangle draggable: held with the left button, it is told how far the pointer moves until let go.
      Specified by:
      drag in interface FoliosPainter
      Returns:
      whether it is hovered
    • hold

      public static void hold(@Nullable @Nullable AbstractPainter.Hit hit)
    • scroll

      public boolean scroll(int x, int y, int width, int height, FoliosPainter.Scroll scroll)
      Description copied from interface: FoliosPainter
      Makes a rectangle take the mouse wheel while the pointer is over it, rather than the wheel turning the page.
      Specified by:
      scroll in interface FoliosPainter
      Returns:
      whether it is hovered
    • tooltip

      public void tooltip(List<net.minecraft.network.chat.Component> lines)
      Description copied from interface: FoliosPainter
      A tooltip of several lines: a name, then lines saying more.
      Specified by:
      tooltip in interface FoliosPainter
    • tooltip

      public void tooltip(net.minecraft.network.chat.Component text)
      Description copied from interface: FoliosPainter
      Shows a tooltip at the pointer this frame.
      Specified by:
      tooltip in interface FoliosPainter
    • tooltip

      public void tooltip(net.minecraft.world.item.ItemStack stack)
      Specified by:
      tooltip in interface FoliosPainter
    • item

      public void item(net.minecraft.world.item.ItemStack stack, int x, int y)
      Description copied from interface: FoliosPainter
      An item's icon, 16 pixels square; hovering shows its tooltip, and it links to the book's entry about it, if any.
      Specified by:
      item in interface FoliosPainter
    • quietItem

      public void quietItem(net.minecraft.world.item.ItemStack stack, int x, int y)
      Description copied from interface: FoliosPainter
      As FoliosPainter.item(ItemStack, int, int), with no tooltip and no link: for an icon that only decorates, like a page's heading.
      Specified by:
      quietItem in interface FoliosPainter
    • quietItem

      public void quietItem(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
    • item

      public void item(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
      Description copied from interface: FoliosPainter
      As FoliosPainter.item(ItemStack, int, int), tinted by argb: its alpha fades the item, its colour tints it (white leaves it as it is). A painter that can't fade items shows it once its alpha is past half.
      Specified by:
      item in interface FoliosPainter
    • silhouette

      public void silhouette(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
      Description copied from interface: FoliosPainter
      An item's shape tinted by argb (dark, for a silhouette), with nothing of what it is: no count, no tooltip, no link. What a locked page or element shows of the items it holds. A painter that can't tint items draws nothing.
      Specified by:
      silhouette in interface FoliosPainter
    • drawItem

      protected abstract void drawItem(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
    • above

      public void above(Runnable draw)