Skip to content

Trinkets Data Formats

Emily Rose Ploszaj edited this page Sep 29, 2021 · 5 revisions

Entity Slots

Entity slot files define what slots an entity has available. By default, entities have access to no slots, so they need to be added in order to be used. Simple mods will likely only need to add some of the default slots to entities for use and not need to make their own. The default slots can be found here. These files are loaded from data/trinkets/entities/[id].json

Field Description
replace Either true or false. Defaults to false. When true, lower level datapack modifications will be replaced. Useful for datapacks or modpacks that completely replace slot information.
slots An array of string slot IDs in the format group/slot.
entities An array of string entity IDs to apply to. player for players.

This following example will add the default belt, aglet, and ring slots to all players:

{
  "entities": [
    "player"
  ],
  "slots": [
    "legs/belt",
    "feet/aglet",
    "hand/ring"
  ]
}

Slot Tags

By default, slots only accept items in the corresponding slot tag. Slot tags are located at data/trinkets/tags/items/[group]/[slot].json and are simple item tags.

Slots

Trinkets provides a collection of common slots, including slot textures, translation keys, and basic data. These can be found here. However, Trinkets also supports letting mod and modpack makers create their own slots and slot groups for arbitrary usage. Slots require a bit of data, but the first step is the json file, which are loaded from data/trinkets/slots/[group]/[slot].json. Do note that all slots are required to be part of a slot group, which are automatically constructed from name but can have additional data.

Field Default Description
replace false Either true or false. When true, lower level datapack modifications will be replaced. Useful for datapacks or modpacks that completely replace slot information.
amount 1 The amount of slots of this type to add. Duplicates extend vertically. This value can be adjusted using EAMs in game.
order 0 The ordering number, used for positioning within slot groups, lower first. Slots with equal ordering will be placed arbitrarily. Order is identical to the order in which slots are added, meaning, the first is placed as the preview slot in the center, the next is to the right, the next is to the left, and it continues to add on to either side. Slot groups over vanilla slots will always have the vanilla slots at the first position. As a visualization, 10 slots would be positioned like so: 8 6 4 2 0 1 3 5 7 9.
icon None, required The icon to use for an empty slot of this type. For instance, rings use trinkets:gui/slots/ring.
drop_rule default The default behavior for dropping items from these slots. Items can override this behavior. One of keep, drop, destroy, or default. If set to default, items will be treated like normal inventory slots, obeying keepInventory and Curse of Vanishing
validator_predicates trinkets:tag A list of identifiers in the predicate registry for determining what items can go into this slot. See trinket predicates for available, more can be added by mods for specialized use.
quick_move_predicates trinkets:all A list of identifiers in the predicate registry for determining when items can be quick moved (also known as shift clicked) into the slot. Only applied to items that are already valid to be inside of the slots. See trinket predicates for available, more can be added by mods for specialized use.
tooltip_predicates trinkets:all A list of identifiers in the predicate registry for determining when items will display their information about this slot, including if the slot is valid and what modifiers it provides. Only applied to items that are already valid to be inside of the slots. See trinket predicates for available, more can be added by mods for specialized use.

Trinket Predicates

Identifier Function
trinkets:all Always returns true
trinkets:none Always returns false
trinkets:tag Returns true for items in the slot's tag, otherwise passes. Will also match the trinkets:all item tag, for items that can go into any slot
trinkets:relevant Returns true for items that are "relevant" to the slot, providing EAMs

New slots will also require lang entries, which can be provided using the translation key format trinkets.slot.[group].[slot].

An example of a hypothetical charm/charm slot

{
  "icon": "trinkets:gui/slots/charm"
}

Slot Groups

In addition to slots, slot groups can be modified, though don't require data by default. Slot group configuration is located at data/trinkets/slots/[group]/group.json.

Field Description
slot_id The raw screen handler slot id to place a group over. It is very unlikely that anyone other than a Trinkets developer will need to use this, but is documented for posterity.
order The ordering position for slot groups, lower are added first. The first groups are above the offhand going up, then to the left of the inventory going left and down. Has no function if slot_id is set, as position will be based on that slot. It is recommended that slot groups that are expected to be empty often should be a positive integer, as to not pop in the middle of a bunch of permanent slot groups.
Clone this wiki locally