mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Renamed NBT tags to have Tag in the name
This commit is contained in:
@ -29,11 +29,11 @@ use pocketmine\level\format\FullChunk;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\NBT;
|
||||
|
||||
use pocketmine\nbt\tag\Compound;
|
||||
use pocketmine\nbt\tag\Enum;
|
||||
use pocketmine\nbt\tag\Int;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
|
||||
use pocketmine\nbt\tag\String;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
|
||||
class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
|
||||
@ -42,12 +42,12 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
/** @var DoubleChestInventory */
|
||||
protected $doubleInventory = null;
|
||||
|
||||
public function __construct(FullChunk $chunk, Compound $nbt){
|
||||
public function __construct(FullChunk $chunk, CompoundTag $nbt){
|
||||
parent::__construct($chunk, $nbt);
|
||||
$this->inventory = new ChestInventory($this);
|
||||
|
||||
if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof Enum)){
|
||||
$this->namedtag->Items = new Enum("Items", []);
|
||||
if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){
|
||||
$this->namedtag->Items = new ListTag("Items", []);
|
||||
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
}
|
||||
|
||||
public function saveNBT(){
|
||||
$this->namedtag->Items = new Enum("Items", []);
|
||||
$this->namedtag->Items = new ListTag("Items", []);
|
||||
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||
for($index = 0; $index < $this->getSize(); ++$index){
|
||||
$this->setItem($index, $this->inventory->getItem($index));
|
||||
@ -196,7 +196,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->namedtag->CustomName = new String("CustomName", $str);
|
||||
$this->namedtag->CustomName = new StringTag("CustomName", $str);
|
||||
}
|
||||
|
||||
public function isPaired(){
|
||||
@ -236,11 +236,11 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
}
|
||||
|
||||
private function createPair(Chest $tile){
|
||||
$this->namedtag->pairx = new Int("pairx", $tile->x);
|
||||
$this->namedtag->pairz = new Int("pairz", $tile->z);
|
||||
$this->namedtag->pairx = new IntTag("pairx", $tile->x);
|
||||
$this->namedtag->pairz = new IntTag("pairz", $tile->z);
|
||||
|
||||
$tile->namedtag->pairx = new Int("pairx", $this->x);
|
||||
$tile->namedtag->pairz = new Int("pairz", $this->z);
|
||||
$tile->namedtag->pairx = new IntTag("pairx", $this->x);
|
||||
$tile->namedtag->pairz = new IntTag("pairz", $this->z);
|
||||
}
|
||||
|
||||
public function unpair(){
|
||||
@ -265,20 +265,20 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
|
||||
public function getSpawnCompound(){
|
||||
if($this->isPaired()){
|
||||
$c = new Compound("", [
|
||||
new String("id", Tile::CHEST),
|
||||
new Int("x", (int) $this->x),
|
||||
new Int("y", (int) $this->y),
|
||||
new Int("z", (int) $this->z),
|
||||
new Int("pairx", (int) $this->namedtag["pairx"]),
|
||||
new Int("pairz", (int) $this->namedtag["pairz"])
|
||||
$c = new CompoundTag("", [
|
||||
new StringTag("id", Tile::CHEST),
|
||||
new IntTag("x", (int) $this->x),
|
||||
new IntTag("y", (int) $this->y),
|
||||
new IntTag("z", (int) $this->z),
|
||||
new IntTag("pairx", (int) $this->namedtag["pairx"]),
|
||||
new IntTag("pairz", (int) $this->namedtag["pairz"])
|
||||
]);
|
||||
}else{
|
||||
$c = new Compound("", [
|
||||
new String("id", Tile::CHEST),
|
||||
new Int("x", (int) $this->x),
|
||||
new Int("y", (int) $this->y),
|
||||
new Int("z", (int) $this->z)
|
||||
$c = new CompoundTag("", [
|
||||
new StringTag("id", Tile::CHEST),
|
||||
new IntTag("x", (int) $this->x),
|
||||
new IntTag("y", (int) $this->y),
|
||||
new IntTag("z", (int) $this->z)
|
||||
]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user