1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Add Block to Creative

Discussion in 'Development' started by WinterBuild7074, May 14, 2017.

  1. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Doesn't work, no difference.
    I changed it to Transparent, no difference. The block still disappears.

    ---


    No changes for Ender Pearl too:
    PHP:
    <?php

    namespace pocketmine\entity;

    use 
    pocketmine\event\entity\EntityDamageEvent;
    use 
    pocketmine\level\Level;
    use 
    pocketmine\nbt\tag\CompoundTag;
    use 
    pocketmine\network\protocol\AddEntityPacket;
    use 
    pocketmine\Player;
    use 
    pocketmine\entity\Projectile;
    use 
    pocketmine\entity\Entity;

    class 
    EnderPearl extends Projectile{
        const 
    NETWORK_ID 87;
        public 
    $width 0.25;
        public 
    $length 0.25;
        public 
    $height 0.25;
        protected 
    $gravity 0.03;
        protected 
    $drag 0.01;
        protected 
    $player;
        private 
    $hasTeleportedShooter false;
        public function 
    __construct(Level $levelCompoundTag $nbtEntity $shootingEntity null){
            
    parent::__construct($level$nbt$shootingEntity);
        }
        public function 
    teleportShooter(){
           if(!
    $this->hasTeleportedShooter){
               
    $this->hasTeleportedShooter true;
                if(
    $this->isAlive()) {
                    if (
    $this->shootingEntity instanceof Player and $this->0) {
                        
    $this->shootingEntity->attack(5, new EntityDamageEvent($this->shootingEntityEntityDamageEvent::CAUSE_FALL5));
                        
    $this->shootingEntity->teleport($this->getPosition());
                    }
                    
    $this->kill();
                }
            }
        }
        public function 
    onUpdate($currentTick){
            if(
    $this->closed){
                return 
    false;
            }
            
    $this->timings->startTiming();
            
    $hasUpdate parent::onUpdate($currentTick);
            if(
    $this->age 1200 or $this->isCollided){
                
    $this->teleportShooter();
                
    $hasUpdate true;
            }
            
    $this->timings->stopTiming();
            return 
    $hasUpdate;
        }
        public function 
    spawnTo(Player $player){
            
    $pk = new AddEntityPacket();
            
    $pk->type self::NETWORK_ID;
            
    $pk->eid $this->getId();
            
    $pk->$this->x;
            
    $pk->$this->y;
            
    $pk->$this->z;
            
    $pk->speedX $this->motionX;
            
    $pk->speedY $this->motionY;
            
    $pk->speedZ $this->motionZ;
            
    $pk->metadata $this->dataProperties;
            
    $player->dataPacket($pk);
            
    parent::spawnTo($player);
        }
    }
    I have no idea what I'm doing wrong...
     
    Last edited: May 19, 2017
  2. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
  3. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    @dktapps Maybe you know why the doors look so strange? I used exactly the same code as the normal oak door, I only changed the ID.
     
  4. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    Mhh because doors arent only one single block but twice
     
    Primus likes this.
  5. mmm545

    mmm545 Baby Zombie

    Messages:
    152
    GitHub:
    mmm545
    this thread is from 2017...
     
  6. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    There should be a dislike button for those who bumps old threads....
     
    cosmicnebula, EdwardHamHam and Primus like this.
  7. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    hehe does not exist :)
     
    Primus likes this.
  8. mmm545

    mmm545 Baby Zombie

    Messages:
    152
    GitHub:
    mmm545
    Report does tho :>
     
    cosmicnebula and minijaham like this.
  9. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    But this is not forbidden
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.