32 public const TAG_NAME =
"Name";
33 public const TAG_DAMAGE =
"Damage";
34 public const TAG_BLOCK =
"Block";
35 public const TAG_TAG =
"tag";
37 public function __construct(
39 private int $meta = 0,
44 public function getName() :
string{
return $this->name; }
46 public function getMeta() :
int{
return $this->meta; }
48 public function getBlock() : ?
BlockStateData{
return $this->block; }
50 public function getTag() : ?
CompoundTag{
return $this->tag; }
53 $result = CompoundTag::create();
54 $result->setString(self::TAG_NAME, $this->name);
55 $result->setShort(self::TAG_DAMAGE, $this->meta);
57 if($this->block !==
null){
58 $result->setTag(self::TAG_BLOCK, $this->block->toNbt());
60 if($this->tag !==
null){
61 $result->setTag(self::TAG_TAG, $this->tag);