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 mount can use a saddle slot. This is false for an untamed, baby, or dead mount; it does not report whether the mount currently has a saddle.
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: 15 for a chested mount, otherwise 0.
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 mount can use the body-armor slot; it does not indicate whether armor is equipped.
Returns:
true if the mount can equip armor, false otherwise.hasChest
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.