GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
Inventory Interface Reference

Public Member Functions

 getSize ()
 
 getMaxStackSize ()
 
 setMaxStackSize ($size)
 
 getName ()
 
 getTitle ()
 
 getItem ($index)
 
 setItem ($index, Item $item)
 
 addItem (... $slots)
 
 canAddItem (Item $item)
 
 removeItem (... $slots)
 
 getContents ()
 
 setContents (array $items)
 
 sendContents ($target)
 
 sendSlot ($index, $target)
 
 contains (Item $item)
 
 all (Item $item)
 
 first (Item $item)
 
 firstEmpty ()
 
 remove (Item $item)
 
 clear ($index)
 
 clearAll ()
 
 getViewers ()
 
 getType ()
 
 getHolder ()
 
 onOpen (Player $who)
 
 open (Player $who)
 
 close (Player $who)
 
 onClose (Player $who)
 
 onSlotChange ($index, $before, $send)
 

Data Fields

const MAX_STACK = 64
 

Member Function Documentation

◆ addItem()

addItem (   $slots)

Stores the given Items in the inventory. This will try to fill existing stacks and empty slots as well as it can.

Returns the Items that did not fit.

Parameters
array$slots
Returns
Item[]

◆ all()

all ( Item  $item)

Will return all the Items that has the same id and metadata (if not null). Won't check amount

Parameters
Item$item
Returns
Item[]

Implemented in BaseInventory.

◆ canAddItem()

canAddItem ( Item  $item)

Checks if a given Item can be added to the inventory

Parameters
Item$item
Returns
bool

Implemented in BaseInventory.

◆ clear()

clear (   $index)

Will clear a specific slot

Parameters
int$index
Returns
bool

◆ clearAll()

clearAll ( )

Clears all the slots

◆ close()

close ( Player  $who)
Parameters
Player$who
Returns
mixed

Implemented in BaseInventory.

◆ contains()

contains ( Item  $item)

Checks if the inventory contains any Item with the same material data. It will check id, amount, and metadata (if not null)

Parameters
Item$item
Returns
bool

Implemented in BaseInventory.

◆ first()

first ( Item  $item)

Will return the first slot has the same id and metadata (if not null) as the Item. -1 if not found, will check amount

Parameters
Item$item
Returns
int

Implemented in BaseInventory.

◆ firstEmpty()

firstEmpty ( )

Returns the first empty slot, or -1 if not found

Returns
int

Implemented in BaseInventory.

◆ getContents()

getContents ( )
Returns
Item[]

Implemented in BaseInventory.

◆ getHolder()

◆ getItem()

getItem (   $index)
Parameters
int$index
Returns
Item

Implemented in BaseInventory, and DoubleChestInventory.

◆ getMaxStackSize()

getMaxStackSize ( )

Implemented in BaseInventory.

◆ getName()

getName ( )

Implemented in BaseInventory.

◆ getSize()

getSize ( )

◆ getTitle()

getTitle ( )

Implemented in BaseInventory.

◆ getType()

getType ( )
Returns
InventoryType

Implemented in BaseInventory.

◆ getViewers()

getViewers ( )

Gets all the Players viewing the inventory Players will view their inventory at all times, even when not open.

Returns
Player[]

Implemented in BaseInventory.

◆ onClose()

◆ onOpen()

◆ onSlotChange()

onSlotChange (   $index,
  $before,
  $send 
)
Parameters
int$index
Item$before
bool$send

Implemented in BaseInventory, PlayerInventory, AnvilInventory, FurnaceInventory, and BrewingInventory.

◆ open()

open ( Player  $who)

Tries to open the inventory to a player

Parameters
Player$who
Returns
bool

Implemented in BaseInventory.

◆ remove()

remove ( Item  $item)

Will remove all the Items that has the same id and metadata (if not null)

Parameters
Item$item

◆ removeItem()

removeItem (   $slots)

Removes the given Item from the inventory. It will return the Items that couldn't be removed.

Parameters
array$slots
Returns
Item[]

◆ sendContents()

sendContents (   $target)
Parameters
Player|Player[]$target

Implemented in PlayerInventory, and BaseInventory.

◆ sendSlot()

sendSlot (   $index,
  $target 
)
Parameters
int$index
Player|Player[]$target

Implemented in BaseInventory.

◆ setContents()

setContents ( array  $items)
Parameters
Item[]$items

◆ setItem()

setItem (   $index,
Item  $item 
)

Puts an Item in a slot. If a plugin refuses the update or $index is invalid, it'll return false If a source Player is specified, it won't send a Inventory update to it

Parameters
int$index
Item$item
Returns
bool

◆ setMaxStackSize()

setMaxStackSize (   $size)
Parameters
int$size

Implemented in BaseInventory.

Field Documentation

◆ MAX_STACK

const MAX_STACK = 64

The documentation for this interface was generated from the following file: