This improves the startup time dramatically by lowering the algorithm complexity.
Mainly noticeable with large inventory sizes.
Written by Test_User, post-edited by SmallJoker
- Added API for configuring categories
- Added display for categories above page
- Reduced height of page by 1 row to make room for categories
- Added L/R scroll through when there are more categories than columns
- Added pre-filter methods for categories and uncategorised items
- Added categories for (most) items in the default game
Co-authored-by: Oversword <bionc:oversword.co.uk>
to make them better-resemble their pre-9-sliced versions
(going to that mode made them slightly bigger and the corners
slightly less round since they aren't blurry anymore)
It had the same function as clicking the craft result on the
right (just inverted), making it redundant. Click either one more
than once and UI would alternately show usages or recipes.
MT nearest-neighbor-scales images to about 75px if they're 1x1
slot in size (at least on my screen). Use the next power of 2
above that, so that MT can scale down instead of up.
This way the slots are all nice and crisp regardless of GUI scale or
image size, and we only need the single slot and its bright version.
This also makes the standard crafting grid into a style table entry that
can be referenced to insert the crafting grid at its proper
style-specific position in any formspec.
And it also makes the craft grid arrow, its X position, and the crafting
grid's result slot X position into style table entries.
Includes a few public helper functions to do most of the work:
`ui.single_slot(xpos, ypos, bright)`
Does just what it sounds like: it returns a single slot image.
`xpos` and `ypos` are normal coordinates in slots, as you'd use in
`image[]` element. `bright` is a flag that switches to the brighter
version of the slot image.
`ui.make_trash_slot(xpos, ypos)`
Creates a single slot, with a one-item `list[]` and a trash can icon
overlay.
`ui.make_inv_img_grid(xpos, ypos, width, height, bright)`
Generates a `width` by `height` grid of slot images, using the
single_slot function above, starting at (`xpos`,`ypos`) for the
top-left. Position is as in any `image[]` element, and dimensions
are in integer numbers of slots (so 8,4 would be a standard inventory).
`bright` is as above.
All three return a string that can be directly inserted into a formspec.