Class AbstractPainter

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

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

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    A rectangle that can be pressed, dragged or scrolled over, in page pixels.
    static interface 
    Where a book goes when something on a page is pressed.

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

    GuidePainter.Drag, GuidePainter.Scroll
  • Field Summary

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

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

    Modifier and Type
    Method
    Description
    void
    Draws over everything drawn so far, items included (which otherwise lie over flat things drawn after them): for a reveal's effect about an item or over a whole page.
    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, GuidePainter.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)
    Draws an item, tinted by argb (white and opaque: as it is).
    net.minecraft.client.gui.Font
     
    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 GuidePainter.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>#<anchor>, 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)
    Where a point of the painter's own coordinates is on the page, through its moves.
    protected float
    pageY(float y)
     
     
    void
    pop()
     
    protected abstract void
     
    void
     
    protected abstract void
     
    void
    scale(float factor)
     
    protected abstract void
    scaled(float factor)
     
    boolean
    scroll(int x, int y, int width, int height, GuidePainter.Scroll scroll)
    Makes a rectangle take the mouse wheel while the pointer is over it, rather than the wheel turning the page.
    float
    Seconds since the book was opened: for what moves or cycles on a page.
    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.GuidePainter

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

  • Constructor Details

  • Method Details

    • pageWidth

      public int pageWidth()
      Description copied from interface: GuidePainter
      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 GuidePainter
      Parameters:
      pointerX - the pointer on the page, in page pixels; NaN when it isn't on it or the page can't be pressed
      hits - where this page's pressable places are put
    • pageHeight

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

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

      public GuidePalette palette()
      Specified by:
      palette in interface GuidePainter
    • time

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

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

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

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

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

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

      protected float pageX(float x)
      Where a point of the painter's own coordinates is on the page, through its moves.
    • 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: GuidePainter
      Whether the pointer is over a rectangle; never while the page is turning or covered.
      Specified by:
      hovered in interface GuidePainter
    • link

      public boolean link(int x, int y, int width, int height, String target)
      Description copied from interface: GuidePainter
      Makes a rectangle open a link when pressed: entry:<id>, entry:<id>#<anchor>, category:<id>, http(s)://..., or a bare entry id. Hovering it shows where it goes.
      Specified by:
      link in interface GuidePainter
      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: GuidePainter
      Makes a rectangle run something when pressed (on the client, during the press).
      Specified by:
      action in interface GuidePainter
      Parameters:
      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, GuidePainter.Drag drag)
      Description copied from interface: GuidePainter
      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 GuidePainter
      Returns:
      whether it is hovered
    • scroll

      public boolean scroll(int x, int y, int width, int height, GuidePainter.Scroll scroll)
      Description copied from interface: GuidePainter
      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 GuidePainter
      Returns:
      whether it is hovered
    • tooltip

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

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

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

      public void item(net.minecraft.world.item.ItemStack stack, int x, int y)
      Description copied from interface: GuidePainter
      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 GuidePainter
    • item

      public void item(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
      Description copied from interface: GuidePainter
      As GuidePainter.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 GuidePainter
    • drawItem

      protected abstract void drawItem(net.minecraft.world.item.ItemStack stack, int x, int y, int argb)
      Draws an item, tinted by argb (white and opaque: as it is).
    • above

      public void above(Runnable draw)
      Draws over everything drawn so far, items included (which otherwise lie over flat things drawn after them): for a reveal's effect about an item or over a whole page.