Added custom block data (example, chests), better deep checking of same NBT

This commit is contained in:
Shoghi Cervantes
2015-08-07 17:24:35 +02:00
parent e9c981b586
commit 696edfd31f
10 changed files with 179 additions and 17 deletions

View File

@ -1727,7 +1727,8 @@ class Level implements ChunkManager, Metadatable{
}
if($hand->getId() === Item::SIGN_POST or $hand->getId() === Item::WALL_SIGN){
$tile = Tile::createTile("Sign", $this->getChunk($block->x >> 4, $block->z >> 4), new Compound("", [
$nbt = new Compound("", [
"id" => new String("id", Tile::SIGN),
"x" => new Int("x", $block->x),
"y" => new Int("y", $block->y),
@ -1736,10 +1737,19 @@ class Level implements ChunkManager, Metadatable{
"Text2" => new String("Text2", ""),
"Text3" => new String("Text3", ""),
"Text4" => new String("Text4", "")
]));
]);
if($player !== null){
$tile->namedtag->Creator = new String("Creator", $player->getRawUniqueId());
$nbt->Creator = new String("Creator", $player->getRawUniqueId());
}
if($item->hasCustomBlockData()){
foreach($item->getCustomBlockData() as $key => $v){
$nbt->{$key} = $v;
}
}
Tile::createTile("Sign", $this->getChunk($block->x >> 4, $block->z >> 4), $nbt);
}
$item->setCount($item->getCount() - 1);
if($item->getCount() <= 0){