mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
Correct Torch/Ladder placing
This commit is contained in:
parent
bcb65c2960
commit
dfa9f55115
20
TODO.md
20
TODO.md
@ -10,26 +10,20 @@ __Check Milestones [here](https://github.com/shoghicp/PocketMine-MP/issues/miles
|
|||||||
- Random Chunk Updates
|
- Random Chunk Updates
|
||||||
- Placing Half Slabs
|
- Placing Half Slabs
|
||||||
- Water/lava spread
|
- Water/lava spread
|
||||||
- Door,trapdoor,torch,stair,ladder,fence gate placement/orientation (+should need ground/wall beneath)
|
- Door, trapdoor, stair, 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)
|
- Opening/closing doors, fence gates, trapdoors (reflect it to all players)
|
||||||
- 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)
|
|
||||||
- Fix spawn position resetting
|
- Fix spawn position resetting
|
||||||
- Ladders not turning into signs
|
- Correct block placement for beds
|
||||||
- Correct block placement for items like beds and doors.
|
|
||||||
- Blocks broken to not make drops in creative mode
|
- Blocks broken to not make drops in creative mode
|
||||||
- Bonemeal use not creating invisible blocks
|
- Bonemeal use
|
||||||
- Hoe use not spawning glitchy "update!" blocks, hoes tilling dirt
|
- Hoes tilling dirt
|
||||||
- Bow use not spawning wood blocks
|
|
||||||
- Sword use not spawning lava blocks
|
|
||||||
- Players can often hear "echos" of their own block interactions' SFX (torch placed, block destroyed, etc. most noticeable when moving around as you place.)
|
- 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;)
|
- 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
|
- Redstone ore blocks lighting up upon hit or contact
|
||||||
- Cactus placement requirements (needs open blocks beside, sand below)
|
- Cactus placement requirements (needs open blocks beside)
|
||||||
- Sapling/flower placement requirements
|
- Sapling / flower placement requirements
|
||||||
- Mushroom placement requirements
|
- Mushroom placement requirements
|
||||||
- Reed 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)
|
## Beta (Survival)
|
||||||
- Mob spawning, item pick up
|
- Mob spawning, item pick up
|
||||||
|
@ -100,9 +100,27 @@ class BlockAPI{
|
|||||||
$entity = $this->server->api->entity->get($this->eid);
|
$entity = $this->server->api->entity->get($this->eid);
|
||||||
|
|
||||||
switch($data["block"]){
|
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
|
case 64://Door placing
|
||||||
$blockUp = $this->server->api->level->getBlock($data["x"], $data["y"] + 1, $data["z"]);
|
$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;
|
return;
|
||||||
}else{
|
}else{
|
||||||
$data2 = $data;
|
$data2 = $data;
|
||||||
@ -112,6 +130,21 @@ class BlockAPI{
|
|||||||
$this->server->handle("player.block.place", $data2);
|
$this->server->handle("player.block.place", $data2);
|
||||||
}
|
}
|
||||||
break;
|
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 59://Seeds
|
||||||
case 105:
|
case 105:
|
||||||
$blockDown = $this->server->api->level->getBlock($data["x"], $data["y"] - 1, $data["z"]);
|
$blockDown = $this->server->api->level->getBlock($data["x"], $data["y"] - 1, $data["z"]);
|
||||||
|
@ -26,6 +26,41 @@ the Free Software Foundation, either version 3 of the License, or
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Material{
|
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(
|
static $replaceable = array(
|
||||||
0 => true,
|
0 => true,
|
||||||
8 => true,
|
8 => true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user