mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 19:55:33 +00:00
Better Tall Grass generation with bonemeal
This commit is contained in:
parent
0f01570d01
commit
6e9b70c9cb
@ -36,7 +36,7 @@ class GrassBlock extends SolidBlock{
|
|||||||
if(($player->gamemode & 0x01) === 0){
|
if(($player->gamemode & 0x01) === 0){
|
||||||
$item->count--;
|
$item->count--;
|
||||||
}
|
}
|
||||||
TallGrassObject::growGrass($this->level, $this, new Random());
|
TallGrassObject::growGrass($this->level, $this, new Random(), 8, 2);
|
||||||
return true;
|
return true;
|
||||||
}elseif($item->isHoe()){
|
}elseif($item->isHoe()){
|
||||||
if(($player->gamemode & 0x01) === 0){
|
if(($player->gamemode & 0x01) === 0){
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class TallGrassObject{
|
class TallGrassObject{
|
||||||
public static function growGrass(Level $level, Vector3 $pos, Random $random, $count = 15){
|
public static function growGrass(Level $level, Vector3 $pos, Random $random, $count = 15, $radius = 10){
|
||||||
$arr = array(
|
$arr = array(
|
||||||
BlockAPI::get(DANDELION, 0),
|
BlockAPI::get(DANDELION, 0),
|
||||||
BlockAPI::get(CYAN_FLOWER, 0),
|
BlockAPI::get(CYAN_FLOWER, 0),
|
||||||
@ -30,7 +30,6 @@ class TallGrassObject{
|
|||||||
BlockAPI::get(TALL_GRASS, 1),
|
BlockAPI::get(TALL_GRASS, 1),
|
||||||
BlockAPI::get(TALL_GRASS, 1)
|
BlockAPI::get(TALL_GRASS, 1)
|
||||||
);
|
);
|
||||||
$radius = 10;
|
|
||||||
$arrC = count($arr) - 1;
|
$arrC = count($arr) - 1;
|
||||||
for($c = 0; $c < $count; ++$c){
|
for($c = 0; $c < $count; ++$c){
|
||||||
$x = $random->nextRange($pos->x - $radius, $pos->x + $radius);
|
$x = $random->nextRange($pos->x - $radius, $pos->x + $radius);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user