39    public const TAG_ITEM_ROTATION = 
"ItemRotation";
 
   40    public const TAG_ITEM_DROP_CHANCE = 
"ItemDropChance";
 
   41    public const TAG_ITEM = 
"Item";
 
   44    private int $itemRotation = 0;
 
   45    private float $itemDropChance = 1.0;
 
   48        $this->item = VanillaItems::AIR();
 
   49        parent::__construct($world, $pos);
 
   52    public function readSaveData(
CompoundTag $nbt) : 
void{
 
   54            $this->item = Item::safeNbtDeserialize($itemTag, 
"ItemFrame ($this->position) framed item");
 
   57            $this->itemRotation = (int) ($nbt->getFloat(self::TAG_ITEM_ROTATION, $this->itemRotation * 45) / 45);
 
   59            $this->itemRotation = $nbt->getByte(self::TAG_ITEM_ROTATION, $this->itemRotation);
 
   61        $this->itemDropChance = $nbt->getFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance);
 
   65        $nbt->setFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance);
 
   66        $nbt->
setFloat(self::TAG_ITEM_ROTATION, $this->itemRotation * 45);
 
   67        if(!$this->item->isNull()){
 
   68            $nbt->setTag(self::TAG_ITEM, $this->item->nbtSerialize());
 
 
   72    public function hasItem() : bool{
 
   73        return !$this->item->isNull();
 
   76    public function getItem() : 
Item{
 
   77        return clone $this->item;
 
   80    public function setItem(?Item $item) : void{
 
   81        if($item !== null && !$item->isNull()){
 
   82            $this->item = clone $item;
 
   84            $this->item = VanillaItems::AIR();
 
   88    public function getItemRotation() : int{
 
   89        return $this->itemRotation;
 
   92    public function setItemRotation(
int $rotation) : void{
 
   93        $this->itemRotation = $rotation;
 
   96    public function getItemDropChance() : float{
 
   97        return $this->itemDropChance;
 
  100    public function setItemDropChance(
float $chance) : void{
 
  101        $this->itemDropChance = $chance;
 
  105        $nbt->setFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance);
 
  106        $nbt->
setFloat(self::TAG_ITEM_ROTATION, $this->itemRotation * 45);
 
  107        if(!$this->item->isNull()){
 
  108            $nbt->setTag(self::TAG_ITEM, TypeConverter::getInstance()->getItemTranslator()->toNetworkNbt($this->item));