Some changes
This commit is contained in:
parent
4b109d817f
commit
1720d2d82d
3 changed files with 34 additions and 9 deletions
|
@ -144,6 +144,22 @@ class Main extends PluginBase implements \pocketmine\event\Listener {
|
||||||
$this->getServer()->loadLevel($name);
|
$this->getServer()->loadLevel($name);
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
case "worldtp":
|
||||||
|
if(isset($args[0])) {
|
||||||
|
if(is_null($this->getServer()->getLevelByName($args[0]))) {
|
||||||
|
$this->getServer()->loadLevel($args[0]);
|
||||||
|
if(is_null($this->getServer()->getLevelByName($args[0]))) {
|
||||||
|
$sender->sendMessage("Could not find level {$args[0]}.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sender->teleport(\pocketmine\level\Position::fromObject($player, $this->getServer()->getLevelByName($args[0])));
|
||||||
|
$sender->sendMessage("§aTeleporting to {$args[0]}...");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ class BetterNormal extends Generator {
|
||||||
$b = $this->selector->pickBiome($x + $xNoise - 1, $z + $zNoise - 1);
|
$b = $this->selector->pickBiome($x + $xNoise - 1, $z + $zNoise - 1);
|
||||||
if ($b instanceof Mountainable && $this->random->nextBoundedInt(1000 ) < 3) {
|
if ($b instanceof Mountainable && $this->random->nextBoundedInt(1000 ) < 3) {
|
||||||
$b = clone $b;
|
$b = clone $b;
|
||||||
$b->setElevation($b->getMinElevation () + (50 * $b->getMinElevation () / 100), $b->getMaxElevation () + (50 * $b->getMinElevation () / 100));
|
// $b->setElevation($b->getMinElevation () + (50 * $b->getMinElevation () / 100), $b->getMaxElevation () + (50 * $b->getMinElevation () / 100));
|
||||||
}
|
}
|
||||||
return $b;
|
return $b;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ use Ad5001\BetterGen\utils\BuildingUtils;
|
||||||
|
|
||||||
|
|
||||||
class FallenTree extends Object {
|
class FallenTree extends Object {
|
||||||
public $overridable = [
|
public static $overridable = [
|
||||||
Block::AIR => true,
|
Block::AIR => true,
|
||||||
6 => true,
|
6 => true,
|
||||||
17 => true,
|
17 => true,
|
||||||
|
@ -58,6 +58,7 @@ class FallenTree extends Object {
|
||||||
* @param $random pocketmine\utils\Random
|
* @param $random pocketmine\utils\Random
|
||||||
*/
|
*/
|
||||||
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||||
|
echo "Checking at $x $y $z FallenTree\n";
|
||||||
$randomHeight = round($random->nextBoundedInt(6) - 3);
|
$randomHeight = round($random->nextBoundedInt(6) - 3);
|
||||||
$this->length = $this->tree->trunkHeight + $randomHeight;
|
$this->length = $this->tree->trunkHeight + $randomHeight;
|
||||||
$this->direction = $random->nextBoundedInt(4);
|
$this->direction = $random->nextBoundedInt(4);
|
||||||
|
@ -65,17 +66,25 @@ class FallenTree extends Object {
|
||||||
switch($this->direction) {
|
switch($this->direction) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:// Z+
|
case 1:// Z+
|
||||||
if(in_array(false, BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z + $this->length), function($v3, $level) {
|
$return = BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z + $this->length), function($v3, $level) {
|
||||||
if(!in_array($level->getBlockIdAt($v3->x, $v3->y, $v3->z), $this->overridable)) return false;
|
if(!isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
|
||||||
}, $level))) {
|
echo $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . " is not overridable";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}, $level);
|
||||||
|
if(in_array(false, $return, true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3: // X+
|
case 3: // X+
|
||||||
if(in_array(false, BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x + $this->length, $y, $z), function($v3, $level) {
|
$return = arra_BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x + $this->length, $y, $z), function($v3, $level) {
|
||||||
if(!in_array($level->getBlockIdAt($v3->x, $v3->y, $v3->z), $this->overridable)) return false;
|
if(!isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
|
||||||
}, $level))) {
|
echo $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . " is not overridable";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}, $level);
|
||||||
|
if(in_array(false, $return, true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -131,7 +140,7 @@ class FallenTree extends Object {
|
||||||
* @param $level pocketmine\level\ChunkManager
|
* @param $level pocketmine\level\ChunkManager
|
||||||
*/
|
*/
|
||||||
public function placeBlock($x, $y, $z, ChunkManager $level) {
|
public function placeBlock($x, $y, $z, ChunkManager $level) {
|
||||||
if (isset($this->overridable [$level->getBlockIdAt($x, $y, $z )] ) && ! isset($this->overridable [$level->getBlockIdAt($x, $y - 1, $z )] )) {
|
if (isset(self::$overridable [$level->getBlockIdAt($x, $y, $z )] ) && ! isset(self::$overridable [$level->getBlockIdAt($x, $y - 1, $z )] )) {
|
||||||
$level->setBlockIdAt($x, $y, $z, $this->trunk [0]);
|
$level->setBlockIdAt($x, $y, $z, $this->trunk [0]);
|
||||||
$level->setBlockDataAt($x, $y, $z, $this->trunk [1]);
|
$level->setBlockDataAt($x, $y, $z, $this->trunk [1]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue