From bbe7aacfaf5a12b4d217b6f259a90174b44f9bf0 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Sun, 23 Dec 2012 20:28:40 +0100 Subject: [PATCH] Inverted metadata nibbles --- classes/DefaultGenerator.class.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/classes/DefaultGenerator.class.php b/classes/DefaultGenerator.class.php index a1a5f6cbf..40b0adeb6 100644 --- a/classes/DefaultGenerator.class.php +++ b/classes/DefaultGenerator.class.php @@ -47,14 +47,13 @@ class DefaultGenerator{ } private function parsePreset(){ - $preset = explode(";", $this->config["preset"]); $this->structure = array( 0 => "", 1 => "", 2 => str_repeat("\x00", 64), 3 => str_repeat("\x00", 64), ); - + $preset = explode(";", trim($this->config["preset"])); foreach($preset as $i => $data){ $num = 1; if(preg_match('#([a-zA-Z\-_]*)\((.*)\)#', $data, $matches) > 0){ //Property @@ -70,11 +69,10 @@ class DefaultGenerator{ $meta = (int) @array_shift($d); for($j = 0; $j < $num; ++$j){ $this->structure[0] .= chr($block & 0xFF); - $this->structure[1] .= substr(dechex($meta & 0x0F),0,-1); + $this->structure[1] .= substr(dechex($meta & 0x0F), -1); } } - $this->structure[1] = Utils::hexToStr(str_pad($this->structure[1], (strlen($this->structure[1])&0xFE) + 2, "0", STR_PAD_RIGHT)); - + $this->structure[1] = pack("h*", str_pad($this->structure[1], (strlen($this->structure[1])&0xFE) + 2, "0", STR_PAD_RIGHT)); //invert nibbles $this->structure[0] = substr($this->structure[0], 0, 128); $this->structure[1] = substr($this->structure[1], 0, 64); $this->structure[2] = substr($this->structure[2], 0, 64); @@ -92,12 +90,6 @@ class DefaultGenerator{ public function getColumn($x, $z){ $x = (int) $x; $z = (int) $z; - $column = array( - 0 => "", - 1 => "", - 2 => "", - 3 => "", - ); $column = $this->structure; if(floor(sqrt(pow($x - $this->spawn[0], 2) + pow($z - $this->spawn[2], 2))) <= $this->config["spawn-radius"]){ $column[0]{strlen($column[0])-1} = chr($this->config["spawn-surface"]);