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

Public Member Functions

 __construct (Level $level, CompoundTag $nbt)
 
 hasItem ()
 
 getItem ()
 
 setItem (Item $item=null)
 
 getItemRotation ()
 
 setItemRotation (int $rotation)
 
 getItemDropChance ()
 
 setItemDropChance (float $chance)
 
 SetMapID (string $mapid)
 
 getMapID ()
 
 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 ()
 

Data Fields

 $map_uuid = -1
 
- 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
 

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)
 
- 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 
)

ItemFrame constructor.

Parameters
Level$level
CompoundTag$nbt
42  {
43  if(!isset($nbt->ItemRotation)){
44  $nbt->ItemRotation = new ByteTag("ItemRotation", 0);
45  }
46 
47  if(!isset($nbt->ItemDropChance)){
48  $nbt->ItemDropChance = new FloatTag("ItemDropChance", 1.0);
49  }
50 
51  parent::__construct($level, $nbt);
52  }

Member Function Documentation

◆ getItem()

getItem ( )
Returns
Item
64  : Item{
65  if(isset($this->namedtag->Item)){
66  return Item::nbtDeserialize($this->namedtag->Item);
67  }else{
68  return Item::get(Item::AIR);
69  }
70  }

◆ getItemDropChance()

getItemDropChance ( )
Returns
float
102  : float{
103  return $this->namedtag->ItemDropChance->getValue();
104  }

◆ getItemRotation()

getItemRotation ( )
Returns
int
87  : int{
88  return $this->namedtag->ItemRotation->getValue();
89  }

◆ getMapID()

getMapID ( )
Returns
string
126  : string{
127  return $this->map_uuid;
128  }

◆ getSpawnCompound()

getSpawnCompound ( )
Returns
CompoundTag
133  {
134  $tag = new CompoundTag("", [
135  new StringTag("id", Tile::ITEM_FRAME),
136  new IntTag("x", (int) $this->x),
137  new IntTag("y", (int) $this->y),
138  new IntTag("z", (int) $this->z),
139  $this->namedtag->ItemDropChance,
140  $this->namedtag->ItemRotation,
141  ]);
142  if($this->hasItem()){
143  $tag->Item = $this->namedtag->Item;
144  if($this->getItem()->getId() === Item::FILLED_MAP){
145  if(isset($this->namedtag->Map_UUID)){
146  $tag->Map_UUID = $this->namedtag->Map_UUID;
147  }
148  }
149  }
150 
151  return $tag;
152  }

◆ hasItem()

hasItem ( )
Returns
bool
57  : bool{
58  return $this->getItem()->getId() !== Item::AIR;
59  }

◆ setItem()

setItem ( Item  $item = null)
Parameters
Item | null$item
75  {
76  if($item !== null and $item->getId() !== Item::AIR){
77  $this->namedtag->Item = $item->nbtSerialize(-1, "Item");
78  }else{
79  unset($this->namedtag->Item);
80  }
81  $this->onChanged();
82  }

◆ setItemDropChance()

setItemDropChance ( float  $chance)
Parameters
float$chance
109  {
110  $this->namedtag->ItemDropChance = new FloatTag("ItemDropChance", $chance);
111  $this->onChanged();
112  }

◆ setItemRotation()

setItemRotation ( int  $rotation)
Parameters
int$rotation
94  {
95  $this->namedtag->ItemRotation = new ByteTag("ItemRotation", $rotation);
96  $this->onChanged();
97  }

◆ SetMapID()

SetMapID ( string  $mapid)
Parameters
string$mapid
117  {
118  $this->map_uuid = $mapid;
119  $this->namedtag->Map_UUID = new StringTag("map_uuid", $mapid);
120  $this->onChanged();
121  }

Field Documentation

◆ $map_uuid

$map_uuid = -1

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