Fabric API

Fabric API

106M Downloads

Hook for MobEntity.getPreferredEquipmentSlot

Juuxel opened this issue ยท 4 comments

commented

Currently there's no way to provide a custom preferred equipment slot for non-armor items, such as blocks that can be worn as helmets.

commented

I think I did have a mixin for this in the past on hooking into that, but I didn't get it in a condition to be exposeable via api.

commented

This would be pretty easy to do with a callback design like these:

Option A: Registered with an Item instance

public interface EquipmentSlotProvider {
    EquipmentSlot getPreferredEquipmentSlot(ItemStack stack);
}

Option B: Global callback (this one seems a bit weird honestly)

public interface EquipmentSlotCallback {
    // present optional = use that value, empty optional = continue
    Optional<EquipmentSlot> getPreferredEquipmentSlot(ItemStack stack);
}
commented

Maybe a FabricItemSettings could have that provider as a setting? Of course this doesn't let you manipulate vanilla items though.

commented

However I think that would need to be in item-api because the FabricItemSettings doesn't belong in object builders for sure