-
Notifications
You must be signed in to change notification settings - Fork 49
Accessories
The Changed: Minecraft Mod uses a dynamic inventory system to account for wearing items for players of all different shapes and sizes. AccessorySlotTypes are registered slots that an entity can have. The base mod has a handful of common accessory slots that entities can use:
| Slot Name | Description | Example Item |
|---|---|---|
changed:body |
Torso and arms | Shirts |
changed:face |
Front of the head | Face masks |
changed:full_body |
Head, torso, arms, and legs | Lab coats |
changed:hands |
End of the arms | Gloves |
changed:head |
Top of the head | Hats |
changed:legs |
Legs | Shorts/Pants |
changed:lower_body |
Lower half of a taur-like entity | Saddle |
changed:lower_body_side |
Sides of the lower half of a taur-like entity | Chest |
changed:neck |
Upper half of the torso | Neck-tie/Collar |
There are a few steps required to fully implement a new slot type.
AccessorySlotTypes are registered to ChangedRegistry.ACCESSORY_SLOTS, and only have one parameter: the equivalent Vanilla slot. This slot is used for gathering the item's attribute modifiers. Below is an example on registering a slot type for an entity's feet.
public class ModAccessorySlots {
public static final DeferredRegister<AccessorySlotType> REGISTRY = ChangedRegistry.ACCESSORY_SLOTS.createDeferred("modid");
public static final RegistryObject<AccessorySlotType> FEET = REGISTRY.register("feet", () -> new AccessorySlotType(EquipmentSlot.FEET));
}When being rendered in the accessories screen, your new accessory slot will show with a missing texture. It is looking for a texture at <modid>:item/empty_<slotid>_slot but could not find it. You need to create a texture at assets/<modid>/textures/item/empty_<slotid>_slot.png. Note: the Vanilla textures in Minecraft and the Changed: Minecraft Mod use a color of #555555 to draw the shape for the empty slot.
The Changed: Minecraft Mod will look in the accessories/entities folder in ALL namespaces to find entity-to-slot-type assignments. These are JSON files with the following structure:
{
"entities": [
"modid:entity_id_1",
"modid:entity_id_2"
]
"slots": [
"modid:slot_id_1",
"modid:slot_id_2"
]
}All of the identified entities in the entities list will have access to the slots in the slots list. It is recommended to organize these files around the overall shape of the entities being defined.
To assign Changed: Minecraft Mod's slots to your modded entities, you should create a mapping file in YOUR OWN mod's namespace. For example:
in data/modid/accessories/entities/humanoids.json`
{
"entities": [
"modid:entity_id"
]
"slots": [
"changed:body",
"changed:hands",
"changed:head",
"changed:face",
"changed:full_body",
"changed:legs",
"changed:neck"
]
}It is imperative that you do not override the definitions for Changed: Minecraft Mod found at data/changed/accessories/entities/*.json for your own mod, as players transfurred as these variants will lose access to their slots.