Phpcraft
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Phpcraft\Slot Class Reference

Public Member Functions

 __construct (?Item $item=null, int $count=1, ?NBT $nbt=null)
 
 getDisplayName ()
 
 setSNBT (string $snbt)
 
 setDisplayName (?ChatComponent $name)
 
 __toString ()
 
 hasNBT ()
 

Static Public Member Functions

static toString (?Slot $slot)
 
static isEmpty (?Slot $slot)
 

Public Attributes

const HEAD = 5
 
const CHEST = 6
 
const LEGS = 7
 
const FEET = 8
 
const HOTBAR_1 = 36
 
const HOTBAR_2 = 37
 
const HOTBAR_3 = 38
 
const HOTBAR_4 = 39
 
const HOTBAR_5 = 40
 
const HOTBAR_6 = 41
 
const HOTBAR_7 = 42
 
const HOTBAR_8 = 43
 
const HOTBAR_9 = 44
 
const OFF_HAND = 45
 
 $item
 
 $count
 
 $nbt
 

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\Slot::__construct ( ?Item  $item = null,
int  $count = 1,
?NBT  $nbt = null 
)

The construct.

Parameters
Item | null$itemThe item in this slot.
int$countHow many times the item is in this slot.
NBT | null$nbtThe NBT data of the item in this slot.

Member Function Documentation

◆ __toString()

Phpcraft\Slot::__toString ( )

◆ getDisplayName()

Phpcraft\Slot::getDisplayName ( )

Returns the display name of the item in this slot or null if not set.

Returns
ChatComponent|null

◆ hasNBT()

Phpcraft\Slot::hasNBT ( )
Returns
boolean

◆ isEmpty()

static Phpcraft\Slot::isEmpty ( ?Slot  $slot)
static
Parameters
Slot | null$slot
Returns
boolean

◆ setDisplayName()

Phpcraft\Slot::setDisplayName ( ?ChatComponent  $name)

Sets the display name of this slot.

Parameters
ChatComponent | null$nameThe new display name or null to unset it.
Returns
Slot $this

◆ setSNBT()

Phpcraft\Slot::setSNBT ( string  $snbt)

Sets the NBT of the Slot based on the given SNBT string.

Parameters
string$snbt
Returns
Slot $this

◆ toString()

static Phpcraft\Slot::toString ( ?Slot  $slot)
static

Member Data Documentation

◆ $count

int Phpcraft\Slot::$count

How many times the item is in this slot.

◆ $item

Item Phpcraft\Slot::$item

The item in this slot.

◆ $nbt

NBT Phpcraft\Slot::$nbt

The NBT data of the item in this slot.

◆ CHEST

const Phpcraft\Slot::CHEST = 6

◆ FEET

const Phpcraft\Slot::FEET = 8

◆ HEAD

const Phpcraft\Slot::HEAD = 5

◆ HOTBAR_1

const Phpcraft\Slot::HOTBAR_1 = 36

◆ HOTBAR_2

const Phpcraft\Slot::HOTBAR_2 = 37

◆ HOTBAR_3

const Phpcraft\Slot::HOTBAR_3 = 38

◆ HOTBAR_4

const Phpcraft\Slot::HOTBAR_4 = 39

◆ HOTBAR_5

const Phpcraft\Slot::HOTBAR_5 = 40

◆ HOTBAR_6

const Phpcraft\Slot::HOTBAR_6 = 41

◆ HOTBAR_7

const Phpcraft\Slot::HOTBAR_7 = 42

◆ HOTBAR_8

const Phpcraft\Slot::HOTBAR_8 = 43

◆ HOTBAR_9

const Phpcraft\Slot::HOTBAR_9 = 44

◆ LEGS

const Phpcraft\Slot::LEGS = 7

◆ OFF_HAND

const Phpcraft\Slot::OFF_HAND = 45