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

Place block without player being inside block?

Discussion in 'Development' started by KygekDev, Jul 8, 2021.

  1. KygekDev

    KygekDev Witch

    Messages:
    72
    GitHub:
    KygekDev
    Is there a way to place a block (Level->setBlock()) without causing the player being inside the block?
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Huh? What exactly do you mean?
     
    Agent likes this.
  3. KygekDev

    KygekDev Witch

    Messages:
    72
    GitHub:
    KygekDev
    When Level->setBlock() is called, a block will be placed/replaced. If a block is placed/replaced where a player is located, the player will be inside the block. How to prevent the player from being inside the block when calling Level->setBlock()?
     
  4. Axon

    Axon Zombie

    Messages:
    276
    You can make the player jump in top of the block using
    PHP:
    $player->jump();
    Edit:
    Or teleport the player in top of the block
     
    Agent and minijaham like this.
  5. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Uh...just have a check if player is in that place you want to setBlock() at?
    Or just simply do what erik said..
     
    Agent and Axon like this.
  6. Axon

    Axon Zombie

    Messages:
    276
    I would suggest minijaham idea, it’s better to check rather than make the player jump while it’s not on the block position.
     
    Agent and minijaham like this.
  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.