mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Some cleanup to how tiles are created
This commit is contained in:
@ -27,10 +27,8 @@ use pocketmine\item\Item;
|
||||
use pocketmine\item\Tool;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\tile\Sign as TileSign;
|
||||
use pocketmine\tile\Tile;
|
||||
|
||||
class SignPost extends Transparent{
|
||||
@ -62,26 +60,6 @@ class SignPost extends Transparent{
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
|
||||
if($face !== Vector3::SIDE_DOWN){
|
||||
$nbt = new CompoundTag("", [
|
||||
new StringTag("id", Tile::SIGN),
|
||||
new IntTag("x", $blockReplace->x),
|
||||
new IntTag("y", $blockReplace->y),
|
||||
new IntTag("z", $blockReplace->z),
|
||||
new StringTag("Text1", ""),
|
||||
new StringTag("Text2", ""),
|
||||
new StringTag("Text3", ""),
|
||||
new StringTag("Text4", "")
|
||||
]);
|
||||
|
||||
if($player !== null){
|
||||
$nbt->Creator = new StringTag("Creator", $player->getRawUniqueId());
|
||||
}
|
||||
|
||||
if($item->hasCustomBlockData()){
|
||||
foreach($item->getCustomBlockData() as $key => $v){
|
||||
$nbt->{$key} = $v;
|
||||
}
|
||||
}
|
||||
|
||||
if($face === Vector3::SIDE_UP){
|
||||
$this->meta = floor((($player->yaw + 180) * 16 / 360) + 0.5) & 0x0f;
|
||||
@ -91,7 +69,7 @@ class SignPost extends Transparent{
|
||||
$this->getLevel()->setBlock($blockReplace, new WallSign($this->meta), true);
|
||||
}
|
||||
|
||||
Tile::createTile(Tile::SIGN, $this->getLevel(), $nbt);
|
||||
Tile::createTile(Tile::SIGN, $this->getLevel(), TileSign::createNBT($this, $face, $item, $player));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user