Skip to content

HorseInventory ​

com.jsmacrosce.jsmacros.client.api.classes.inventory.HorseInventory

Since1.8.4

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 ​

canBeSaddled(): booleanSince1.8.4#
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 ​

getArmor(): ItemStackHelperSince1.8.4#
Returns the body-armor slot (menu slot 1), whether or not the mount can use it.
Returns: the armor item.

getHorse ​

getHorse(): AbstractHorseEntityHelper<?>Since1.8.4#
Returns a helper for the mount associated with this inventory screen.
Returns: the horse this inventory belongs to.

getHorseInventory ​

getHorseInventory(): List<ItemStackHelper>Since1.8.4#
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 ​

getInventorySize(): intSince1.8.4#
Returns the number of carried slots: 15 for a chested mount, otherwise 0.
Returns: the number of carried slots

getSaddle ​

getSaddle(): ItemStackHelperSince1.8.4#
Returns the saddle slot (menu slot 0), whether or not the mount can use a saddle.
Returns: the saddle item.

hasArmorSlot ​

hasArmorSlot(): booleanSince1.8.4#
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 ​

hasChest(): booleanSince1.8.4#
Reports whether this mount has a chest.
Returns: true if the mount has equipped a chest, false otherwise.

isSaddled ​

isSaddled(): booleanSince1.8.4#
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 ​

toString(): String#
Returns a diagnostic label containing the current value returned by hasChest().
Returns: HorseInventory:{"hasChest": true} or HorseInventory:{"hasChest": false}, with the boolean in lowercase.