-
Notifications
You must be signed in to change notification settings - Fork 77
Trinkets API
While a majority of basic interactions with Trinkets, such as adding and configuring slots, will be done with data, there are a bevy of features Trinkets provides in code.
TrinketsApi.getTrinketComponent(LivingEntity)
returns an optional TrinketComponent
if present for the entity type. Trinket components contain a lot of the data Trinkets is aware of, such as inventories which can be accessed manually (though this is discouraged), access to modifiers, and some helper methods for using Trinkets.
isEquiped
can be called with either an item or a predicate and will return whether a trinket of that type is equipped.
getEquipped
is called with the same information as isEquipped
, and returns a list of slots and stacks pairs that match.
getAllEquipped
returns a list of all non-empty slots and stack pairs.
forEach
can loop over all slots and stacks for an entity.
Slots can specify validator, quick move, and tooltip predicates for logic, and while Trinkets provides a small amount of basic predicates, more can be added code side using TrinketsApi.registerTrinketPredicate
.
Trinkets provides a system for modifiers that adjust the amount of available slots for certain slot types. These can add and remove the amount of slots that exist of certain types, to as low as 0
. A helper to conveniently construct these is located at SlotAttributes.addSlotModifier
.