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

Second bed block

Discussion in 'Development' started by tybikman, Jan 15, 2021.

  1. tybikman

    tybikman Silverfish

    Messages:
    22
    I was trying to get the second bed block using this code:
    PHP:
    $x=$pos->getX();
            
    $y=$pos->getY();
            
    $z=$pos->getZ();
            if(
    $world->getBlock(new Vector3($x+1$y$z))->getId() == 26) return new Vector3($x+1$y$z);
            if(
    $world->getBlock(new Vector3($x-1$y$z))->getId() == 26) return new Vector3($x-1$y$z);
            if(
    $world->getBlock(new Vector3($x$y$z+1))->getId() == 26) return new Vector3($x$y$z+1);
            if(
    $world->getBlock(new Vector3($x$y$z-1))->getId() == 26) return new Vector3($x$y$z-1);
    But if I put two beds side by side ...
    My code goes crazy.
    Is there any other way to get a second bed block?
     
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
  3. tybikman

    tybikman Silverfish

    Messages:
    22
  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.