Correct slab placement

This commit is contained in:
Shoghi Cervantes Pueyo 2012-12-24 14:02:04 +01:00
parent c3eec804f0
commit f2868f386e
3 changed files with 19 additions and 5 deletions

View File

@ -8,7 +8,6 @@ __Check Milestones [here](https://github.com/shoghicp/PocketMine-MP/issues/miles
## Alpha (full Creative)
- Block Updates
- Random Chunk Updates
- Placing Half Slabs
- Water/lava spread
- Opening/closing doors, fence gates, trapdoors (reflect it to all players)
- Fix spawn position resetting

View File

@ -119,7 +119,21 @@ class BlockAPI{
return;
}
//if(!isset(Material::$replaceable[$target[0]])){
$replace = false;
switch($target[0]){
case 44: //Slabs
if($data["face"] !== 1){
break;
}
if(($target[1] & 0x07) === ($data["meta"] & 0x07)){
$replace = true;
$data["block"] = 43;
$data["meta"] = $data["meta"] & 0x07;
}
break;
}
if($replace === false){
switch($data["face"]){
case 0:
--$data["y"];
@ -140,14 +154,15 @@ class BlockAPI{
++$data["x"];
break;
}
//}
}
if($data["y"] >= 127){
return;
}
$block = $this->server->api->level->getBlock($data["x"], $data["y"], $data["z"]);
if(!isset(Material::$replaceable[$block[0]])){
if($replace === false and !isset(Material::$replaceable[$block[0]])){
return;
}

View File

@ -297,7 +297,7 @@ class Player{
break;
case MC_REQUEST_CHUNK:
$this->actionQueue('
$max = floor(($this->MTU - 16 - 255) / 192);
$max = max(1, floor(($this->MTU - 16 - 255) / 192) - 1);
$chunk = $this->server->api->level->getOrderedChunk('.$data["x"].', '.$data["z"].', $max);
foreach($chunk as $d){
$this->dataPacket(MC_CHUNK_DATA, array(