diff --git a/src/structure/village/SmallFarmStructure.php b/src/structure/village/SmallFarmStructure.php new file mode 100644 index 00000000..63a1609d --- /dev/null +++ b/src/structure/village/SmallFarmStructure.php @@ -0,0 +1,127 @@ + [ + "WWWWWWW", + "WFFwFFW", + "WFFwFFW", + "WFFwFFW", + "WFFwFFW", + "WFFwFFW", + "WFFwFFW", + "WFFwFFW", + "WWWWWWW", + ] + ]; + + public static function generateCrops(){ + self::$tmpStructure = self::$structure; + $f = Utils::randomFloat(); + if($f <= 0.25){ + self::$tmpStructure[1] = [ + "", + " HH HH ", + " HH HH ", + " HH HH ", + " HH HH ", + " HH HH ", + " HH HH ", + " HH HH ", + "", + ]; + } + elseif($f <= 0.5){ + self::$tmpStructure[1] = [ + "", + " CC CC ", + " CC CC ", + " CC CC ", + " CC CC ", + " CC CC ", + " CC CC ", + " CC CC ", + "", + ]; + } + elseif($f <= 0.75){ + self::$tmpStructure[1] = [ + "", + " PP PP ", + " PP PP ", + " PP PP ", + " PP PP ", + " PP PP ", + " PP PP ", + " PP PP ", + "", + ]; + } + else{ + self::$tmpStructure[1] = [ + "", + " BB BB ", + " BB BB ", + " BB BB ", + " BB BB ", + " BB BB ", + " BB BB ", + " BB BB ", + "", + ]; + } + } + + public static function buildStructure($level, $x, $y, $z){ /*use CENTER positions*/ + self::generateCrops(); + + $offsetX = 0; + $offsetZ = 0; + foreach(self::$tmpStructure 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 + $offsetZ); + switch($char){ + case "W": + $level->setBlockRaw($vector, new WoodBlock()); + break; + case "F": + $level->setBlockRaw($vector, new FarmlandBlock()); + break; + case "w": + $level->setBlockRaw($vector, new WaterBlock()); + break; + + case "H": + $level->setBlockRaw($vector, new WheatBlock()); + break; + case "C": + $level->setBlockRaw($vector, new CarrotBlock()); + break; + case "P": + $level->setBlockRaw($vector, new PotatoBlock()); + break; + case "B": + $level->setBlockRaw($vector, new BeetrootBlock()); + break; + case " ": + $block = $level->getBlock($vector)->getID(); + if($block === AIR){ + break; + } + $level->setBlockRaw($vector, new AirBlock()); + break; + } + ++$offsetX; + } + ++$offsetZ; + $offsetX = 0; + } + $offsetZ = 0; + } + } +} \ No newline at end of file diff --git a/src/structure/village/SmallHouseStructure.php b/src/structure/village/SmallHouseStructure.php index bfbd51a3..578782aa 100644 --- a/src/structure/village/SmallHouseStructure.php +++ b/src/structure/village/SmallHouseStructure.php @@ -16,21 +16,21 @@ class SmallHouseStructure{ "CP PC", "P P", "P P", - "P L P", + "P P", "CPPPC", ], 2 => [ "CP PC", "P P", "G G", - "P L P", + "P P", "CPPPC", ], 3 => [ "CPPPC", "P P", "P P", - "P L P", + "P P", "CPPPC", ], 4 => [ @@ -43,15 +43,12 @@ class SmallHouseStructure{ ]; public static function generateFence(){ - self::$tmpStructure = self::$structure; + self::$tmpStructure = self::$structure; if(Utils::chance(50)){ - self::$tmpStructure[4] = [ - "WWWWW", - "WPPPW", - "WPPPW", - "WPLPW", - "WWWWW", - ]; + self::$tmpStructure[1][3] = "P L P"; + self::$tmpStructure[2][3] = "P L P"; + self::$tmpStructure[3][3] = "P L P"; + self::$tmpStructure[4][3] = "WPLPW"; self::$tmpStructure[5] = [ "FFFFF", "F F", diff --git a/src/structure/village/VillageLibraryStructure.php b/src/structure/village/VillageLibraryStructure.php index f4977e1b..0b709f85 100644 --- a/src/structure/village/VillageLibraryStructure.php +++ b/src/structure/village/VillageLibraryStructure.php @@ -118,8 +118,8 @@ class VillageLibraryStructure{ $level->setBlockRaw($vector, new WoodBlock()); break; case "d": - if($layerCount == 1) $level->setBlockRaw($vector, new DoorBlock(WOODEN_DOOR)); - else $level->setBlockRaw($vector, new DoorBlock(WOODEN_DOOR, 0x08)); + if($layerCount == 1) $level->setBlockRaw($vector, new DoorBlock(64)); + else $level->setBlockRaw($vector, new DoorBlock(64, 0x08)); break; case "G": $level->setBlockRaw($vector, new GlassPaneBlock()); diff --git a/src/structure/village/WoodHutStructure.php b/src/structure/village/WoodHutStructure.php index 26cada61..235fe752 100644 --- a/src/structure/village/WoodHutStructure.php +++ b/src/structure/village/WoodHutStructure.php @@ -79,8 +79,8 @@ class WoodHutStructure{ $level->setBlockRaw($vector, new DirtBlock()); break; case "d": - if($layerCount == 1) $level->setBlockRaw($vector, new DoorBlock(WOODEN_DOOR)); - else $level->setBlockRaw($vector, new DoorBlock(WOODEN_DOOR, 0x08)); + if($layerCount == 1) $level->setBlockRaw($vector, new DoorBlock(64)); + else $level->setBlockRaw($vector, new DoorBlock(64, 0x08)); break; case "G": $level->setBlockRaw($vector, new GlassPaneBlock());