Interface FoliosPainter
- All Known Implementing Classes:
AbstractPainter,EdgeFadePainter,ObscuredPainter,RevealPainter,ScreenPainter,WorldPainter
public interface FoliosPainter
What a page draws with. The same calls draw it on a screen and on the pages of a book held in the world, so a page
is written once for every kind of book.
Coordinates are page pixels: (0, 0) is the page's top left, FoliosLayout.PAGE_WIDTH by
FoliosLayout.PAGE_HEIGHT, one pixel being one GUI pixel on a screen. push(), translate(float, float) and
scale(float) move what follows, and the pointer's place with it, so hovered(int, int, int, int) and link(int, int, int, int, java.lang.String) take the
same coordinates as the drawing.
There is no click handler on a page: it marks what can be pressed (link(int, int, int, int, java.lang.String), action(int, int, int, int, net.minecraft.network.chat.Component, java.lang.Runnable)) while it draws,
and a press lands on what was marked under the pointer in the last frame.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceWhat a dragged rectangle does as the pointer moves while it is held: by how far, in page pixels.static interfaceWhat a rectangle does when the mouse wheel turns over it: by how many notches, away from the reader positive. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaction(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).default voidcenteredText(net.minecraft.network.chat.Component text, int centerX, int y, int argb) default voidDraws with what is drawn kept inside a box, (x, y)widthbyheightin the painter's pixels.default intdefault intWhere the page's content ends at the right and at the foot.booleandrag(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.voidfill(int x0, int y0, int x1, int y1, int argb) booleanflat()Whether the page is on a screen (true), or on a book in the world (false).net.minecraft.client.gui.Fontfont()booleanhovered(int x, int y, int width, int height) Whether the pointer is over a rectangle; never while the page is turning or covered.voiditem(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.default voiditem(net.minecraft.world.item.ItemStack stack, int x, int y, int argb) Asitem(ItemStack, int, int), tinted byargb: its alpha fades the item, its colour tints it (white leaves it as it is).booleanMakes a rectangle open a link when pressed:entry:<id>,entry:<id>#<marker>,category:<id>,http(s)://..., or a bare entry id.default intdefault intThe 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).palette()voidpop()voidpush()voidscale(float scale) voidscene(net.ixdarklord.coolcatcanvas.api.client.viewport.SceneViewport viewport, int x, int y, int width, int height) A scene's picture; the painter keeps it in use while it is drawn.default voidscene(net.ixdarklord.coolcatcanvas.api.client.viewport.SceneViewport viewport, int x, int y, int width, int height, float u0, float u1) Asscene(SceneViewport, int, int, int, int), showing only the part of it fromu0tou1across (0 to 1).default voidscene(net.ixdarklord.coolcatcanvas.api.client.viewport.SceneViewport viewport, int x, int y, int width, int height, float u0, float v0, float u1, float v1, int argb) Asscene(SceneViewport, int, int, int, int), showing only the part of it from (u0,v0) to (u1,v1) (0 to 1, from its top left), tinted byargb: its alpha fades the picture.booleanscroll(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.default voidsilhouette(net.minecraft.world.item.ItemStack stack, int x, int y, int argb) An item's shape tinted byargb(dark, for a silhouette), with nothing of what it is: no count, no tooltip, no link.default voidtext(net.minecraft.network.chat.Component text, int x, int y, int argb) voidtext(net.minecraft.util.FormattedCharSequence text, int x, int y, int argb) voidtexture(net.minecraft.resources.ResourceLocation texture, int x, int y, int width, int height, float u0, float v0, float u1, float v1, int argb) A part of a texture, from its (u0, v0) to its (u1, v1), each 0 to 1, tinted byargb.floattime()Seconds since the book was opened: for what moves or cycles on a page.voidA tooltip of several lines: a name, then lines saying more.voidtooltip(net.minecraft.network.chat.Component text) Shows a tooltip at the pointer this frame.voidtooltip(net.minecraft.world.item.ItemStack stack) voidtranslate(float x, float y)
-
Method Details
-
font
net.minecraft.client.gui.Font font() -
palette
FoliosPalette palette() -
pageWidth
default int pageWidth()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). -
pageHeight
default int pageHeight() -
contentRight
default int contentRight()Where the page's content ends at the right and at the foot. -
contentBottom
default int contentBottom() -
time
float time()Seconds since the book was opened: for what moves or cycles on a page. -
flat
boolean flat()Whether the page is on a screen (true), or on a book in the world (false). -
fill
void fill(int x0, int y0, int x1, int y1, int argb) -
text
void text(net.minecraft.util.FormattedCharSequence text, int x, int y, int argb) -
text
default void text(net.minecraft.network.chat.Component text, int x, int y, int argb) -
centeredText
default void centeredText(net.minecraft.network.chat.Component text, int centerX, int y, int argb) -
texture
void texture(net.minecraft.resources.ResourceLocation texture, int x, int y, int width, int height, float u0, float v0, float u1, float v1, int argb) A part of a texture, from its (u0, v0) to its (u1, v1), each 0 to 1, tinted byargb. -
item
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. -
item
default void item(net.minecraft.world.item.ItemStack stack, int x, int y, int argb) Asitem(ItemStack, int, int), tinted byargb: 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. -
silhouette
default void silhouette(net.minecraft.world.item.ItemStack stack, int x, int y, int argb) An item's shape tinted byargb(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. -
scene
void scene(net.ixdarklord.coolcatcanvas.api.client.viewport.SceneViewport viewport, int x, int y, int width, int height) A scene's picture; the painter keeps it in use while it is drawn. -
scene
default void scene(net.ixdarklord.coolcatcanvas.api.client.viewport.SceneViewport viewport, int x, int y, int width, int height, float u0, float u1) Asscene(SceneViewport, int, int, int, int), showing only the part of it fromu0tou1across (0 to 1). -
scene
default void scene(net.ixdarklord.coolcatcanvas.api.client.viewport.SceneViewport viewport, int x, int y, int width, int height, float u0, float v0, float u1, float v1, int argb) Asscene(SceneViewport, int, int, int, int), showing only the part of it from (u0,v0) to (u1,v1) (0 to 1, from its top left), tinted byargb: its alpha fades the picture. -
clip
Draws with what is drawn kept inside a box, (x, y)widthbyheightin the painter's pixels. A painter that can't clip draws it all. -
push
void push() -
pop
void pop() -
translate
void translate(float x, float y) -
scale
void scale(float scale) -
hovered
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. -
link
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.- Returns:
- whether it is hovered
-
action
boolean action(int x, int y, int width, int height, @Nullable @Nullable net.minecraft.network.chat.Component tooltip, Runnable onPress) Makes a rectangle run something when pressed (on the client, during the press).- Parameters:
tooltip- shown while it is hovered; null for none- Returns:
- whether it is hovered
-
drag
Makes a rectangle draggable: held with the left button, it is told how far the pointer moves until let go.- Returns:
- whether it is hovered
-
scroll
Makes a rectangle take the mouse wheel while the pointer is over it, rather than the wheel turning the page.- Returns:
- whether it is hovered
-
tooltip
void tooltip(net.minecraft.network.chat.Component text) Shows a tooltip at the pointer this frame. -
tooltip
A tooltip of several lines: a name, then lines saying more. -
tooltip
void tooltip(net.minecraft.world.item.ItemStack stack)
-