diff --git a/TODO.md b/TODO.md index 62e71ed9..889b3c00 100644 --- a/TODO.md +++ b/TODO.md @@ -10,26 +10,20 @@ __Check Milestones [here](https://github.com/shoghicp/PocketMine-MP/issues/miles - Random Chunk Updates - Placing Half Slabs - Water/lava spread -- Door,trapdoor,torch,stair,ladder,fence gate placement/orientation (+should need ground/wall beneath) -- Opening/closing doors,fence gates,trapdoors (Not placing block in hand when hitting doors/fence gates/trapdoors to open/close them) -- Building off the side of one block/object not replacing the block/object next to it (i.e. try placing a block on the side of a torch, when the torch is already beside a different block) +- Door, trapdoor, stair, fence gate placement/orientation (+should need ground/wall beneath) +- Opening/closing doors, fence gates, trapdoors (reflect it to all players) - Fix spawn position resetting -- Ladders not turning into signs -- Correct block placement for items like beds and doors. +- Correct block placement for beds - Blocks broken to not make drops in creative mode -- Bonemeal use not creating invisible blocks -- Hoe use not spawning glitchy "update!" blocks, hoes tilling dirt -- Bow use not spawning wood blocks -- Sword use not spawning lava blocks +- Bonemeal use +- Hoes tilling dirt - Players can often hear "echos" of their own block interactions' SFX (torch placed, block destroyed, etc. most noticeable when moving around as you place.) - BUG? Breaking redstone ore blocks not dropping TONS of redstone ore blocks (One-time occurrence... can't reproduce XD;) - Redstone ore blocks lighting up upon hit or contact -- Cactus placement requirements (needs open blocks beside, sand below) -- Sapling/flower placement requirements +- Cactus placement requirements (needs open blocks beside) +- Sapling / flower placement requirements - Mushroom placement requirements - Reed placement requirements -- Wheat seeds not becoming brown mushrooms + placement requirements -- Melon seeds not becoming the glitchy "update!" block + placement requirements ## Beta (Survival) - Mob spawning, item pick up diff --git a/classes/API/BlockAPI.php b/classes/API/BlockAPI.php index a580aa26..ef1191ba 100644 --- a/classes/API/BlockAPI.php +++ b/classes/API/BlockAPI.php @@ -100,9 +100,27 @@ class BlockAPI{ $entity = $this->server->api->entity->get($this->eid); switch($data["block"]){ + case 50: //Torch + if(isset(Material::$transparent[$target[0]])){ + return; + } + $faces = array( + 0 => 6, + 1 => 5, + 2 => 4, + 3 => 3, + 4 => 2, + 5 => 1, + ); + if(!isset($faces[$data["face"]])){ + return false; + } + $data["meta"] = $faces[$data["face"]]; + break; case 64://Door placing $blockUp = $this->server->api->level->getBlock($data["x"], $data["y"] + 1, $data["z"]); - if(!isset(Material::$replaceable[$blockUp[0]])){ + $blockDown = $this->server->api->level->getBlock($data["x"], $data["y"] - 1, $data["z"]); + if(!isset(Material::$replaceable[$blockUp[0]]) or isset(Material::$transparent[$blockDown[0]])){ return; }else{ $data2 = $data; @@ -112,6 +130,21 @@ class BlockAPI{ $this->server->handle("player.block.place", $data2); } break; + case 65: //Ladder + if(isset(Material::$transparent[$target[0]])){ + return; + } + $faces = array( + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + ); + if(!isset($faces[$data["face"]])){ + return false; + } + $data["meta"] = $faces[$data["face"]]; + break; case 59://Seeds case 105: $blockDown = $this->server->api->level->getBlock($data["x"], $data["y"] - 1, $data["z"]); diff --git a/classes/Data.class.php b/classes/Data.class.php index fc44cea3..5420c660 100644 --- a/classes/Data.class.php +++ b/classes/Data.class.php @@ -26,6 +26,41 @@ the Free Software Foundation, either version 3 of the License, or */ class Material{ + static $transparent = array( + 0 => true, + 6 => true, + 8 => true, + 9 => true, + 10 => true, + 11 => true, + 18 => true, + 20 => true, + 26 => true, + 30 => true, + 31 => true, + 32 => true, + 37 => true, + 38 => true, + 39 => true, + 40 => true, + 46 => true, + 50 => true, + 51 => true, + 53 => true, + 59 => true, + 65 => true, + 67 => true, + 78 => true, + 79 => true, + 81 => true, + 83 => true, + 89 => true, + 96 => true, + 102 => true, + 105 => true, + 107 => true, + 108 => true, + ); static $replaceable = array( 0 => true, 8 => true,