Adds a non-craftable
Display item that allows creating displays from any
item.
Items:
| item | loot table |
|---|---|
Display |
display:book |
Advancements:
| title | description |
|---|---|
A Joy to Behold |
create a display item |
Display can only be acquired through the display:book loot table.
When holding
Display on the off hand, you will notice
that the actionbar changes to display the following:
Display: <Mode> (<Args>)
At this point, dropping any item from your main hand turns it into a display item that can be edited. Edition is done by clicking on the item with either of the mouse buttons, and it depends on the current Mode:
| mode | LMB | RMB |
|---|---|---|
| Translate | Push | Pull |
| Rotate | Rotate CCW | Rotate CW |
| Scale | Scale down | Scale up |
| Billboard | Set billboard property |
|
| Brightness | Set brightness property |
|
| Shadow | Set shadow_strength property |
|
| Display | Set item_display property |
|
| Clipboard | Copy display properties | Paste display properties |
| Lock | Lock display | |
| Drop | Return original item | |
| Reset | Reset rotation and scale |
In addition to modes, there are instant actions that do not change the mode:
| action | description |
|---|---|
| Unlock | Unlock displays in a radius |
| Save Sel. | Saves selection |
| Load Sel. | Loads selection |
All these modes and actions are chosen through clickable words in the contents
of
Display.
Active items can have a black outline (if not selected) or a white outline (if selected). You can toggle their status by clicking them while crouched.
When not crouched, clicking on a selected item you will apply the chosen transformation to all currently selected items.
When not crouched, clicking on an unselected item will reset the selection to include only that item, and then apply the transformation to it.
Any transformation that makes the item too small in any two dimensions at once will cause it to break and drop as an item.
This datapack is able to unlock items created by the old Popular Displays pack, at which point they will become items from this pack instead.
Updates players holding
Display every second.
Uses advancements to check if a player has interacted with an unlocked item display, and if so runs the code to edit it.
The system has to do some creative math to calculate the transformation of objects according to the previous transformation and the new operations. Sadly, minecraft does not have a good way of doing good floating-point calculations so these are approximated by emulating fixed-point math with scoreboards. It works, but there are numeric errors that can accumulate on time, so applying a lot of transformations to a display can result in it being slightly deformed.
The way targeting works means that if you have more than one selected item, the copy to clipboard operation should always be performed on a selection of just one item, otherwise you will copy all selected items in sequence, and the clipboard will end with the data from the last one on it.
There are no checks on the upper bound of the size a display can acquire. There are some in the size of the interaction entity, but the transformation matrix for the display itself can overflow (usually as a result of upscaling) and result in a pseudo-randomly warped display.
The recalculation of the interaction bounding box assumes that the model for
the item is mostly centered and roughly fits in a cube of size 1, as most
models do when item_display=none; otherwise, the interaction might not fit
the model right or at all. If things get dicey, you can toggle bounding boxes
(F3+b) to see where the interaction entity actually is.