mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Update MonsterRoomStructure.php
This commit is contained in:
parent
022664c402
commit
6725bb1bea
1 changed files with 18 additions and 17 deletions
|
|
@ -29,51 +29,47 @@ class MonsterRoomStructure{
|
|||
else{
|
||||
$line = self::$width == 7 ? "C C" : "C C";
|
||||
}
|
||||
if($wallsLevel == 0){
|
||||
self::generateChests();
|
||||
}
|
||||
array_push(self::$structure[$wallsLevel], $line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function generateChests(){}
|
||||
public static function generateChests($level, $x, $y, $z){
|
||||
$level->setBlockRaw(new Vector3($x - floor(self::$width / 3), $y, $z), new ChestBlock());
|
||||
$level->setBlockRaw(new Vector3($x, $y, $z - floor(self::$width / 3)), new ChestBlock());
|
||||
}
|
||||
|
||||
public static function getSpawnerMob(){
|
||||
/*public static function getSpawnerMob(){
|
||||
$rand = Utils::randomFloat();
|
||||
if($rand <= 0.5) return MOB_ZOMBIE;
|
||||
elseif($rand <= 0.75) return MOB_SKELETON;
|
||||
else return MOB_SPIDER;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static function buildStructure($level, $x, $y, $z){ /*use CENTER positions*/
|
||||
console("building!");
|
||||
self::getWidth();
|
||||
self::generateFloor();
|
||||
self::generateWalls();
|
||||
//console(var_dump(self::$structure));
|
||||
$offsetX = 0;
|
||||
$offsetZ = 0;
|
||||
foreach(self::$structure as $layerCount => $layer){
|
||||
foreach($layer as $line){
|
||||
$line = rtrim($line); //remove useless spaces(only from right)
|
||||
foreach(str_split($line) as $char){
|
||||
$vector = new Vector3($x - floor(self::$width / 2) + $offsetX, $y + $layerCount, $z - floor(self::$width / 2) + $offsetZ);
|
||||
switch($char){
|
||||
case "C":
|
||||
$level->setBlockRaw(new Vector3($x - floor(self::$width / 2) + $offsetX, $y + $layerCount, $z - floor(self::$width / 2) + $offsetZ), new CobblestoneBlock());
|
||||
$level->setBlockRaw($vector, new CobblestoneBlock());
|
||||
break;
|
||||
case "M":
|
||||
$level->setBlockRaw(new Vector3($x - floor(self::$width / 2) + $offsetX, $y + $layerCount, $z - floor(self::$width / 2) + $offsetZ), new MossStoneBlock());
|
||||
break;
|
||||
case "H":
|
||||
$level->setBlockRaw(new Vector3($x - floor(self::$width / 2) + $offsetX, $y + $layerCount, $z - floor(self::$width / 2) + $offsetZ), new ChestBlock());
|
||||
$level->setBlockRaw($vector, new MossStoneBlock());
|
||||
break;
|
||||
case " ":
|
||||
$block = $level->getBlock(new Vector3($x - floor(self::$width / 2) + $offsetX, $y + $layerCount, $z - floor(self::$width / 2) + $offsetZ))->getID();
|
||||
if($block == 0){
|
||||
$block = $level->getBlock($vector)->getID();
|
||||
if($block === AIR){
|
||||
break;
|
||||
}
|
||||
$level->setBlockRaw(new Vector3($x - floor(self::$width / 2) + $offsetX, $y + $layerCount, $z - floor(self::$width / 2) + $offsetZ), new AirBlock());
|
||||
$level->setBlockRaw($vector, new AirBlock());
|
||||
break;
|
||||
}
|
||||
++$offsetX;
|
||||
|
|
@ -83,6 +79,11 @@ class MonsterRoomStructure{
|
|||
}
|
||||
$offsetZ = 0;
|
||||
}
|
||||
$level->setBlockRaw(new Vector3($x, $y, $z), new MonsterSpawnerBlock(self::getSpawnerMob()));
|
||||
$level->setBlockRaw(new Vector3($x, $y, $z), new MonsterSpawnerBlock());
|
||||
self::generateChests($level, $x, $y, $z);
|
||||
}
|
||||
|
||||
public static $possibleLoot = [
|
||||
"bone", "gunpowder", "string", "wheat", "bread"/*, "saddle"*/, "coal", "redstone_dust", "beetroot_seeds", "melon_seeds", "pumpkin_seeds", "iron_ingot", "bucket", "gold_ingot"
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue