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

Public Member Functions

 __construct (Level $level, CompoundTag $nbt)
 
 canAddItem (Item $item)
 
 getItem ()
 
 setItem (Item $item)
 
 removeItem ()
 
 isEmpty ()
 
 getSpawnCompound ()
 
- Public Member Functions inherited from Spawnable
 spawnTo (Player $player)
 
 __construct (Level $level, CompoundTag $nbt)
 
 spawnToAll ()
 
 getSpawnCompound ()
 
 updateCompoundTag (CompoundTag $nbt, Player $player)
 
- Public Member Functions inherited from Tile
 getSaveId ()
 
 __construct (Level $level, CompoundTag $nbt)
 
 getId ()
 
 saveNBT ()
 
 getBlock ()
 
 onUpdate ()
 
 scheduleUpdate ()
 
 __destruct ()
 
 close ()
 
 getName ()
 
- Public Member Functions inherited from Position
 __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)
 
- Public Member Functions inherited from Vector3
 __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 ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Tile
static init ()
 
static createTile ($type, Level $level, CompoundTag $nbt,... $args)
 
static registerTile ($className)
 
- Static Public Member Functions inherited from Position
static fromObject (Vector3 $pos, Level $level=null)
 
- Static Public Member Functions inherited from Vector3
static getOppositeSide ($side)
 
static createRandomDirection (Random $random)
 
- Data Fields inherited from Tile
const BREWING_STAND = "BrewingStand"
 
const CHEST = "Chest"
 
const DL_DETECTOR = "DayLightDetector"
 
const ENCHANT_TABLE = "EnchantTable"
 
const FLOWER_POT = "FlowerPot"
 
const FURNACE = "Furnace"
 
const MOB_SPAWNER = "MobSpawner"
 
const SIGN = "Sign"
 
const SKULL = "Skull"
 
const ITEM_FRAME = "ItemFrame"
 
const DISPENSER = "Dispenser"
 
const DROPPER = "Dropper"
 
const CAULDRON = "Cauldron"
 
const HOPPER = "Hopper"
 
const BEACON = "Beacon"
 
const ENDER_CHEST = "EnderChest"
 
const BED = "Bed"
 
const DAY_LIGHT_DETECTOR = "DLDetector"
 
 $chunk
 
 $name
 
 $id
 
 $x
 
 $y
 
 $z
 
 $attach
 
 $metadata
 
 $closed = false
 
 $namedtag
 
 $tickTimer
 
- Data Fields inherited from Position
 $level = null
 
- Data Fields inherited from Vector3
const SIDE_DOWN = 0
 
const SIDE_UP = 1
 
const SIDE_NORTH = 2
 
const SIDE_SOUTH = 3
 
const SIDE_WEST = 4
 
const SIDE_EAST = 5
 
 $x
 
 $y
 
 $z
 
- Static Public Attributes inherited from Tile
static $tileCount = 1
 
- Protected Member Functions inherited from Spawnable
 onChanged ()
 
- Protected Attributes inherited from Tile
 $lastUpdate
 
 $server
 
 $timings
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( Level  $level,
CompoundTag  $nbt 
)

FlowerPot constructor.

Parameters
Level$level
CompoundTag$nbt
39  {
40  if(!isset($nbt->item)){
41  $nbt->item = new ShortTag("item", 0);
42  }
43  if(!isset($nbt->mData)){
44  $nbt->mData = new IntTag("mData", 0);
45  }
46  parent::__construct($level, $nbt);
47  }

Member Function Documentation

◆ canAddItem()

canAddItem ( Item  $item)
Parameters
Item$item
Returns
bool

PhpMissingBreakStatementInspection

54  : bool{
55  if(!$this->isEmpty()){
56  return false;
57  }
58  switch($item->getId()){
60  case Item::TALL_GRASS:
61  if($item->getDamage() === 1){
62  return false;
63  }
64  case Item::SAPLING:
65  case Item::DEAD_BUSH:
66  case Item::DANDELION:
67  case Item::RED_FLOWER:
69  case Item::RED_MUSHROOM:
70  case Item::CACTUS:
71  return true;
72  default:
73  return false;
74  }
75  }

◆ getItem()

getItem ( )
Returns
Item
80  : Item{
81  return Item::get((int) ($this->namedtag["item"] ?? 0), (int) ($this->namedtag["mData"] ?? 0), 1);
82  }

◆ getSpawnCompound()

getSpawnCompound ( )
Returns
CompoundTag
107  : CompoundTag{
108  return new CompoundTag("", [
109  new StringTag("id", Tile::FLOWER_POT),
110  new IntTag("x", (int) $this->x),
111  new IntTag("y", (int) $this->y),
112  new IntTag("z", (int) $this->z),
113  $this->namedtag->item,
114  $this->namedtag->mData
115  ]);
116  }

◆ isEmpty()

isEmpty ( )
Returns
bool
100  : bool{
101  return $this->getItem()->getId() === Item::AIR;
102  }

◆ removeItem()

removeItem ( )
93  {
94  $this->setItem(Item::get(Item::AIR));
95  }

◆ setItem()

setItem ( Item  $item)
Parameters
Item$item
87  {
88  $this->namedtag["item"] = $item->getId();
89  $this->namedtag["mData"] = $item->getDamage();
90  $this->onChanged();
91  }

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