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

error with 'new Position'

Discussion in 'Development' started by Atomization, Aug 11, 2018.

  1. Atomization

    Atomization Baby Zombie

    Messages:
    120
    GitHub:
    iAtomPlaza
    Hey i get the error that i don't understand:
    Code:
    Unhandled exception executing command 'test' in test: Argument 2 passed to pocketmine\math\AxisAlignedBB::setBounds() must be of the type float, null given, called in phar://C:/Users/steve/Desktop/MCPE server/Lobby Server/PocketMine-MP.phar/src/pocketmine/entity/Entity.php on line 647
    
    TypeError: "Argument 2 passed to pocketmine\math\AxisAlignedBB::setBounds() must be of the type float, null given, called in phar://C:/Users/steve/Desktop/MCPE server/Lobby Server/PocketMine-MP.phar/src/pocketmine/entity/Entity.php on line 647" (EXCEPTION) in "vendor/pocketmine/math/src/AxisAlignedBB" at line 45
    i get the error when i run the command and the code is:
    PHP:
    $x $config->getNested($arena.".x");
    $y $config->getNested($arena.".y");
    $z $config->getNested($arena.".z");

    $spawn = new Position($x+0.5$y$z+0.5$level);
    $level->loadChunk($spawn->getFloorX(), $spawn->getFloorZ());
    $player->teleport($spawn,0,0);
    it glitches me in the ground instead of teleportation and gives the error
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Which version of PMMP are you using?
     
  3. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    intval() $x, $y and $z and strval() $level
     
  4. Atomization

    Atomization Baby Zombie

    Messages:
    120
    GitHub:
    iAtomPlaza
    I was used an earlier version of the new 3.0.0 api, but then I updated to the latest and still have the errors

    The error is strange because it was working fine wile I was testing and then I get the error randomly so idk what caused it?
     
  5. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    Beware that "y" keys and values are transformed into booleans in the YAML 1.1 spec.
    Code:
    x: 1
    y: 1
    z: 1
    
    will transform into
    Code:
    x: 1
    1: 1
    z: 1
    
    You should consider using something else to store your data instead of a YAML config.

    Reference for this idiotic behaviour: http://yaml.org/type/bool.html

    edit: typo
     
    Last edited: Aug 12, 2018
    corytortoise and SkySeven like this.
  6. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Maybe saving it as "y"
     
  7. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    just rename "x", "y" and "z" by "posX" etc or what you want.
     
  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.