Reformatting, Fix #2, temple debug command

This commit is contained in:
thebigsmileXD 2017-05-12 09:01:46 +02:00
parent a7b8469c9c
commit 7ce51d546a
4 changed files with 484 additions and 450 deletions

View file

@ -23,9 +23,15 @@ commands:
description: Teleports you to an another world description: Teleports you to an another world
usage: "/worldtp <world name>" usage: "/worldtp <world name>"
permission: bettergen.cmd.worldtp permission: bettergen.cmd.worldtp
temple:
description: Spawns a temple for debugging
usage: "/temple"
permission: bettergen.cmd.debug
permissions: permissions:
bettergen.cmd.createworld: bettergen.cmd.createworld:
default: op default: op
bettergen.cmd.worldtp: bettergen.cmd.worldtp:
default: op default: op
bettergen.cmd.debug:
default: op
... ...

View file

@ -17,9 +17,11 @@ namespace Ad5001\BetterGen;
use Ad5001\BetterGen\biome\BetterForest; use Ad5001\BetterGen\biome\BetterForest;
use Ad5001\BetterGen\generator\BetterNormal; use Ad5001\BetterGen\generator\BetterNormal;
use Ad5001\BetterGen\loot\LootTable; use Ad5001\BetterGen\loot\LootTable;
use Ad5001\BetterGen\structure\Temple;
use pocketmine\block\Block; use pocketmine\block\Block;
use pocketmine\command\Command; use pocketmine\command\Command;
use pocketmine\command\CommandSender; use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\event\block\BlockBreakEvent; use pocketmine\event\block\BlockBreakEvent;
use pocketmine\event\level\ChunkPopulateEvent; use pocketmine\event\level\ChunkPopulateEvent;
use pocketmine\event\Listener; use pocketmine\event\Listener;
@ -30,10 +32,12 @@ use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag; use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\ListTag; use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\StringTag; use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\plugin\PluginBase; use pocketmine\plugin\PluginBase;
use pocketmine\tile\Chest; use pocketmine\tile\Chest;
use pocketmine\tile\Tile; use pocketmine\tile\Tile;
use pocketmine\utils\Config; use pocketmine\utils\Config;
use pocketmine\utils\Random;
class Main extends PluginBase implements Listener { class Main extends PluginBase implements Listener {
const PREFIX = "§l§o§b[§r§l§2Better§aGen§o§b]§r§f "; const PREFIX = "§l§o§b[§r§l§2Better§aGen§o§b]§r§f ";
@ -42,19 +46,22 @@ class Main extends PluginBase implements Listener {
/* /*
* Called when the plugin enables * Called when the plugin enables
*/ */
public function onEnable() {
$this->getServer()->getPluginManager()->registerEvents($this, $this); public static function registerBiome(int $id, Biome $biome) {
Generator::addGenerator(BetterNormal::class, "betternormal"); BetterNormal::registerBiome($biome);
if($this->isOtherNS()) $this->getLogger()->warning("Tesseract detected. Note that Tesseract is not up to date with the generation structure and some generation features may be limited or not working");
@mkdir($this->getDataFolder());
if(! file_exists(LootTable::getPluginFolder(). "processingLoots.json"))
file_put_contents(LootTable::getPluginFolder(). "processingLoots.json", "{}");
} }
/* /*
* Called when the plugin disables * Called when the plugin disables
*/ */
public function onDisable() {
public function onEnable() {
$this->getServer()->getPluginManager()->registerEvents($this, $this);
Generator::addGenerator(BetterNormal::class, "betternormal");
if ($this->isOtherNS()) $this->getLogger()->warning("Tesseract detected. Note that Tesseract is not up to date with the generation structure and some generation features may be limited or not working");
@mkdir($this->getDataFolder());
if (!file_exists(LootTable::getPluginFolder() . "processingLoots.json"))
file_put_contents(LootTable::getPluginFolder() . "processingLoots.json", "{}");
} }
/* /*
@ -65,87 +72,13 @@ class Main extends PluginBase implements Listener {
* @param $args array * @param $args array
* return bool * return bool
*/ */
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args): bool {
switch($cmd->getName()) { public static function isOtherNS() {
case "createworld" : // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)] try {
switch(count($args)) { return @class_exists("pocketmine\\level\\generator\\normal\\object\\OakTree");
case 0 : } catch (\Exception $e) {
return false; return false;
break;
case 1 : // /createworld <name>
$name = $args [0];
$generator = Generator::getGenerator("betternormal");
$generatorName = "betternormal";
$seed = $this->generateRandomSeed();
$options = [ ];
break;
case 2 : // /createworld <name> [generator = betternormal]
$name = $args [0];
$generator = Generator::getGenerator($args [1]);
if(Generator::getGeneratorName($generator) !== strtolower($args [1])) {
$sender->sendMessage(self::PREFIX . "§4Could not find generator {$args[1]}. Are you sure it is registered?");
return true;
} }
$generatorName = strtolower($args [1]);
$seed = $this->generateRandomSeed();
$options = [ ];
break;
case 3 : // /createworld <name> [generator = betternormal] [seed = rand()]
$name = $args [0];
$generator = Generator::getGenerator($args [1]);
if(Generator::getGeneratorName($generator) !== strtolower($args [1])) {
$sender->sendMessage(self::PREFIX . "§4Could not find generator {$args[1]}. Are you sure it is registered?");
return true;
}
$generatorName = strtolower($args [1]);
if(preg_match("[^\d]", $args [2]) !== false) {
$parts = str_split($args [2]);
foreach($parts as $key => $str) {
$parts [$key] = ord($str);
}
$seed = implode("", $parts);
} else {
$seed = $args [2];
}
$options = [ ];
break;
default : // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
$name = $args [0];
$generator = Generator::getGenerator($args [1]);
if(Generator::getGeneratorName($generator) !== strtolower($args [1])) {
$sender->sendMessage(self::PREFIX . "§4Could not find generator {$args[1]}. Are you sure it is registered?");
return true;
}
$generatorName = strtolower($args [1]);
if($args[2] == "rand") $args[2] = $this->generateRandomSeed();
if(preg_match("[^\d]", $args [2]) !== false) {
$parts = str_split($args [2]);
foreach($parts as $key => $str) {
$parts [$key] = ord($str);
}
$seed = implode("", $parts);
} else {
$seed = $args [2];
}
unset($args [0], $args [1], $args [2]);
$options = json_decode($args [3], true);
if(! is_array($options)) {
$sender->sendMessage(Main::PREFIX . "§4Invalid JSON for options.");
return true;
}
break;
}
$options["preset"] = json_encode($options);
if((int) $seed == 0/*String*/){
$seed = $this->generateRandomSeed();
}
$this->getServer()->broadcastMessage(Main::PREFIX . "§aGenerating level $name with generator $generatorName and seed $seed..");
$this->getServer()->generateLevel($name, $seed, $generator, $options);
$this->getServer()->loadLevel($name);
return true;
break;
}
return false;
} }
/* /*
@ -155,14 +88,8 @@ class Main extends PluginBase implements Listener {
* @params $infos Array(temperature, rainfall) * @params $infos Array(temperature, rainfall)
* @return bool * @return bool
*/ */
public function registerForest(string $name, string $treeClass, array $infos): bool {
if(! @class_exists($treeClass)) public function onDisable() {
return false;
if(! @is_subclass_of($treeClass, "pocketmine\\level\\generator\\normal\\object\\Tree"))
return false;
if(count($infos) < 2 or ! is_float($infos [0]) or ! is_float($infos [1]))
return false;
return BetterForest::registerForest($name, $treeClass, $infos);
} }
/* /*
@ -171,16 +98,104 @@ class Main extends PluginBase implements Listener {
* @param $biome Biome * @param $biome Biome
* @return void * @return void
*/ */
public static function registerBiome(int $id, Biome $biome) {
BetterNormal::registerBiome($biome); public function onCommand(CommandSender $sender, Command $cmd, $label, array $args): bool {
switch ($cmd->getName()) {
case "createworld" : // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
switch (count($args)) {
case 0 :
return false;
break;
case 1 : // /createworld <name>
$name = $args [0];
$generator = Generator::getGenerator("betternormal");
$generatorName = "betternormal";
$seed = $this->generateRandomSeed();
$options = [];
break;
case 2 : // /createworld <name> [generator = betternormal]
$name = $args [0];
$generator = Generator::getGenerator($args [1]);
if (Generator::getGeneratorName($generator) !== strtolower($args [1])) {
$sender->sendMessage(self::PREFIX . "§4Could not find generator {$args[1]}. Are you sure it is registered?");
return true;
}
$generatorName = strtolower($args [1]);
$seed = $this->generateRandomSeed();
$options = [];
break;
case 3 : // /createworld <name> [generator = betternormal] [seed = rand()]
$name = $args [0];
$generator = Generator::getGenerator($args [1]);
if (Generator::getGeneratorName($generator) !== strtolower($args [1])) {
$sender->sendMessage(self::PREFIX . "§4Could not find generator {$args[1]}. Are you sure it is registered?");
return true;
}
$generatorName = strtolower($args [1]);
if (preg_match("[^\d]", $args [2]) !== false) {
$parts = str_split($args [2]);
foreach ($parts as $key => $str) {
$parts [$key] = ord($str);
}
$seed = implode("", $parts);
} else {
$seed = $args [2];
}
$options = [];
break;
default : // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
$name = $args [0];
$generator = Generator::getGenerator($args [1]);
if (Generator::getGeneratorName($generator) !== strtolower($args [1])) {
$sender->sendMessage(self::PREFIX . "§4Could not find generator {$args[1]}. Are you sure it is registered?");
return true;
}
$generatorName = strtolower($args [1]);
if ($args[2] == "rand") $args[2] = $this->generateRandomSeed();
if (preg_match("[^\d]", $args [2]) !== false) {
$parts = str_split($args [2]);
foreach ($parts as $key => $str) {
$parts [$key] = ord($str);
}
$seed = implode("", $parts);
} else {
$seed = $args [2];
}
unset($args [0], $args [1], $args [2]);
$options = json_decode($args [3], true);
if (!is_array($options)) {
$sender->sendMessage(Main::PREFIX . "§4Invalid JSON for options.");
return true;
}
break;
}
$options["preset"] = json_encode($options);
if ((int)$seed == 0/*String*/) {
$seed = $this->generateRandomSeed();
}
$this->getServer()->broadcastMessage(Main::PREFIX . "§aGenerating level $name with generator $generatorName and seed $seed..");
$this->getServer()->generateLevel($name, $seed, $generator, $options);
$this->getServer()->loadLevel($name);
return true;
break;
case 'temple':{
if($sender instanceof ConsoleCommandSender) return false;
/** @var Player $sender */
$temple = new Temple();
$temple->placeObject($sender->getLevel(), $sender->x, $sender->y, $sender->z, new Random());
return true;
}
}
return false;
} }
/* /*
* Generates a(semi) random seed. * Generates a(semi) random seed.
* @return int * @return int
*/ */
public function generateRandomSeed(): int { public function generateRandomSeed(): int {
return (int) round(rand(0, round(time()) / memory_get_usage(true)) * (int) str_shuffle("127469453645108") / (int) str_shuffle("12746945364")); return (int)round(rand(0, round(time()) / memory_get_usage(true)) * (int)str_shuffle("127469453645108") / (int)str_shuffle("12746945364"));
} }
// Listener // Listener
@ -190,11 +205,27 @@ class Main extends PluginBase implements Listener {
* @param $event pocketmine\event\level\ChunkPopulateEvent * @param $event pocketmine\event\level\ChunkPopulateEvent
* @return int * @return int
*/ */
public function registerForest(string $name, string $treeClass, array $infos): bool {
if (!@class_exists($treeClass))
return false;
if (!@is_subclass_of($treeClass, "pocketmine\\level\\generator\\normal\\object\\Tree"))
return false;
if (count($infos) < 2 or !is_float($infos [0]) or !is_float($infos [1]))
return false;
return BetterForest::registerForest($name, $treeClass, $infos);
}
/*
* Checks when a player interacts with a loot chest to create it.
*/
public function onChunkPopulate(ChunkPopulateEvent $event) { public function onChunkPopulate(ChunkPopulateEvent $event) {
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON); $cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
foreach($cfg->getAll() as $key => $value) { foreach ($cfg->getAll() as $key => $value) {
list($x, $y, $z) = explode(";", $key); list($x, $y, $z) = explode(";", $key);
if($value["saveAs"] == "chest" && $event->getLevel()->getBlockIdAt($x, $y, $z) == Block::AIR ){ if ($value["saveAs"] == "chest" && $event->getLevel()->getBlockIdAt($x, $y, $z) == Block::AIR) {
$event->getLevel()->setBlockIdAt($x, $y, $z, Block::CHEST); $event->getLevel()->setBlockIdAt($x, $y, $z, Block::CHEST);
} else { } else {
$cfg->remove($key); $cfg->remove($key);
@ -205,12 +236,13 @@ class Main extends PluginBase implements Listener {
/* /*
* Checks when a player interacts with a loot chest to create it. * Checks when a player breaks a loot chest which is not created to create it
*/ */
public function onInteract(PlayerInteractEvent $event) { public function onInteract(PlayerInteractEvent $event) {
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON); $cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
if($event->getBlock()->getId() !== Block::CHEST) return; if ($event->getBlock()->getId() !== Block::CHEST) return;
if(!$cfg->exists($event->getBlock()->getX() . ";" . $event->getBlock()->getY() . ";" . $event->getBlock()->getZ())) return; if (!$cfg->exists($event->getBlock()->getX() . ";" . $event->getBlock()->getY() . ";" . $event->getBlock()->getZ())) return;
$nbt = new CompoundTag("", [ $nbt = new CompoundTag("", [
new ListTag("Items", []), new ListTag("Items", []),
new StringTag("id", Tile::CHEST), new StringTag("id", Tile::CHEST),
@ -224,14 +256,15 @@ class Main extends PluginBase implements Listener {
LootTable::fillChest($chest->getInventory(), $event->getBlock()); LootTable::fillChest($chest->getInventory(), $event->getBlock());
} }
/* /*
* Checks when a player breaks a loot chest which is not created to create it * Check if it's a Tesseract like namespace
* @return bool
*/ */
public function onBlockBreak(BlockBreakEvent $event) { public function onBlockBreak(BlockBreakEvent $event) {
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON); $cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
if($event->getBlock()->getId() !== Block::CHEST) return; if ($event->getBlock()->getId() !== Block::CHEST) return;
if(!$cfg->exists($event->getBlock()->getX() . ";" . $event->getBlock()->getY() . ";" . $event->getBlock()->getZ())) return; if (!$cfg->exists($event->getBlock()->getX() . ";" . $event->getBlock()->getY() . ";" . $event->getBlock()->getZ())) return;
$nbt = new CompoundTag("", [ $nbt = new CompoundTag("", [
new ListTag("Items", []), new ListTag("Items", []),
new StringTag("id", Tile::CHEST), new StringTag("id", Tile::CHEST),
@ -245,16 +278,4 @@ class Main extends PluginBase implements Listener {
LootTable::fillChest($chest->getInventory(), $event->getBlock()); LootTable::fillChest($chest->getInventory(), $event->getBlock());
// $event->setCancelled(); //i think nope. You want to break it with items // $event->setCancelled(); //i think nope. You want to break it with items
} }
/*
* Check if it's a Tesseract like namespace
* @return bool
*/
public static function isOtherNS() {
try {
return @class_exists("pocketmine\\level\\generator\\normal\\object\\OakTree");
} catch(\Exception $e) {
return false;
}
}
} }

View file

@ -442,8 +442,8 @@ class SakuraTree extends Tree {
public $trunkHeight = 11; public $trunkHeight = 11;
private $leafType; public $leafType;
private $leaf2Type; public $leaf2Type;
/* /*
* Constructs the class * Constructs the class

View file

@ -14,13 +14,13 @@
namespace Ad5001\BetterGen\structure; namespace Ad5001\BetterGen\structure;
use pocketmine\block\Block;
use pocketmine\level\ChunkManager;
use pocketmine\utils\Random;
use pocketmine\math\Vector3;
use pocketmine\level\generator\object\Object;
use Ad5001\BetterGen\loot\LootTable; use Ad5001\BetterGen\loot\LootTable;
use Ad5001\BetterGen\utils\BuildingUtils; use Ad5001\BetterGen\utils\BuildingUtils;
use pocketmine\block\Block;
use pocketmine\level\ChunkManager;
use pocketmine\level\generator\object\Object;
use pocketmine\math\Vector3;
use pocketmine\utils\Random;
class Temple extends Object { class Temple extends Object {
const DIRECTION_PLUSX = 0; const DIRECTION_PLUSX = 0;
@ -45,45 +45,44 @@ class Temple extends Object {
2 2
], ],
[ [
- 3, -3,
0 0
], ],
[ [
- 2, -2,
1 1
], ],
[ [
- 1, -1,
2 2
], ],
[ [
0, 0,
- 3 -3
], ],
[ [
2, 2,
- 1 -1
], ],
[ [
1, 1,
- 2 -2
], ],
[ [
- 2, -2,
- 1 -1
], ],
[ [
- 1, -1,
- 2 -2
] ]
]; ];
/** @var ChunkManager */
private $level;
public $overridable = [ public $overridable = [
Block::AIR => true, Block::AIR => true,
6 => true, Block::SAPLING => true,
17 => true, Block::LOG => true,
18 => true, Block::LEAVES => true,
Block::STONE => true,
Block::DANDELION => true, Block::DANDELION => true,
Block::POPPY => true, Block::POPPY => true,
Block::SNOW_LAYER => true, Block::SNOW_LAYER => true,
@ -98,17 +97,20 @@ class Temple extends Object {
], ],
[ [
1, 1,
- 1 -1
], ],
[ [
- 1, -1,
- 1 -1
], ],
[ [
- 1, -1,
1 1
] ]
]; ];
/** @var ChunkManager */
private $level;
private $direction = 0;
/* /*
* Checks if a temple is placeable * Checks if a temple is placeable
@ -119,13 +121,14 @@ class Temple extends Object {
* @param $random pocketmine\utils\Random * @param $random pocketmine\utils\Random
* @return bool * @return bool
*/ */
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) { public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
$this->level = $level; $this->level = $level;
$this->direction = $random->nextBoundedInt(4); $this->direction = $random->nextBoundedInt(4);
for($xx = $x - 10; $xx <= $x + 10; $xx ++) for ($xx = $x - 10; $xx <= $x + 10; $xx++)
for($yy = $y + 1; $yy <= $y + 11; $yy ++) for ($yy = $y + 1; $yy <= $y + 11; $yy++)
for($zz = $z - 10; $zz <= $z + 10; $zz ++) for ($zz = $z - 10; $zz <= $z + 10; $zz++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz )] )) if (!isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)]))
return false; return false;
return true; return true;
} }
@ -140,41 +143,41 @@ class Temple extends Object {
*/ */
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) { public function placeObject(ChunkManager $level, $x, $y, $z, Random $random) {
// Clearing space... // Clearing space...
BuildingUtils::fill($level, new Vector3($x + 10, $y + 1, $z + 10 ), new Vector3($x - 10, $y + 2, $z - 10 ), Block::get(Block::AIR )); BuildingUtils::fill($level, new Vector3($x + 10, $y + 1, $z + 10), new Vector3($x - 10, $y + 2, $z - 10), Block::get(Block::AIR));
// First, build a pyramid. // First, build a pyramid.
$this->level = $level; $this->level = $level;
$firstPos = new Vector3($x + 10, $y, $z + 10); $firstPos = new Vector3($x + 10, $y, $z + 10);
$sndPos = new Vector3($x - 10, $y, $z - 10); $sndPos = new Vector3($x - 10, $y, $z - 10);
for($i = 0; $i <= 9; $i ++) { for ($i = 0; $i <= 9; $i++) {
// Building sides // Building sides
BuildingUtils::walls($level, $firstPos, $sndPos, Block::get(Block::SANDSTONE )); BuildingUtils::walls($level, $firstPos, $sndPos, Block::get(Block::SANDSTONE));
// Next floor // Next floor
$firstPos->x --; $firstPos->x--;
$firstPos->z --; $firstPos->z--;
$firstPos->y = $y + $i; $firstPos->y = $y + $i;
$sndPos->x ++; $sndPos->x++;
$sndPos->z ++; $sndPos->z++;
$sndPos->y = $y + $i; $sndPos->y = $y + $i;
} }
// Floors // Floors
for($xx = $x + 9; $xx >= $x - 9; $xx --) for ($xx = $x + 9; $xx >= $x - 9; $xx--)
for($zz = $z + 9; $zz >= $z - 9; $zz --) for ($zz = $z + 9; $zz >= $z - 9; $zz--)
$this->placeBlock($xx, $y, $zz); $this->placeBlock($xx, $y, $zz);
for($xx = $x + 5; $xx >= $x - 5; $xx --) for ($xx = $x + 5; $xx >= $x - 5; $xx--)
for($zz = $z + 5; $zz >= $z - 5; $zz --) for ($zz = $z + 5; $zz >= $z - 5; $zz--)
$this->placeBlock($xx, $y + 4, $zz); $this->placeBlock($xx, $y + 4, $zz);
// Creating hole // Creating hole
for($xx = $x - 1; $xx <= $x + 1; $xx ++) for ($xx = $x - 1; $xx <= $x + 1; $xx++)
for($yy = $y - 11; $yy <= $y + 4; $yy ++) for ($yy = $y - 11; $yy <= $y + 4; $yy++)
for($zz = $z - 1; $zz <= $z + 1; $zz ++) for ($zz = $z - 1; $zz <= $z + 1; $zz++)
$this->placeBlock($xx, $yy, $zz, 0); $this->placeBlock($xx, $yy, $zz, 0);
// Floor patern // Floor patern
foreach($this->directions as $dir ) { foreach ($this->directions as $dir) {
// Building pillar // Building pillar
for($yy = $y + 1; $yy <= $y + 3; $yy ++) for ($yy = $y + 1; $yy <= $y + 3; $yy++)
$this->placeBlock($x + ($dir [0] * 2), $yy, $z + ($dir [1] * 2), Block::SANDSTONE, 2); $this->placeBlock($x + ($dir [0] * 2), $yy, $z + ($dir [1] * 2), Block::SANDSTONE, 2);
// Orange hardened clay // Orange hardened clay
$this->placeBlock($x + $dir [0], $y, $z + $dir [1], Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + $dir [0], $y, $z + $dir [1], Block::STAINED_HARDENED_CLAY, 1);
@ -192,37 +195,37 @@ class Temple extends Object {
// Blue hardened clay (center) // Blue hardened clay (center)
$this->placeBlock($x, $y, $z, Block::STAINED_HARDENED_CLAY, 11); $this->placeBlock($x, $y, $z, Block::STAINED_HARDENED_CLAY, 11);
// Hole walls // Hole walls
BuildingUtils::walls($level, new Vector3($x - 2, $y, $z - 2 ), new Vector3($x + 2, $y - 8, $z + 2 ), Block::get(Block::SANDSTONE )); BuildingUtils::walls($level, new Vector3($x - 2, $y, $z - 2), new Vector3($x + 2, $y - 8, $z + 2), Block::get(Block::SANDSTONE));
// Last step like this // Last step like this
for($xx = $x - 2; $xx <= $x + 2; $xx ++) { for ($xx = $x - 2; $xx <= $x + 2; $xx++) {
$this->placeBlock($xx, $y - 9, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($xx, $y - 9, $z - 2, Block::SANDSTONE, 2);
$this->placeBlock($xx, $y - 9, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($xx, $y - 9, $z + 2, Block::SANDSTONE, 2);
} }
for($zz = $z - 2; $zz <= $z + 2; $zz ++) { for ($zz = $z - 2; $zz <= $z + 2; $zz++) {
$this->placeBlock($x - 2, $y - 9, $zz, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y - 9, $zz, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y - 9, $zz, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y - 9, $zz, Block::SANDSTONE, 2);
} }
foreach(self::THREE_DIAGS as $diagPos ) { foreach (self::THREE_DIAGS as $diagPos) {
$this->placeBlock($x + $diagPos [0], $y - 10, $z + $diagPos [1], Block::SANDSTONE, 1); $this->placeBlock($x + $diagPos [0], $y - 10, $z + $diagPos [1], Block::SANDSTONE, 1);
$this->placeBlock($x + $diagPos [0], $y - 11, $z + $diagPos [1], Block::SANDSTONE, 2); $this->placeBlock($x + $diagPos [0], $y - 11, $z + $diagPos [1], Block::SANDSTONE, 2);
} }
// Floor + TNT // Floor + TNT
for($xx = $x - 2; $xx <= $x + 2; $xx ++) for ($xx = $x - 2; $xx <= $x + 2; $xx++)
for($zz = $z - 2; $zz <= $z + 2; $zz ++) for ($zz = $z - 2; $zz <= $z + 2; $zz++)
$this->placeBlock($xx, $y - 12, $zz, Block::SANDSTONE, 2); $this->placeBlock($xx, $y - 12, $zz, Block::SANDSTONE, 2);
for($xx = $x - 1; $xx <= $x + 1; $xx ++) for ($xx = $x - 1; $xx <= $x + 1; $xx++)
for($zz = $z - 1; $zz <= $z + 1; $zz ++) for ($zz = $z - 1; $zz <= $z + 1; $zz++)
$this->placeBlock($xx, $y - 13, $zz, Block::TNT); $this->placeBlock($xx, $y - 13, $zz, Block::TNT);
$this->placeBlock($x, $y - 11, $z, Block::STONE_PRESSURE_PLATE); $this->placeBlock($x, $y - 11, $z, Block::STONE_PRESSURE_PLATE);
// Chests // Chests
LootTable::buildLootTable(new Vector3($x, $y - 11, $z + 2 ), LootTable::LOOT_DESERT_TEMPLE, $random); LootTable::buildLootTable(new Vector3($x, $y - 11, $z + 2), LootTable::LOOT_DESERT_TEMPLE, $random);
LootTable::buildLootTable(new Vector3($x, $y - 11, $z - 2 ), LootTable::LOOT_DESERT_TEMPLE, $random); LootTable::buildLootTable(new Vector3($x, $y - 11, $z - 2), LootTable::LOOT_DESERT_TEMPLE, $random);
LootTable::buildLootTable(new Vector3($x + 2, $y - 11, $z ), LootTable::LOOT_DESERT_TEMPLE, $random); LootTable::buildLootTable(new Vector3($x + 2, $y - 11, $z), LootTable::LOOT_DESERT_TEMPLE, $random);
LootTable::buildLootTable(new Vector3($x - 2, $y - 11, $z ), LootTable::LOOT_DESERT_TEMPLE, $random); LootTable::buildLootTable(new Vector3($x - 2, $y - 11, $z), LootTable::LOOT_DESERT_TEMPLE, $random);
// Entrance is a rectangular parallelepiped // Entrance is a rectangular parallelepiped
switch ($this->direction) { switch ($this->direction) {
@ -231,15 +234,15 @@ class Temple extends Object {
$this->placeTower($x + 8, $y, $z + 8, self::DIRECTION_PLUSX, self::DIRECTION_PLUSZ); $this->placeTower($x + 8, $y, $z + 8, self::DIRECTION_PLUSX, self::DIRECTION_PLUSZ);
$this->placeTower($x + 8, $y, $z - 8, self::DIRECTION_PLUSX, self::DIRECTION_MINZ); $this->placeTower($x + 8, $y, $z - 8, self::DIRECTION_PLUSX, self::DIRECTION_MINZ);
// Creating rectangular parallelepiped of sandstone. // Creating rectangular parallelepiped of sandstone.
BuildingUtils::fill($level, new Vector3($x + 6, $y + 1, $z - 6 ), new Vector3($x + 9, $y + 4, $z + 6 ), Block::get(Block::SANDSTONE )); BuildingUtils::fill($level, new Vector3($x + 6, $y + 1, $z - 6), new Vector3($x + 9, $y + 4, $z + 6), Block::get(Block::SANDSTONE));
// Creating a path to the entrance // Creating a path to the entrance
BuildingUtils::fill($level, new Vector3($x + 6, $y + 1, $z - 1 ), new Vector3($x + 9, $y + 4, $z + 1 ), Block::get(Block::AIR )); BuildingUtils::fill($level, new Vector3($x + 6, $y + 1, $z - 1), new Vector3($x + 9, $y + 4, $z + 1), Block::get(Block::AIR));
// Creating path to towers. // Creating path to towers.
for($yy = $y + 1; $yy <= $y + 2; $yy ++) for ($yy = $y + 1; $yy <= $y + 2; $yy++)
for($zz = $z - 6; $zz <= $z + 6; $zz ++) for ($zz = $z - 6; $zz <= $z + 6; $zz++)
$this->placeBlock($x + 8, $yy, $zz, 0); $this->placeBlock($x + 8, $yy, $zz, 0);
// Door additional blocks // Door additional blocks
for($yy = $y + 1; $yy <= $y + 4; $yy ++) { for ($yy = $y + 1; $yy <= $y + 4; $yy++) {
$this->placeBlock($x + 6, $yy, $z - 2); $this->placeBlock($x + 6, $yy, $z - 2);
$this->placeBlock($x + 6, $yy, $z + 2); $this->placeBlock($x + 6, $yy, $z + 2);
// Polished entrance // Polished entrance
@ -251,17 +254,17 @@ class Temple extends Object {
} }
// Finishing entrance structure // Finishing entrance structure
$this->placeBlock($x + 9, $y + 3, $z, Block::SANDSTONE, 2); $this->placeBlock($x + 9, $y + 3, $z, Block::SANDSTONE, 2);
for($zz = $z - 2; $zz <= $z + 2; $zz ++) for ($zz = $z - 2; $zz <= $z + 2; $zz++)
$this->placeBlock($x + 10, $y + 4, $zz, Block::SANDSTONE, 2); $this->placeBlock($x + 10, $y + 4, $zz, Block::SANDSTONE, 2);
$this->placeBlock($x + 10, $y + 5, $z, Block::SANDSTONE, 1); $this->placeBlock($x + 10, $y + 5, $z, Block::SANDSTONE, 1);
$this->placeBlock($x + 10, $y + 5, $z - 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 10, $y + 5, $z - 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 10, $y + 5, $z + 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 10, $y + 5, $z + 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 10, $y + 5, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($x + 10, $y + 5, $z - 2, Block::SANDSTONE, 2);
$this->placeBlock($x + 10, $y + 5, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x + 10, $y + 5, $z + 2, Block::SANDSTONE, 2);
for($zz = $z - 1; $zz <= $z + 1; $zz ++) for ($zz = $z - 1; $zz <= $z + 1; $zz++)
$this->placeBlock($x + 10, $y + 6, $zz, Block::SANDSTONE, 2); $this->placeBlock($x + 10, $y + 6, $zz, Block::SANDSTONE, 2);
for($xx = $x + 6; $xx <= $x + 9; $xx ++) for ($xx = $x + 6; $xx <= $x + 9; $xx++)
for($zz = $z - 2; $zz <= $z + 2; $zz ++) for ($zz = $z - 2; $zz <= $z + 2; $zz++)
$this->placeBlock($xx, $y + 4, $zz); $this->placeBlock($xx, $y + 4, $zz);
break; break;
@ -270,21 +273,21 @@ class Temple extends Object {
$this->placeTower($x - 8, $y, $z + 8, self::DIRECTION_MINX, self::DIRECTION_PLUSZ); $this->placeTower($x - 8, $y, $z + 8, self::DIRECTION_MINX, self::DIRECTION_PLUSZ);
$this->placeTower($x - 8, $y, $z - 8, self::DIRECTION_MINX, self::DIRECTION_MINZ); $this->placeTower($x - 8, $y, $z - 8, self::DIRECTION_MINX, self::DIRECTION_MINZ);
// Creating rectangular parallelepiped of sandstone. // Creating rectangular parallelepiped of sandstone.
for($xx = $x - 6; $xx >= $x - 9; $xx --) for ($xx = $x - 6; $xx >= $x - 9; $xx--)
for($yy = $y + 1; $yy <= $y + 4; $yy ++) for ($yy = $y + 1; $yy <= $y + 4; $yy++)
for($zz = $z - 6; $zz <= $z + 6; $zz ++) for ($zz = $z - 6; $zz <= $z + 6; $zz++)
$this->placeBlock($xx, $yy, $zz); $this->placeBlock($xx, $yy, $zz);
// Creating a path to the entrance // Creating a path to the entrance
for($xx = $x - 6; $xx >= $x - 9; $xx --) for ($xx = $x - 6; $xx >= $x - 9; $xx--)
for($yy = $y + 1; $yy <= $y + 4; $yy ++) for ($yy = $y + 1; $yy <= $y + 4; $yy++)
for($zz = $z - 1; $zz <= $z + 1; $zz ++) for ($zz = $z - 1; $zz <= $z + 1; $zz++)
$this->placeBlock($xx, $yy, $zz, 0); $this->placeBlock($xx, $yy, $zz, 0);
// Creating path to towers. // Creating path to towers.
for($yy = $y + 1; $yy <= $y + 2; $yy ++) for ($yy = $y + 1; $yy <= $y + 2; $yy++)
for($zz = $z - 6; $zz <= $z + 6; $zz ++) for ($zz = $z - 6; $zz <= $z + 6; $zz++)
$this->placeBlock($x - 8, $yy, $zz, 0); $this->placeBlock($x - 8, $yy, $zz, 0);
// Door additional blocks // Door additional blocks
for($yy = $y + 1; $yy <= $y + 4; $yy ++) { for ($yy = $y + 1; $yy <= $y + 4; $yy++) {
$this->placeBlock($x - 6, $yy, $z - 2); $this->placeBlock($x - 6, $yy, $z - 2);
$this->placeBlock($x - 6, $yy, $z + 2); $this->placeBlock($x - 6, $yy, $z + 2);
// Polished entrance // Polished entrance
@ -296,17 +299,17 @@ class Temple extends Object {
} }
// Finishing entrance structure // Finishing entrance structure
$this->placeBlock($x - 9, $y + 3, $z, Block::SANDSTONE, 2); $this->placeBlock($x - 9, $y + 3, $z, Block::SANDSTONE, 2);
for($zz = $z - 2; $zz <= $z + 2; $zz ++) for ($zz = $z - 2; $zz <= $z + 2; $zz++)
$this->placeBlock($x - 10, $y + 4, $zz, Block::SANDSTONE, 2); $this->placeBlock($x - 10, $y + 4, $zz, Block::SANDSTONE, 2);
$this->placeBlock($x - 10, $y + 5, $z, Block::SANDSTONE, 1); $this->placeBlock($x - 10, $y + 5, $z, Block::SANDSTONE, 1);
$this->placeBlock($x - 10, $y + 5, $z - 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 10, $y + 5, $z - 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 10, $y + 5, $z + 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 10, $y + 5, $z + 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 10, $y + 5, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($x - 10, $y + 5, $z - 2, Block::SANDSTONE, 2);
$this->placeBlock($x - 10, $y + 5, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x - 10, $y + 5, $z + 2, Block::SANDSTONE, 2);
for($zz = $z - 1; $zz <= $z + 1; $zz ++) for ($zz = $z - 1; $zz <= $z + 1; $zz++)
$this->placeBlock($x - 10, $y + 6, $zz, Block::SANDSTONE, 2); $this->placeBlock($x - 10, $y + 6, $zz, Block::SANDSTONE, 2);
for($xx = $x - 6; $xx >= $x - 9; $xx --) for ($xx = $x - 6; $xx >= $x - 9; $xx--)
for($zz = $z - 2; $zz <= $z + 2; $zz ++) for ($zz = $z - 2; $zz <= $z + 2; $zz++)
$this->placeBlock($xx, $y + 4, $zz); $this->placeBlock($xx, $y + 4, $zz);
break; break;
@ -315,16 +318,16 @@ class Temple extends Object {
$this->placeTower($x + 8, $y, $z + 8, self::DIRECTION_PLUSZ, self::DIRECTION_PLUSX); $this->placeTower($x + 8, $y, $z + 8, self::DIRECTION_PLUSZ, self::DIRECTION_PLUSX);
$this->placeTower($x - 8, $y, $z + 8, self::DIRECTION_PLUSZ, self::DIRECTION_MINX); $this->placeTower($x - 8, $y, $z + 8, self::DIRECTION_PLUSZ, self::DIRECTION_MINX);
// Creating rectangular parallelepiped of sandstone. // Creating rectangular parallelepiped of sandstone.
BuildingUtils::fill($level, new Vector3($x - 6, $y + 1, $z + 6 ), new Vector3($x + 6, $y + 4, $z + 9 ), Block::get(Block::SANDSTONE )); BuildingUtils::fill($level, new Vector3($x - 6, $y + 1, $z + 6), new Vector3($x + 6, $y + 4, $z + 9), Block::get(Block::SANDSTONE));
// Creating a path to the entrance // Creating a path to the entrance
for($xx = $x - 1; $xx <= $x + 1; $xx ++) for ($xx = $x - 1; $xx <= $x + 1; $xx++)
for($yy = $y + 1; $yy <= $y + 4; $yy ++) for ($yy = $y + 1; $yy <= $y + 4; $yy++)
for($zz = $z + 6; $zz <= $z + 9; $zz ++) for ($zz = $z + 6; $zz <= $z + 9; $zz++)
$this->placeBlock($xx, $yy, $zz, 0); $this->placeBlock($xx, $yy, $zz, 0);
// Creating path to towers. // Creating path to towers.
BuildingUtils::fill($level, new Vector3($x - 1, $y + 1, $z + 6 ), new Vector3($x + 1, $y + 4, $z + 9 ), Block::get(Block::AIR )); BuildingUtils::fill($level, new Vector3($x - 1, $y + 1, $z + 6), new Vector3($x + 1, $y + 4, $z + 9), Block::get(Block::AIR));
// Door additional blocks // Door additional blocks
for($yy = $y + 1; $yy <= $y + 4; $yy ++) { for ($yy = $y + 1; $yy <= $y + 4; $yy++) {
$this->placeBlock($x - 2, $yy, $z + 6); $this->placeBlock($x - 2, $yy, $z + 6);
$this->placeBlock($x + 2, $yy, $z + 6); $this->placeBlock($x + 2, $yy, $z + 6);
// Polished entrance // Polished entrance
@ -336,17 +339,17 @@ class Temple extends Object {
} }
// Finishing entrance structure // Finishing entrance structure
$this->placeBlock($x, $y + 3, $z + 9, Block::SANDSTONE, 2); $this->placeBlock($x, $y + 3, $z + 9, Block::SANDSTONE, 2);
for($xx = $x - 2; $xx <= $x + 2; $xx ++) for ($xx = $x - 2; $xx <= $x + 2; $xx++)
$this->placeBlock($xx, $y + 4, $z + 10, Block::SANDSTONE, 2); $this->placeBlock($xx, $y + 4, $z + 10, Block::SANDSTONE, 2);
$this->placeBlock($x, $y + 5, $z + 10, Block::SANDSTONE, 1); $this->placeBlock($x, $y + 5, $z + 10, Block::SANDSTONE, 1);
$this->placeBlock($x - 1, $y + 5, $z + 10, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 1, $y + 5, $z + 10, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 1, $y + 5, $z + 10, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 1, $y + 5, $z + 10, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 2, $y + 5, $z + 10, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + 5, $z + 10, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + 5, $z + 10, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + 5, $z + 10, Block::SANDSTONE, 2);
for($xx = $x - 1; $xx <= $x + 1; $xx ++) for ($xx = $x - 1; $xx <= $x + 1; $xx++)
$this->placeBlock($xx, $y + 6, $z + 10, Block::SANDSTONE, 2); $this->placeBlock($xx, $y + 6, $z + 10, Block::SANDSTONE, 2);
for($zz = $z + 6; $zz <= $z + 9; $zz ++) for ($zz = $z + 6; $zz <= $z + 9; $zz++)
for($xx = $x - 2; $xx <= $x + 2; $xx ++) for ($xx = $x - 2; $xx <= $x + 2; $xx++)
$this->placeBlock($xx, $y + 4, $zz); $this->placeBlock($xx, $y + 4, $zz);
break; break;
@ -355,15 +358,15 @@ class Temple extends Object {
$this->placeTower($x + 8, $y, $z - 8, self::DIRECTION_MINZ, self::DIRECTION_PLUSX); $this->placeTower($x + 8, $y, $z - 8, self::DIRECTION_MINZ, self::DIRECTION_PLUSX);
$this->placeTower($x - 8, $y, $z - 8, self::DIRECTION_MINZ, self::DIRECTION_MINX); $this->placeTower($x - 8, $y, $z - 8, self::DIRECTION_MINZ, self::DIRECTION_MINX);
// Creating rectangular parallelepiped of sandstone. // Creating rectangular parallelepiped of sandstone.
BuildingUtils::fill($level, new Vector3($x - 6, $y + 1, $z - 6 ), new Vector3($x + 6, $y + 4, $z - 9 ), Block::get(Block::SANDSTONE )); BuildingUtils::fill($level, new Vector3($x - 6, $y + 1, $z - 6), new Vector3($x + 6, $y + 4, $z - 9), Block::get(Block::SANDSTONE));
// Creating a path to the entrance // Creating a path to the entrance
BuildingUtils::fill($level, new Vector3($x - 1, $y + 1, $z - 6 ), new Vector3($x + 1, $y + 4, $z - 9 ), Block::get(Block::AIR )); BuildingUtils::fill($level, new Vector3($x - 1, $y + 1, $z - 6), new Vector3($x + 1, $y + 4, $z - 9), Block::get(Block::AIR));
// Creating path to towers. // Creating path to towers.
for($yy = $y + 1; $yy <= $y + 2; $yy ++) for ($yy = $y + 1; $yy <= $y + 2; $yy++)
for($xx = $x - 6; $xx <= $x + 6; $xx ++) for ($xx = $x - 6; $xx <= $x + 6; $xx++)
$this->placeBlock($xx, $yy, $z - 8, 0); $this->placeBlock($xx, $yy, $z - 8, 0);
// Door additional blocks // Door additional blocks
for($yy = $y + 1; $yy <= $y + 4; $yy ++) { for ($yy = $y + 1; $yy <= $y + 4; $yy++) {
$this->placeBlock($x - 2, $yy, $z - 6); $this->placeBlock($x - 2, $yy, $z - 6);
$this->placeBlock($x + 2, $yy, $z - 6); $this->placeBlock($x + 2, $yy, $z - 6);
// Polished entrance // Polished entrance
@ -375,17 +378,17 @@ class Temple extends Object {
} }
// Finishing entrance structure // Finishing entrance structure
$this->placeBlock($x, $y + 3, $z - 9, Block::SANDSTONE, 2); $this->placeBlock($x, $y + 3, $z - 9, Block::SANDSTONE, 2);
for($xx = $x - 2; $xx <= $x + 2; $xx ++) for ($xx = $x - 2; $xx <= $x + 2; $xx++)
$this->placeBlock($xx, $y + 4, $z - 10, Block::SANDSTONE, 2); $this->placeBlock($xx, $y + 4, $z - 10, Block::SANDSTONE, 2);
$this->placeBlock($x, $y + 5, $z - 10, Block::SANDSTONE, 1); $this->placeBlock($x, $y + 5, $z - 10, Block::SANDSTONE, 1);
$this->placeBlock($x - 1, $y + 5, $z - 10, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 1, $y + 5, $z - 10, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 1, $y + 5, $z - 10, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 1, $y + 5, $z - 10, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 2, $y + 5, $z - 10, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + 5, $z - 10, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + 5, $z - 10, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + 5, $z - 10, Block::SANDSTONE, 2);
for($xx = $x - 1; $xx <= $x + 1; $xx ++) for ($xx = $x - 1; $xx <= $x + 1; $xx++)
$this->placeBlock($xx, $y + 6, $z - 10, Block::SANDSTONE, 2); $this->placeBlock($xx, $y + 6, $z - 10, Block::SANDSTONE, 2);
for($zz = $z - 6; $zz >= $z - 9; $zz --) for ($zz = $z - 6; $zz >= $z - 9; $zz--)
for($xx = $x - 2; $xx <= $x + 2; $xx ++) for ($xx = $x - 2; $xx <= $x + 2; $xx++)
$this->placeBlock($xx, $y + 4, $zz); $this->placeBlock($xx, $y + 4, $zz);
break; break;
} }
@ -398,9 +401,10 @@ class Temple extends Object {
* @param $z int * @param $z int
* @return void * @return void
*/ */
protected function placeSlab($x, $y, $z) {
$this->level->setBlockIdAt($x, $y, $z, 44); protected function placeBlock($x, $y, $z, $id = Block::SANDSTONE, $meta = 0) {
$this->level->setBlockDataAt($x, $y, $z, 1); $this->level->setBlockIdAt($x, $y, $z, $id);
$this->level->setBlockDataAt($x, $y, $z, $meta);
} }
/* /*
@ -412,28 +416,15 @@ class Temple extends Object {
* @param $meta int * @param $meta int
* @return void * @return void
*/ */
protected function placeBlock($x, $y, $z, $id = Block::SANDSTONE, $meta = 0) {
$this->level->setBlockIdAt($x, $y, $z, $id);
$this->level->setBlockDataAt($x, $y, $z, $meta);
}
/*
* Places one of the towers. Out is inversed $direction1, stairs come from inversed $direction2 to $direction2, patterns are on $direction1 and $direction2
* @param $x int
* @param $y int
* @param $z int
* @param $direction1 int
* @param $direction2 int
* @return void
*/
public function placeTower($x, $y, $z, $direction1 = self::DIRECTION_PLUSX, $direction2 = self::DIRECTION_PLUSZ) { public function placeTower($x, $y, $z, $direction1 = self::DIRECTION_PLUSX, $direction2 = self::DIRECTION_PLUSZ) {
BuildingUtils::walls($this->level, new Vector3($x + 2, $y, $z + 2 ), new Vector3($x - 2, $y + 8, $z - 2 ), Block::get(Block::SANDSTONE )); BuildingUtils::walls($this->level, new Vector3($x + 2, $y, $z + 2), new Vector3($x - 2, $y + 8, $z - 2), Block::get(Block::SANDSTONE));
switch ($direction1) { switch ($direction1) {
case self::DIRECTION_PLUSX : // x+ (0) case self::DIRECTION_PLUSX : // x+ (0)
// Stairs // Stairs
switch ($direction2) { switch ($direction2) {
case self::DIRECTION_PLUSZ : case self::DIRECTION_PLUSZ :
for($zz = $z + 1; $zz >= $z; $zz --) { for ($zz = $z + 1; $zz >= $z; $zz--) {
$this->placeBlock($x - 1, $y + 1, $zz); $this->placeBlock($x - 1, $y + 1, $zz);
$this->placeBlock($x - 1, $y + 2, $zz); $this->placeBlock($x - 1, $y + 2, $zz);
} }
@ -441,19 +432,19 @@ class Temple extends Object {
$this->placeBlock($x, $y + 1, $z + 1); $this->placeBlock($x, $y + 1, $z + 1);
$this->placeSlab($x, $y + 2, $z + 1); $this->placeSlab($x, $y + 2, $z + 1);
// Pattern // Pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x - 1, $y + $h, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x - 1, $y + $h, $z + 2, Block::SANDSTONE, 2);
$this->placeBlock($x + 1, $y + $h, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x + 1, $y + $h, $z + 2, Block::SANDSTONE, 2);
$this->placeBlock($x, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x - 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x, $y + $h, $z + 2, Block::SANDSTONE, 1); $this->placeBlock($x, $y + $h, $z + 2, Block::SANDSTONE, 1);
@ -466,11 +457,11 @@ class Temple extends Object {
$this->placeBlock($x + 1, $y + 7, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x + 1, $y + 7, $z + 2, Block::SANDSTONE, 2);
// Building entrance to second floor. // Building entrance to second floor.
BuildingUtils::fill($this->level, new Vector3($x - 9, $y + 5, $z - 4 ), new Vector3($x - 7, $y + 7, $z - 5 ), Block::get(Block::SANDSTONE, 2 )); BuildingUtils::fill($this->level, new Vector3($x - 9, $y + 5, $z - 4), new Vector3($x - 7, $y + 7, $z - 5), Block::get(Block::SANDSTONE, 2));
BuildingUtils::fill($this->level, new Vector3($x - 8, $y + 5, $z - 4 ), new Vector3($x - 8, $y + 6, $z - 5 ), Block::get(Block::AIR )); BuildingUtils::fill($this->level, new Vector3($x - 8, $y + 5, $z - 4), new Vector3($x - 8, $y + 6, $z - 5), Block::get(Block::AIR));
break; break;
case self::DIRECTION_MINZ : case self::DIRECTION_MINZ :
for($zz = $z - 1; $zz <= $z; $zz ++) { for ($zz = $z - 1; $zz <= $z; $zz++) {
$this->placeBlock($x - 1, $y + 1, $zz); $this->placeBlock($x - 1, $y + 1, $zz);
$this->placeBlock($x - 1, $y + 2, $zz); $this->placeBlock($x - 1, $y + 2, $zz);
} }
@ -478,19 +469,19 @@ class Temple extends Object {
$this->placeBlock($x, $y + 1, $z - 1); $this->placeBlock($x, $y + 1, $z - 1);
$this->placeSlab($x, $y + 2, $z - 1); $this->placeSlab($x, $y + 2, $z - 1);
// Pattern // Pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x - 1, $y + $h, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($x - 1, $y + $h, $z - 2, Block::SANDSTONE, 2);
$this->placeBlock($x + 1, $y + $h, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($x + 1, $y + $h, $z - 2, Block::SANDSTONE, 2);
$this->placeBlock($x, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x - 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x, $y + $h, $z - 2, Block::SANDSTONE, 1); $this->placeBlock($x, $y + $h, $z - 2, Block::SANDSTONE, 1);
@ -505,8 +496,8 @@ class Temple extends Object {
} }
// Building entrance to second floor. // Building entrance to second floor.
BuildingUtils::fill($this->level, new Vector3($x - 9, $y + 5, $z + 4 ), new Vector3($x - 7, $y + 7, $z + 5 ), Block::get(Block::SANDSTONE, 2 )); BuildingUtils::fill($this->level, new Vector3($x - 9, $y + 5, $z + 4), new Vector3($x - 7, $y + 7, $z + 5), Block::get(Block::SANDSTONE, 2));
BuildingUtils::fill($this->level, new Vector3($x - 8, $y + 5, $z + 4 ), new Vector3($x - 8, $y + 6, $z + 5 ), Block::get(Block::AIR )); BuildingUtils::fill($this->level, new Vector3($x - 8, $y + 5, $z + 4), new Vector3($x - 8, $y + 6, $z + 5), Block::get(Block::AIR));
// Finishing stairs system // Finishing stairs system
$this->placeBlock($x - 2, $y + 3, $z, Block::SANDSTONE_STAIRS, 1); $this->placeBlock($x - 2, $y + 3, $z, Block::SANDSTONE_STAIRS, 1);
@ -515,22 +506,22 @@ class Temple extends Object {
$this->placeBlock($x - 2, $y + 5, $z, Block::AIR); $this->placeBlock($x - 2, $y + 5, $z, Block::AIR);
$this->placeBlock($x - 2, $y + 6, $z, Block::AIR); $this->placeBlock($x - 2, $y + 6, $z, Block::AIR);
// Making path from stairs to first floor. // Making path from stairs to first floor.
BuildingUtils::fill($this->level, new Vector3($x - 4, $y, $z + 2 ), new Vector3($x - 9, $y + 4, $z - 2 ), Block::get(Block::SANDSTONE )); BuildingUtils::fill($this->level, new Vector3($x - 4, $y, $z + 2), new Vector3($x - 9, $y + 4, $z - 2), Block::get(Block::SANDSTONE));
// Other side pattern // Other side pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x + 2, $y + $h, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + $h, $z + 1, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + $h, $z - 1, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + $h, $z - 1, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x + 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 2, $y + $h, $z, Block::SANDSTONE, 1); $this->placeBlock($x + 2, $y + $h, $z, Block::SANDSTONE, 1);
@ -547,7 +538,7 @@ class Temple extends Object {
// Stairs // Stairs
switch ($direction2) { switch ($direction2) {
case self::DIRECTION_PLUSZ : case self::DIRECTION_PLUSZ :
for($zz = $z + 1; $zz >= $z; $zz --) { for ($zz = $z + 1; $zz >= $z; $zz--) {
$this->placeBlock($x + 1, $y + 1, $zz); $this->placeBlock($x + 1, $y + 1, $zz);
$this->placeBlock($x + 1, $y + 2, $zz); $this->placeBlock($x + 1, $y + 2, $zz);
} }
@ -555,19 +546,19 @@ class Temple extends Object {
$this->placeBlock($x, $y + 1, $z + 1); $this->placeBlock($x, $y + 1, $z + 1);
$this->placeSlab($x, $y + 2, $z + 1); $this->placeSlab($x, $y + 2, $z + 1);
// Pattern // Pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x + 1, $y + $h, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x + 1, $y + $h, $z + 2, Block::SANDSTONE, 2);
$this->placeBlock($x - 1, $y + $h, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x - 1, $y + $h, $z + 2, Block::SANDSTONE, 2);
$this->placeBlock($x, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x + 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x, $y + $h, $z + 2, Block::SANDSTONE, 1); $this->placeBlock($x, $y + $h, $z + 2, Block::SANDSTONE, 1);
@ -580,11 +571,11 @@ class Temple extends Object {
$this->placeBlock($x + 1, $y + 7, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x + 1, $y + 7, $z + 2, Block::SANDSTONE, 2);
// Building entrance to second floor. // Building entrance to second floor.
BuildingUtils::fill($this->level, new Vector3($x + 9, $y + 5, $z - 4 ), new Vector3($x + 7, $y + 7, $z - 5 ), Block::get(Block::SANDSTONE, 2 )); BuildingUtils::fill($this->level, new Vector3($x + 9, $y + 5, $z - 4), new Vector3($x + 7, $y + 7, $z - 5), Block::get(Block::SANDSTONE, 2));
BuildingUtils::fill($this->level, new Vector3($x + 8, $y + 5, $z - 4 ), new Vector3($x + 8, $y + 6, $z - 5 ), Block::get(Block::AIR )); BuildingUtils::fill($this->level, new Vector3($x + 8, $y + 5, $z - 4), new Vector3($x + 8, $y + 6, $z - 5), Block::get(Block::AIR));
break; break;
case self::DIRECTION_MINZ : case self::DIRECTION_MINZ :
for($zz = $z - 1; $zz <= $z; $zz ++) { for ($zz = $z - 1; $zz <= $z; $zz++) {
$this->placeBlock($x + 1, $y + 1, $zz); $this->placeBlock($x + 1, $y + 1, $zz);
$this->placeBlock($x + 1, $y + 2, $zz); $this->placeBlock($x + 1, $y + 2, $zz);
} }
@ -592,19 +583,19 @@ class Temple extends Object {
$this->placeBlock($x, $y + 1, $z - 1); $this->placeBlock($x, $y + 1, $z - 1);
$this->placeSlab($x, $y + 2, $z - 1); $this->placeSlab($x, $y + 2, $z - 1);
// Pattern // Pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x + 1, $y + $h, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($x + 1, $y + $h, $z - 2, Block::SANDSTONE, 2);
$this->placeBlock($x - 1, $y + $h, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($x - 1, $y + $h, $z - 2, Block::SANDSTONE, 2);
$this->placeBlock($x, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x + 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x, $y + $h, $z - 2, Block::SANDSTONE, 1); $this->placeBlock($x, $y + $h, $z - 2, Block::SANDSTONE, 1);
@ -617,8 +608,8 @@ class Temple extends Object {
$this->placeBlock($x + 1, $y + 6, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($x + 1, $y + 6, $z - 2, Block::SANDSTONE, 2);
// Building entrance to second floor. // Building entrance to second floor.
BuildingUtils::fill($this->level, new Vector3($x + 9, $y + 5, $z + 4 ), new Vector3($x + 7, $y + 7, $z + 5 ), Block::get(Block::SANDSTONE, 2 )); BuildingUtils::fill($this->level, new Vector3($x + 9, $y + 5, $z + 4), new Vector3($x + 7, $y + 7, $z + 5), Block::get(Block::SANDSTONE, 2));
BuildingUtils::fill($this->level, new Vector3($x + 8, $y + 5, $z + 4 ), new Vector3($x + 8, $y + 6, $z + 5 ), Block::get(Block::AIR )); BuildingUtils::fill($this->level, new Vector3($x + 8, $y + 5, $z + 4), new Vector3($x + 8, $y + 6, $z + 5), Block::get(Block::AIR));
break; break;
} }
@ -629,22 +620,22 @@ class Temple extends Object {
$this->placeBlock($x + 2, $y + 5, $z, Block::AIR); $this->placeBlock($x + 2, $y + 5, $z, Block::AIR);
$this->placeBlock($x + 2, $y + 6, $z, Block::AIR); $this->placeBlock($x + 2, $y + 6, $z, Block::AIR);
// Making path from stairs to first floor. // Making path from stairs to first floor.
BuildingUtils::fill($this->level, new Vector3($x + 4, $y, $z + 2 ), new Vector3($x + 9, $y + 4, $z - 2 ), Block::get(Block::SANDSTONE )); BuildingUtils::fill($this->level, new Vector3($x + 4, $y, $z + 2), new Vector3($x + 9, $y + 4, $z - 2), Block::get(Block::SANDSTONE));
// Other side pattern // Other side pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x - 2, $y + $h, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + $h, $z + 1, Block::SANDSTONE, 2);
$this->placeBlock($x - 2, $y + $h, $z - 1, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + $h, $z - 1, Block::SANDSTONE, 2);
$this->placeBlock($x - 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x - 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 2, $y + $h, $z, Block::SANDSTONE, 1); $this->placeBlock($x - 2, $y + $h, $z, Block::SANDSTONE, 1);
@ -661,7 +652,7 @@ class Temple extends Object {
// Stairs // Stairs
switch ($direction2) { switch ($direction2) {
case self::DIRECTION_PLUSX : case self::DIRECTION_PLUSX :
for($xx = $x + 1; $xx >= $x; $xx --) { for ($xx = $x + 1; $xx >= $x; $xx--) {
$this->placeBlock($xx, $y + 1, $z - 1); $this->placeBlock($xx, $y + 1, $z - 1);
$this->placeBlock($xx, $y + 2, $z - 1); $this->placeBlock($xx, $y + 2, $z - 1);
} }
@ -669,19 +660,19 @@ class Temple extends Object {
$this->placeBlock($x + 1, $y + 1, $z); $this->placeBlock($x + 1, $y + 1, $z);
$this->placeSlab($x + 1, $y + 2, $z); $this->placeSlab($x + 1, $y + 2, $z);
// Pattern // Pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x + 2, $y + $h, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + $h, $z + 1, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + $h, $z - 1, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + $h, $z - 1, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x + 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 2, $y + $h, $z, Block::SANDSTONE, 1); $this->placeBlock($x + 2, $y + $h, $z, Block::SANDSTONE, 1);
@ -693,11 +684,11 @@ class Temple extends Object {
$this->placeBlock($x + 2, $y + 7, $z, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + 7, $z, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + 7, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + 7, $z + 1, Block::SANDSTONE, 2);
// Building entrance to second floor. // Building entrance to second floor.
BuildingUtils::fill($this->level, new Vector3($x - 4, $y + 5, $z - 9 ), new Vector3($x - 5, $y + 7, $z - 7 ), Block::get(Block::SANDSTONE, 2 )); BuildingUtils::fill($this->level, new Vector3($x - 4, $y + 5, $z - 9), new Vector3($x - 5, $y + 7, $z - 7), Block::get(Block::SANDSTONE, 2));
BuildingUtils::fill($this->level, new Vector3($x - 4, $y + 5, $z - 8 ), new Vector3($x - 5, $y + 6, $z - 8 ), Block::get(Block::AIR )); BuildingUtils::fill($this->level, new Vector3($x - 4, $y + 5, $z - 8), new Vector3($x - 5, $y + 6, $z - 8), Block::get(Block::AIR));
break; break;
case self::DIRECTION_MINX : case self::DIRECTION_MINX :
for($xx = $x - 1; $xx <= $x; $xx ++) { for ($xx = $x - 1; $xx <= $x; $xx++) {
$this->placeBlock($xx, $y + 1, $z - 1); $this->placeBlock($xx, $y + 1, $z - 1);
$this->placeBlock($xx, $y + 2, $z - 1); $this->placeBlock($xx, $y + 2, $z - 1);
} }
@ -705,19 +696,19 @@ class Temple extends Object {
$this->placeBlock($x - 1, $y + 1, $z); $this->placeBlock($x - 1, $y + 1, $z);
$this->placeSlab($x - 1, $y + 2, $z); $this->placeSlab($x - 1, $y + 2, $z);
// Pattern // Pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x - 2, $y + $h, $z - 1, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + $h, $z - 1, Block::SANDSTONE, 2);
$this->placeBlock($x - 2, $y + $h, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + $h, $z + 1, Block::SANDSTONE, 2);
$this->placeBlock($x - 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x - 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 2, $y + $h, $z, Block::SANDSTONE, 1); $this->placeBlock($x - 2, $y + $h, $z, Block::SANDSTONE, 1);
@ -729,8 +720,8 @@ class Temple extends Object {
$this->placeBlock($x - 2, $y + 7, $z, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + 7, $z, Block::SANDSTONE, 2);
$this->placeBlock($x - 2, $y + 7, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + 7, $z + 1, Block::SANDSTONE, 2);
// Building entrance to second floor. // Building entrance to second floor.
BuildingUtils::fill($this->level, new Vector3($x + 4, $y + 5, $z - 9 ), new Vector3($x + 5, $y + 7, $z - 7 ), Block::get(Block::SANDSTONE, 2 )); BuildingUtils::fill($this->level, new Vector3($x + 4, $y + 5, $z - 9), new Vector3($x + 5, $y + 7, $z - 7), Block::get(Block::SANDSTONE, 2));
BuildingUtils::fill($this->level, new Vector3($x + 4, $y + 5, $z - 8 ), new Vector3($x + 5, $y + 6, $z - 8 ), Block::get(Block::AIR )); BuildingUtils::fill($this->level, new Vector3($x + 4, $y + 5, $z - 8), new Vector3($x + 5, $y + 6, $z - 8), Block::get(Block::AIR));
break; break;
} }
@ -741,22 +732,22 @@ class Temple extends Object {
$this->placeBlock($x, $y + 5, $z - 2, Block::AIR); $this->placeBlock($x, $y + 5, $z - 2, Block::AIR);
$this->placeBlock($x, $y + 6, $z - 2, Block::AIR); $this->placeBlock($x, $y + 6, $z - 2, Block::AIR);
// Making path from stairs to first floor. // Making path from stairs to first floor.
BuildingUtils::fill($this->level, new Vector3($x + 2, $y, $z - 4 ), new Vector3($x - 2, $y + 4, $z - 9 ), Block::get(Block::SANDSTONE )); BuildingUtils::fill($this->level, new Vector3($x + 2, $y, $z - 4), new Vector3($x - 2, $y + 4, $z - 9), Block::get(Block::SANDSTONE));
// Other side pattern // Other side pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x + 1, $y + $h, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x + 1, $y + $h, $z + 2, Block::SANDSTONE, 2);
$this->placeBlock($x - 1, $y + $h, $z + 2, Block::SANDSTONE, 2); $this->placeBlock($x - 1, $y + $h, $z + 2, Block::SANDSTONE, 2);
$this->placeBlock($x, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x + 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 1, $y + $h, $z + 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x, $y + $h, $z + 2, Block::SANDSTONE, 1); $this->placeBlock($x, $y + $h, $z + 2, Block::SANDSTONE, 1);
@ -773,7 +764,7 @@ class Temple extends Object {
// Stairs // Stairs
switch ($direction2) { switch ($direction2) {
case self::DIRECTION_PLUSX : case self::DIRECTION_PLUSX :
for($xx = $x + 1; $xx >= $x; $xx --) { for ($xx = $x + 1; $xx >= $x; $xx--) {
$this->placeBlock($xx, $y + 1, $z + 1); $this->placeBlock($xx, $y + 1, $z + 1);
$this->placeBlock($xx, $y + 2, $z + 1); $this->placeBlock($xx, $y + 2, $z + 1);
} }
@ -781,19 +772,19 @@ class Temple extends Object {
$this->placeBlock($x + 1, $y + 1, $z); $this->placeBlock($x + 1, $y + 1, $z);
$this->placeSlab($x + 1, $y + 2, $z); $this->placeSlab($x + 1, $y + 2, $z);
// Pattern // Pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x + 2, $y + $h, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + $h, $z + 1, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + $h, $z - 1, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + $h, $z - 1, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x + 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x + 2, $y + $h, $z, Block::SANDSTONE, 1); $this->placeBlock($x + 2, $y + $h, $z, Block::SANDSTONE, 1);
@ -805,11 +796,11 @@ class Temple extends Object {
$this->placeBlock($x + 2, $y + 7, $z, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + 7, $z, Block::SANDSTONE, 2);
$this->placeBlock($x + 2, $y + 7, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x + 2, $y + 7, $z + 1, Block::SANDSTONE, 2);
// Building entrance to second floor. // Building entrance to second floor.
BuildingUtils::fill($this->level, new Vector3($x - 4, $y + 5, $z + 9 ), new Vector3($x - 5, $y + 7, $z + 7 ), Block::get(Block::SANDSTONE, 2 )); BuildingUtils::fill($this->level, new Vector3($x - 4, $y + 5, $z + 9), new Vector3($x - 5, $y + 7, $z + 7), Block::get(Block::SANDSTONE, 2));
BuildingUtils::fill($this->level, new Vector3($x - 4, $y + 5, $z + 8 ), new Vector3($x - 5, $y + 6, $z + 8 ), Block::get(Block::AIR )); BuildingUtils::fill($this->level, new Vector3($x - 4, $y + 5, $z + 8), new Vector3($x - 5, $y + 6, $z + 8), Block::get(Block::AIR));
break; break;
case self::DIRECTION_MINX : case self::DIRECTION_MINX :
for($xx = $x - 1; $xx <= $x; $xx ++) { for ($xx = $x - 1; $xx <= $x; $xx++) {
$this->placeBlock($xx, $y + 1, $z + 1); $this->placeBlock($xx, $y + 1, $z + 1);
$this->placeBlock($xx, $y + 2, $z + 1); $this->placeBlock($xx, $y + 2, $z + 1);
} }
@ -817,19 +808,19 @@ class Temple extends Object {
$this->placeBlock($x - 1, $y + 1, $z); $this->placeBlock($x - 1, $y + 1, $z);
$this->placeSlab($x - 1, $y + 2, $z); $this->placeSlab($x - 1, $y + 2, $z);
// Pattern // Pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x - 2, $y + $h, $z - 1, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + $h, $z - 1, Block::SANDSTONE, 2);
$this->placeBlock($x - 2, $y + $h, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + $h, $z + 1, Block::SANDSTONE, 2);
$this->placeBlock($x - 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 2, $y + $h, $z, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x - 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 2, $y + $h, $z - 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 2, $y + $h, $z + 1, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 2, $y + $h, $z, Block::SANDSTONE, 1); $this->placeBlock($x - 2, $y + $h, $z, Block::SANDSTONE, 1);
@ -841,8 +832,8 @@ class Temple extends Object {
$this->placeBlock($x - 2, $y + 7, $z, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + 7, $z, Block::SANDSTONE, 2);
$this->placeBlock($x - 2, $y + 7, $z + 1, Block::SANDSTONE, 2); $this->placeBlock($x - 2, $y + 7, $z + 1, Block::SANDSTONE, 2);
// Building entrance to second floor. // Building entrance to second floor.
BuildingUtils::fill($this->level, new Vector3($x + 4, $y + 5, $z + 9 ), new Vector3($x + 5, $y + 7, $z + 7 ), Block::get(Block::SANDSTONE, 2 )); BuildingUtils::fill($this->level, new Vector3($x + 4, $y + 5, $z + 9), new Vector3($x + 5, $y + 7, $z + 7), Block::get(Block::SANDSTONE, 2));
BuildingUtils::fill($this->level, new Vector3($x + 4, $y + 5, $z + 8 ), new Vector3($x + 5, $y + 6, $z + 8 ), Block::get(Block::AIR )); BuildingUtils::fill($this->level, new Vector3($x + 4, $y + 5, $z + 8), new Vector3($x + 5, $y + 6, $z + 8), Block::get(Block::AIR));
break; break;
} }
@ -853,22 +844,22 @@ class Temple extends Object {
$this->placeBlock($x, $y + 5, $z + 2, Block::AIR); $this->placeBlock($x, $y + 5, $z + 2, Block::AIR);
$this->placeBlock($x, $y + 6, $z + 2, Block::AIR); $this->placeBlock($x, $y + 6, $z + 2, Block::AIR);
// Making path from stairs to first floor. // Making path from stairs to first floor.
BuildingUtils::fill($this->level, new Vector3($x + 2, $y, $z + 4 ), new Vector3($x - 2, $y + 4, $z + 9 ), Block::get(Block::SANDSTONE )); BuildingUtils::fill($this->level, new Vector3($x + 2, $y, $z + 4), new Vector3($x - 2, $y + 4, $z + 9), Block::get(Block::SANDSTONE));
// Other side pattern // Other side pattern
foreach([ foreach ([
1, 1,
2, 2,
4 4
] as $h ) { ] as $h) {
$this->placeBlock($x + 1, $y + $h, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($x + 1, $y + $h, $z - 2, Block::SANDSTONE, 2);
$this->placeBlock($x - 1, $y + $h, $z - 2, Block::SANDSTONE, 2); $this->placeBlock($x - 1, $y + $h, $z - 2, Block::SANDSTONE, 2);
$this->placeBlock($x, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1);
} }
foreach([ foreach ([
3, 3,
5 5
] as $h ) { ] as $h) {
$this->placeBlock($x + 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x + 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x - 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1); $this->placeBlock($x - 1, $y + $h, $z - 2, Block::STAINED_HARDENED_CLAY, 1);
$this->placeBlock($x, $y + $h, $z - 2, Block::SANDSTONE, 1); $this->placeBlock($x, $y + $h, $z - 2, Block::SANDSTONE, 1);
@ -883,18 +874,34 @@ class Temple extends Object {
} }
// Making top // Making top
BuildingUtils::top($this->level, new Vector3($x - 1, $y + 9, $z - 1 ), new Vector3($x + 1, $y, $z + 1 ), Block::get(Block::SANDSTONE )); BuildingUtils::top($this->level, new Vector3($x - 1, $y + 9, $z - 1), new Vector3($x + 1, $y, $z + 1), Block::get(Block::SANDSTONE));
$this->placeBlock($x - 2, $y + 9, $z, Block::SANDSTONE_STAIRS, 0); $this->placeBlock($x - 2, $y + 9, $z, Block::SANDSTONE_STAIRS, 0);
$this->placeBlock($x + 2, $y + 9, $z, Block::SANDSTONE_STAIRS, 1); $this->placeBlock($x + 2, $y + 9, $z, Block::SANDSTONE_STAIRS, 1);
$this->placeBlock($x, $y + 9, $z - 2, Block::SANDSTONE_STAIRS, 2); $this->placeBlock($x, $y + 9, $z - 2, Block::SANDSTONE_STAIRS, 2);
$this->placeBlock($x, $y + 9, $z + 2, Block::SANDSTONE_STAIRS, 3); $this->placeBlock($x, $y + 9, $z + 2, Block::SANDSTONE_STAIRS, 3);
} }
/*
* Places one of the towers. Out is inversed $direction1, stairs come from inversed $direction2 to $direction2, patterns are on $direction1 and $direction2
* @param $x int
* @param $y int
* @param $z int
* @param $direction1 int
* @param $direction2 int
* @return void
*/
protected function placeSlab($x, $y, $z) {
$this->level->setBlockIdAt($x, $y, $z, 44);
$this->level->setBlockDataAt($x, $y, $z, 1);
}
/* /*
* Inverses a direction * Inverses a direction
* @param $direction int * @param $direction int
* @return int * @return int
*/ */
protected function getInversedDirection(int $direction): int { protected function getInversedDirection(int $direction): int {
switch ($direction) { switch ($direction) {
case self::DIRECTION_PLUSX : // x+ (0) case self::DIRECTION_PLUSX : // x+ (0)
@ -910,7 +917,7 @@ class Temple extends Object {
return self::DIRECTION_PLUSZ; return self::DIRECTION_PLUSZ;
break; break;
default : default :
return - 1; return -1;
break; break;
} }
} }