34 public const SLOT_HEAD = 0;
35 public const SLOT_CHEST = 1;
36 public const SLOT_LEGS = 2;
37 public const SLOT_FEET = 3;
39 public function __construct(){
40 parent::__construct(4);
45 public function getHelmet() :
Item{
46 return $this->
getItem(self::SLOT_HEAD);
49 public function getChestplate() :
Item{
50 return $this->
getItem(self::SLOT_CHEST);
53 public function getLeggings() :
Item{
54 return $this->
getItem(self::SLOT_LEGS);
57 public function getBoots() :
Item{
58 return $this->
getItem(self::SLOT_FEET);
61 public function setHelmet(
Item $helmet) :
void{
62 $this->
setItem(self::SLOT_HEAD, $helmet);
65 public function setChestplate(
Item $chestplate) :
void{
66 $this->
setItem(self::SLOT_CHEST, $chestplate);
69 public function setLeggings(
Item $leggings) :
void{
70 $this->
setItem(self::SLOT_LEGS, $leggings);
73 public function setBoots(
Item $boots) :
void{
74 $this->
setItem(self::SLOT_FEET, $boots);
78 if($item instanceof
Armor){
79 if($item->getArmorSlot() !== $slot){
83 if(!($slot === ArmorInventory::SLOT_HEAD && $item instanceof
ItemBlock && (
84 $item->
getBlock()->getTypeId() === BlockTypeIds::CARVED_PUMPKIN ||
85 $item->
getBlock()->getTypeId() === BlockTypeIds::MOB_HEAD