Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Setting down skull errors

Comments in 'Plugin Development' started by Irish, May 22, 2016.

  1. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    Whenever I try to set down a skull, it always returns this error.
    Code:
    [01:43:15] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerDeathEvent' to 'ParadoxUHC v1.1.0': Call to a member function getName() on null on ParadoxUHC\UHC
    [01:43:15] [Server thread/CRITICAL]: Error: "Call to a member function getName() on null" (EXCEPTION) in "/src/pocketmine/nbt/tag/CompoundTag" at line 37
    
    While I have already looked at CompoundTag, I still cannot figure out why.
    PHP:
    public function onDeath(Death $event){
            
    $player $event->getEntity();
            if(
    $this->config->get("pole") === "true"){
                if(
    $player instanceof Player) {
                    if (
    $this->status === self::STATUS_PVP || $this->status === self::STATUS_TP_1 || $this->status === self::STATUS_TELE_1 || $this->status === self::STATUS_TP_2 || $this->status === self::STATUS_TELE_2
                        
    || $this->status === self::STATUS_LAST) {
                        
    $x $player->x;
                        
    $y $player->y;
                        
    $z $player->z;
                        
    $level $player->getLevel();
                        
    $level->setBlock(new Vector3($x$y$z), Block::get(Block::NETHER_BRICK_FENCE));
                        
    $nbt = new CompoundTag("", [
                            new 
    StringTag("id"Tile::SKULL),
                            
    $this->namedtag->SkullType,
                            new 
    IntTag("x"$x),
                            new 
    IntTag("y"$y),
                            new 
    IntTag("z"$z),
                            
    $this->namedtag->Rot
                        
    ]);
                        
    $tile Tile::createTile("Skull"$level->getChunk($x >> 4$z >> 4), $nbt);
                        
    $level->addTile($tile);
                        
    $level->setBlock(new Vector3($x$y+1$z), Block::get(Block::SKULL_BLOCK));
                    }
                }
            }
        }
  2. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    Fixed the error, but now it is invisible.
  3. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    PHP:
        public function onDeath(Death $event){
            
    $player $event->getEntity();
            if(
    $this->config->get("pole") === "true"){
                if(
    $player instanceof Player) {
                    if (
    $this->status === self::STATUS_PVP || $this->status === self::STATUS_TP_1 || $this->status === self::STATUS_TELE_1 || $this->status === self::STATUS_TP_2 || $this->status === self::STATUS_TELE_2
                        
    || $this->status === self::STATUS_LAST) {
                        
    $x $player->x;
                        
    $y $player->y;
                        
    $z $player->z;
                        
    $item = new Item(Item::SKULL);
                        
    $rot = new ByteTag("Rot"0);
                        
    $level $player->getLevel();
                        
    $level->setBlock(new Vector3($x$y$z), Block::get(Block::NETHER_BRICK_FENCE));
                        
    $nbt = new CompoundTag("", [
                            new 
    StringTag("id"Tile::SKULL),
                            new 
    IntTag("x"$x),
                            new 
    IntTag("y"$y+1),
                            new 
    IntTag("z"$z),
                            new 
    ByteTag("SkullType"$item->getDamage()),
                            
    $rot
                        
    ]);;
                        
    $chunk $player->getLevel()->getChunk($x >> 4$z >> 4);
                        
    $skTile::createTile(Tile::SKULL$chunk$nbt);
                        
    $level->addTile($sk);
                        
    $skull = new SkullBlock(3);
                        
    $player->getLevel()->setBlock(new Vector3($x$y+1$z), $skulltruetrue);
                    }
                }
            }
        }
  4. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    I have also tried, $skull->place(/*parameters*/);
  5. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Why does positions differ from
    PHP:
    new Vector3($x$y$z)
    with this one
    PHP:
    new IntTag("x"$x),
    new 
    IntTag("y"$y+1),
    new 
    IntTag("z"$z),
    Look at this SkullBlock.php
  6. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    Already did look at that.

Share This Page

Advertisement