mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 23:59:53 +00:00
Fixed Level Generation block updates
This commit is contained in:
parent
7e13ae2bda
commit
8bf10c523e
@ -45,7 +45,7 @@ class TallGrassObject{
|
|||||||
$d = $level->getBlock(new Vector3($x, $pos->y, $z));
|
$d = $level->getBlock(new Vector3($x, $pos->y, $z));
|
||||||
if($b->getID() === AIR and $d->getID() === GRASS){
|
if($b->getID() === AIR and $d->getID() === GRASS){
|
||||||
$t = $arr[$random->nextRange(0, count($arr) - 1)];
|
$t = $arr[$random->nextRange(0, count($arr) - 1)];
|
||||||
$level->setBlock($b, BlockAPI::get($t[0], $t[1]));
|
$level->setBlockRaw($b, BlockAPI::get($t[0], $t[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class PineTreeObject extends TreeObject{
|
|||||||
if($this->leavesSizeY === -1 or $this->leavesAbsoluteMaxRadius === -1) {
|
if($this->leavesSizeY === -1 or $this->leavesAbsoluteMaxRadius === -1) {
|
||||||
$this->findRandomLeavesSize($random);
|
$this->findRandomLeavesSize($random);
|
||||||
}
|
}
|
||||||
$level->setBlock(new Vector3($pos->x, $pos->y - 1, $pos->z), new DirtBlock());
|
$level->setBlockRaw(new Vector3($pos->x, $pos->y - 1, $pos->z), new DirtBlock());
|
||||||
$leavesRadius = 0;
|
$leavesRadius = 0;
|
||||||
$leavesMaxRadius = 1;
|
$leavesMaxRadius = 1;
|
||||||
$leavesBottomY = $this->totalHeight - $this->leavesSizeY;
|
$leavesBottomY = $this->totalHeight - $this->leavesSizeY;
|
||||||
@ -74,7 +74,7 @@ class PineTreeObject extends TreeObject{
|
|||||||
for ($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) {
|
for ($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) {
|
||||||
for ($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) {
|
for ($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) {
|
||||||
if (abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) {
|
if (abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) {
|
||||||
$level->setBlock(new Vector3($pos->x + $xx, $pos->y + $yy, $pos->z + $zz), new LeavesBlock($this->type));
|
$level->setBlockRaw(new Vector3($pos->x + $xx, $pos->y + $yy, $pos->z + $zz), new LeavesBlock($this->type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ class PineTreeObject extends TreeObject{
|
|||||||
}
|
}
|
||||||
$trunkHeightReducer = $random->nextRange(0, 3);
|
$trunkHeightReducer = $random->nextRange(0, 3);
|
||||||
for($yy = 0; $yy < ($this->totalHeight - $trunkHeightReducer); ++$yy){
|
for($yy = 0; $yy < ($this->totalHeight - $trunkHeightReducer); ++$yy){
|
||||||
$level->setBlock(new Vector3($pos->x, $pos->y + $yy, $pos->z), new WoodBlock($this->type));
|
$level->setBlockRaw(new Vector3($pos->x, $pos->y + $yy, $pos->z), new WoodBlock($this->type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class SmallTreeObject extends TreeObject{
|
|||||||
public function placeObject(Level $level, Vector3 $pos, Random $random){
|
public function placeObject(Level $level, Vector3 $pos, Random $random){
|
||||||
// The base dirt block
|
// The base dirt block
|
||||||
$dirtpos = new Vector3( $pos->x, $pos->y -1, $pos->z );
|
$dirtpos = new Vector3( $pos->x, $pos->y -1, $pos->z );
|
||||||
$level->setBlock( $dirtpos, new DirtBlock() );
|
$level->setBlockRaw( $dirtpos, new DirtBlock() );
|
||||||
|
|
||||||
// Adjust the tree trunk's height randomly
|
// Adjust the tree trunk's height randomly
|
||||||
// plot [-14:11] int( x / 8 ) + 5
|
// plot [-14:11] int( x / 8 ) + 5
|
||||||
@ -93,7 +93,7 @@ class SmallTreeObject extends TreeObject{
|
|||||||
$leafpos = new Vector3( $pos->x + $xx,
|
$leafpos = new Vector3( $pos->x + $xx,
|
||||||
$pos->y + $yy,
|
$pos->y + $yy,
|
||||||
$pos->z + $zz );
|
$pos->z + $zz );
|
||||||
$level->setBlock( $leafpos, new LeavesBlock( $this->type ) );
|
$level->setBlockRaw($leafpos, new LeavesBlock( $this->type ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ class SmallTreeObject extends TreeObject{
|
|||||||
if( $leaflevel > 1 )
|
if( $leaflevel > 1 )
|
||||||
{
|
{
|
||||||
$trunkpos = new Vector3( $pos->x, $pos->y + $yy, $pos->z );
|
$trunkpos = new Vector3( $pos->x, $pos->y + $yy, $pos->z );
|
||||||
$level->setBlock( $trunkpos, new WoodBlock( $this->type ) );
|
$level->setBlockRaw($trunkpos, new WoodBlock( $this->type ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,13 +64,13 @@ class SpruceTreeObject extends TreeObject{
|
|||||||
if($this->leavesBottomY === -1 or $this->leavesMaxRadius === -1) {
|
if($this->leavesBottomY === -1 or $this->leavesMaxRadius === -1) {
|
||||||
$this->findRandomLeavesSize();
|
$this->findRandomLeavesSize();
|
||||||
}
|
}
|
||||||
$level->setBlock(new Vector3($pos->x, $pos->y - 1, $pos->z), new DirtBlock());
|
$level->setBlockRaw(new Vector3($pos->x, $pos->y - 1, $pos->z), new DirtBlock());
|
||||||
$leavesRadius = 0;
|
$leavesRadius = 0;
|
||||||
for($yy = $this->totalHeight; $yy >= $this->leavesBottomY; --$yy){
|
for($yy = $this->totalHeight; $yy >= $this->leavesBottomY; --$yy){
|
||||||
for($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) {
|
for($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) {
|
||||||
for($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) {
|
for($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) {
|
||||||
if (abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) {
|
if (abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) {
|
||||||
$level->setBlock(new Vector3($pos->x + $xx, $pos->y + $yy, $pos->z + $zz), new LeavesBLock($this->type));
|
$level->setBlockRaw(new Vector3($pos->x + $xx, $pos->y + $yy, $pos->z + $zz), new LeavesBlock($this->type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ class SpruceTreeObject extends TreeObject{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for($yy = 0; $yy < ($this->totalHeight - 1); ++$yy){
|
for($yy = 0; $yy < ($this->totalHeight - 1); ++$yy){
|
||||||
$level->setBlock(new Vector3($pos->x, $pos->y + $yy, $pos->z), new WoodBlock($this->type));
|
$level->setBlockRaw(new Vector3($pos->x, $pos->y + $yy, $pos->z), new WoodBlock($this->type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user