|
| | __construct (Level $level, CompoundTag $nbt) |
| |
| | close () |
| |
| | saveNBT () |
| |
| | getSize () |
| |
| | getItem ($index) |
| |
| | setItem ($index, Item $item) |
| |
| | getInventory () |
| |
| | getRealInventory () |
| |
| | getDoubleInventory () |
| |
| | getName () |
| |
| | hasName () |
| |
| | setName ($str) |
| |
| | isPaired () |
| |
| | getPair () |
| |
| | pairWith (Chest $tile) |
| |
| | unpair () |
| |
| | getSpawnCompound () |
| |
| | spawnTo (Player $player) |
| |
| | __construct (Level $level, CompoundTag $nbt) |
| |
| | spawnToAll () |
| |
| | getSpawnCompound () |
| |
| | updateCompoundTag (CompoundTag $nbt, Player $player) |
| |
| | getSaveId () |
| |
| | __construct (Level $level, CompoundTag $nbt) |
| |
| | getId () |
| |
| | saveNBT () |
| |
| | getBlock () |
| |
| | onUpdate () |
| |
| | scheduleUpdate () |
| |
| | __destruct () |
| |
| | close () |
| |
| | getName () |
| |
| | __construct ($x=0, $y=0, $z=0, Level $level=null) |
| |
| | asPosition () |
| |
| | add ($x, $y=0, $z=0) |
| |
| | getLevel () |
| |
| | setLevel (Level $level=null) |
| |
| | isValid () |
| |
| | getSide ($side, $step=1) |
| |
| | __toString () |
| |
| | setComponents ($x, $y, $z) |
| |
| | fromObjectAdd (Vector3 $pos, $x, $y, $z) |
| |
| | __construct ($x=0, $y=0, $z=0) |
| |
| | getX () |
| |
| | getY () |
| |
| | getZ () |
| |
| | getFloorX () |
| |
| | getFloorY () |
| |
| | getFloorZ () |
| |
| | getRight () |
| |
| | getUp () |
| |
| | getForward () |
| |
| | getSouth () |
| |
| | getWest () |
| |
| | add ($x, $y=0, $z=0) |
| |
| | subtract ($x=0, $y=0, $z=0) |
| |
| | multiply ($number) |
| |
| | divide ($number) |
| |
| | ceil () |
| |
| | floor () |
| |
| | round () |
| |
| | abs () |
| |
| | getSide ($side, $step=1) |
| |
| | asVector3 () |
| |
| | distance (Vector3 $pos) |
| |
| | distanceSquared (Vector3 $pos) |
| |
| | maxPlainDistance ($x=0, $z=0) |
| |
| | length () |
| |
| | lengthSquared () |
| |
| | normalize () |
| |
| | dot (Vector3 $v) |
| |
| | cross (Vector3 $v) |
| |
| | equals (Vector3 $v) |
| |
| | getIntermediateWithXValue (Vector3 $v, $x) |
| |
| | getIntermediateWithYValue (Vector3 $v, $y) |
| |
| | getIntermediateWithZValue (Vector3 $v, $z) |
| |
| | setComponents ($x, $y, $z) |
| |
| | fromObjectAdd (Vector3 $pos, $x, $y, $z) |
| |
| | __toString () |
| |
◆ __construct()
Chest constructor.
- Parameters
-
| Level | $level | |
| CompoundTag | $nbt | |
50 parent::__construct(
$level, $nbt);
51 $this->inventory =
new ChestInventory($this);
52 if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof
ListTag)){
53 $this->namedtag->Items =
new ListTag(
"Items", []);
56 for($i = 0; $i < $this->
getSize(); ++$i){
57 $this->inventory->setItem($i, $this->
getItem($i));
◆ checkPairing()
174 if($this->
isPaired() and !$this->
getLevel()->isChunkLoaded($this->namedtag->pairx->getValue() >> 4, $this->namedtag->pairz->getValue() >> 4)){
176 $this->doubleInventory = null;
178 }elseif(($pair = $this->
getPair()) instanceof Chest){
179 if(!$pair->isPaired()){
180 $pair->createPair($this);
181 $pair->checkPairing();
183 if($this->doubleInventory === null){
184 if(($p = $pair->getDoubleInventory()) instanceof DoubleChestInventory){
185 $this->doubleInventory = $p;
187 if(($pair->x + ($pair->z << 15)) > ($this->x + ($this->z << 15))){
188 $this->doubleInventory =
new DoubleChestInventory($pair, $this);
190 $this->doubleInventory =
new DoubleChestInventory($this, $pair);
195 $this->doubleInventory = null;
196 unset($this->namedtag->pairx, $this->namedtag->pairz);
◆ close()
62 if($this->closed ===
false){
◆ getDoubleInventory()
- Returns
- DoubleChestInventory|null
◆ getInventory()
- Returns
- ChestInventory|DoubleChestInventory
Implements InventoryHolder.
153 if($this->
isPaired() and $this->doubleInventory === null){
156 return $this->doubleInventory instanceof DoubleChestInventory ? $this->doubleInventory :
$this->inventory;
◆ getItem()
This method should not be used by plugins, use the Inventory
- Parameters
-
- Returns
- Item
Implements Container.
◆ getName()
- Returns
- string
Implements Nameable.
204 return isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() :
"Chest";
◆ getPair()
- Returns
- Chest
242 $tile = $this->
getLevel()->getTile(
new Vector3((
int) $this->namedtag[
"pairx"], $this->y, (
int) $this->namedtag[
"pairz"]));
243 if($tile instanceof Chest){
◆ getRealInventory()
◆ getSize()
◆ getSlotIndex()
- Parameters
-
- Returns
- int
95 foreach($this->namedtag->Items as $i => $slot){
96 if((
int) $slot[
"Slot"] === (
int) $index){
◆ getSpawnCompound()
- Returns
- CompoundTag
311 new IntTag(
"x", (
int) $this->x),
312 new IntTag(
"y", (
int) $this->y),
313 new IntTag(
"z", (
int) $this->z),
314 new IntTag(
"pairx", (
int) $this->namedtag[
"pairx"]),
315 new IntTag(
"pairz", (
int) $this->namedtag[
"pairz"])
320 new IntTag(
"x", (
int) $this->x),
321 new IntTag(
"y", (
int) $this->y),
322 new IntTag(
"z", (
int) $this->z)
327 $c->CustomName = $this->namedtag->CustomName;
◆ hasName()
- Returns
- bool
Implements Nameable.
211 return isset($this->namedtag->CustomName);
◆ isPaired()
- Returns
- bool
230 if(!isset($this->namedtag->pairx) or !isset($this->namedtag->pairz)){
◆ pairWith()
- Parameters
-
- Returns
- bool
257 if($this->
isPaired() or $tile->isPaired()){
261 $this->createPair($tile);
◆ saveNBT()
75 $this->namedtag->Items =
new ListTag(
"Items", []);
77 for($index = 0; $index < $this->
getSize(); ++$index){
78 $this->
setItem($index, $this->inventory->getItem($index));
◆ setItem()
| setItem |
( |
|
$index, |
|
|
Item |
$item |
|
) |
| |
This method should not be used by plugins, use the Inventory
- Parameters
-
- Returns
- bool
Implements Container.
131 if($item->getId() ===
Item::AIR or $item->getCount() <= 0){
133 unset($this->namedtag->Items[$i]);
136 for($i = 0; $i <= $this->
getSize(); ++$i){
137 if(!isset($this->namedtag->Items[$i])){
141 $this->namedtag->Items[$i] = $item->nbtSerialize($index);
143 $this->namedtag->Items[$i] = $item->nbtSerialize($index);
◆ setName()
- Parameters
-
Implements Nameable.
219 unset($this->namedtag->CustomName);
223 $this->namedtag->CustomName =
new StringTag(
"CustomName", $str);
◆ unpair()
- Returns
- bool
290 unset($this->namedtag->pairx, $this->namedtag->pairz);
294 if($tile instanceof Chest){
295 unset($tile->namedtag->pairx, $tile->namedtag->pairz);
296 $tile->checkPairing();
◆ $doubleInventory
◆ $inventory
The documentation for this class was generated from the following file:
- src/pocketmine/tile/Chest.php