Skip to content

HorseInventory 5.46.0 ​

final class · pocketmine\inventory\HorseInventory · source

Extends SimpleInventory

The inventory of a horse, donkey, mule, llama, nautilus... (Bedrock "horse" container, window type HORSE). Its slots are the slots of the client's horse screen, the same way BDS and GeyserMC lay them out:

  • slot 0: the saddle, or the carpet of a llama ("horse_equip_items" index 0, HORSE_EQUIP);
  • slot 1: the horse armor of a horse, the nautilus armor of a nautilus (HORSE_EQUIP index 1);
  • slots 1 and up: the chest of a donkey, mule or llama (LEVEL_ENTITY, "container_items"). The size follows the animal (see AbstractHorse::getInventorySize()); what each slot accepts is checked by MountInventoryHolder::canHoldInSlot().

Constants ​

FIRST_CHEST_SLOT ​

php
public const FIRST_CHEST_SLOT = 1

First slot of the chest of a chested animal.

SLOT_ARMOR ​

php
public const SLOT_ARMOR = 1

Body armor slot of the mounts that wear armor (they never have a chest).

SLOT_EQUIP ​

php
public const SLOT_EQUIP = 0

Saddle slot, or the carpet slot of a llama.

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\riding\MountInventoryHolder $horse, int $size)

getHorse() ​

php
public function getHorse() : \pocketmine\entity\riding\MountInventoryHolder

Returns the mount this inventory belongs to (an AbstractHorse, a nautilus...).

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.