Phpcraft
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Phpcraft\Packet\SetSlotPacket Class Reference
Inheritance diagram for Phpcraft\Packet\SetSlotPacket:
Inheritance graph
[legend]
Collaboration diagram for Phpcraft\Packet\SetSlotPacket:
Collaboration graph
[legend]

Public Member Functions

 __construct (int $window=0, int $slotId=0, ?Slot $slot=null)
 
 send (Connection $con)
 
 __toString ()
 

Static Public Member Functions

static read (Connection $con)
 

Public Attributes

 $window
 
 $slotId
 
 $slot
 

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\Packet\SetSlotPacket::__construct ( int  $window = 0,
int  $slotId = 0,
?Slot  $slot = null 
)
Parameters
int$windowThe ID of the window being updated. 0 for inventory.
int$slotIdThe ID of the slot being updated. See https://wiki.vg/Inventory and Slot constants.
Slot | null$slotThe new value of the slot.

Member Function Documentation

◆ __toString()

Phpcraft\Packet\SetSlotPacket::__toString ( )

Reimplemented from Phpcraft\Packet\Packet.

◆ read()

static Phpcraft\Packet\SetSlotPacket::read ( Connection  $con)
static

Initialises the packet class by reading its payload from the given Connection.

Parameters
Connection$con
Returns
SetSlotPacket
Exceptions
IOException

Reimplemented from Phpcraft\Packet\Packet.

◆ send()

Phpcraft\Packet\SetSlotPacket::send ( Connection  $con)

Adds the packet's ID and payload to the Connection's write buffer and sends it over the wire if the connection has a stream. Note that in some cases this will produce multiple Minecraft packets, therefore you should only use this on connections without a stream if you know what you're doing.

Parameters
Connection$con
Returns
void
Exceptions
IOException
MissingMetadataException

Reimplemented from Phpcraft\Packet\Packet.

Member Data Documentation

◆ $slot

Slot null Phpcraft\Packet\SetSlotPacket::$slot

The new value of the slot.

◆ $slotId

int Phpcraft\Packet\SetSlotPacket::$slotId

The ID of the slot being updated.

See also
Slot
https://wiki.vg/Inventory

◆ $window

int Phpcraft\Packet\SetSlotPacket::$window

The ID of the window being updated. 0 for inventory.