Added constant slot IDs for Furnace, Enchanting, Anvil and Brewing Stand inventories

This commit is contained in:
Dylan K. Taylor 2021-09-03 12:16:07 +01:00
parent 2fe03757d5
commit 963f4a9cf3
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 19 additions and 6 deletions

View File

@ -29,6 +29,12 @@ use pocketmine\world\Position;
class BrewingStandInventory extends SimpleInventory implements BlockInventory{
use BlockInventoryTrait;
public const SLOT_INGREDIENT = 0;
public const SLOT_BOTTLE_LEFT = 1;
public const SLOT_BOTTLE_MIDDLE = 2;
public const SLOT_BOTTLE_RIGHT = 3;
public const SLOT_FUEL = 4;
public function __construct(Position $holder, int $size = 5){
$this->holder = $holder;
parent::__construct($size);

View File

@ -30,6 +30,9 @@ use pocketmine\world\Position;
class EnchantInventory extends SimpleInventory implements BlockInventory{
use BlockInventoryTrait;
public const SLOT_INPUT = 0;
public const SLOT_LAPIS = 1;
public function __construct(Position $holder){
$this->holder = $holder;
parent::__construct(2);

View File

@ -31,6 +31,10 @@ use pocketmine\world\Position;
class FurnaceInventory extends SimpleInventory implements BlockInventory{
use BlockInventoryTrait;
public const SLOT_INPUT = 0;
public const SLOT_FUEL = 1;
public const SLOT_RESULT = 2;
private FurnaceType $furnaceType;
public function __construct(Position $holder, FurnaceType $furnaceType){
@ -42,26 +46,26 @@ class FurnaceInventory extends SimpleInventory implements BlockInventory{
public function getFurnaceType() : FurnaceType{ return $this->furnaceType; }
public function getResult() : Item{
return $this->getItem(2);
return $this->getItem(self::SLOT_RESULT);
}
public function getFuel() : Item{
return $this->getItem(1);
return $this->getItem(self::SLOT_FUEL);
}
public function getSmelting() : Item{
return $this->getItem(0);
return $this->getItem(self::SLOT_INPUT);
}
public function setResult(Item $item) : void{
$this->setItem(2, $item);
$this->setItem(self::SLOT_RESULT, $item);
}
public function setFuel(Item $item) : void{
$this->setItem(1, $item);
$this->setItem(self::SLOT_FUEL, $item);
}
public function setSmelting(Item $item) : void{
$this->setItem(0, $item);
$this->setItem(self::SLOT_INPUT, $item);
}
}