HorseInventory
com.jsmacrosce.jsmacros.client.api.classes.inventory.HorseInventory
Handle for an open horse, mule, donkey, llama, or camel inventory screen. Slots 0 and 1 are the saddle and body-armor slots; carried slots follow them when present. The first two slots can be read regardless of whether the mount accepts those items. Use hasChest() to check whether carried slots are available.
js
const inv = Player.openInventory();
if (inv instanceof Inventories.Horse) {
const horse = inv.getHorse();
if (inv.hasChest()) {
Chat.log(`${horse.isTame() ? "tamed" : "wild"} mount, ${inv.getInventorySize()} carried slots`);
}
}Available in scripts as Inventories.Horse.
Methods
canBeSaddled
Reports whether the saddle slot is enabled in this menu, regardless of its contents.
Returns:
true if the mount can be saddled, false otherwise.getArmor
Returns the body-armor slot (menu slot 1), whether or not the mount can use it.
Returns: the armor item.
getHorse
Returns a helper for the mount associated with this inventory screen.
Returns: the horse this inventory belongs to.
getHorseInventory
Returns carried slots in order, including empty slots. The list is empty when there are no carried slots.
Returns: a list of items in the horse's carried slots, empty when it has no chest.
getInventorySize
Returns the number of carried slots. Chested donkeys and mules have 15; a chested llama's capacity depends on its strength. Mounts without a chest have none.
Returns: the number of carried slots
getSaddle
Returns the saddle slot (menu slot 0), whether or not the mount can use a saddle.
Returns: the saddle item.
hasArmorSlot
Reports whether the body-armor slot is enabled in this menu, regardless of its contents.
Returns:
true if the slot accepts equipment, including llama carpetshasChest
Reports whether this mount has a chest.
Returns:
true if the mount has equipped a chest, false otherwise.isSaddled
Reports whether the mount is saddled, independently of the contents currently in the saddle slot.
Returns:
true if the mount is saddled, false otherwise.toString
Returns a diagnostic label containing the current value returned by hasChest().
Returns:
HorseInventory:{"hasChest": true} or HorseInventory:{"hasChest": false}, with the boolean in lowercase.