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

Solved How to randomize blocks

Discussion in 'Development' started by Qeis2007, Aug 21, 2018.

  1. Qeis2007

    Qeis2007 Witch

    Messages:
    70
    GitHub:
    FrostingBita
    Im want to make a BlockParty plugin, but one i dont know how to make a random blocks that fills up an area?
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Blocks all use different ID numbers, so you could use the PHP mt_rand function to produce a random ID, like this:
    PHP:
     $randomId rand(1255); 
     
    $level->setBlockIdAt($x$y$z$randomId);
    You'll have to figure out your coordinates and level yourself. Either hardcode it, use a config, or even randomize that.
     
  3. Qeis2007

    Qeis2007 Witch

    Messages:
    70
    GitHub:
    FrostingBita
    Thank you for your help! :)
     
  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.