mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Fix for crashes via item (MCPE-1198)
This commit is contained in:
parent
3578b90a39
commit
f1c593d809
@ -414,21 +414,6 @@ class BlockAPI{
|
||||
$data2["z"] = $next[2][2];
|
||||
$this->server->handle("player.block.place", $data2);
|
||||
break;
|
||||
case 65: //Ladder
|
||||
if(isset(Material::$transparent[$target[0]])){
|
||||
return false;
|
||||
}
|
||||
$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"]);
|
||||
|
@ -177,6 +177,9 @@ abstract class Block{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if(!isset(Block::$class[$this->id])){ //Unknown blocks
|
||||
return array();
|
||||
}
|
||||
return array(
|
||||
array($this->id, $this->meta, 1),
|
||||
);
|
||||
|
@ -32,7 +32,7 @@ class Item{
|
||||
|
||||
|
||||
);
|
||||
protected $block = false;
|
||||
protected $block;
|
||||
protected $id;
|
||||
protected $meta;
|
||||
protected $count;
|
||||
@ -45,7 +45,7 @@ class Item{
|
||||
$this->meta = (int) $meta;
|
||||
$this->count = (int) $count;
|
||||
$this->name = $name;
|
||||
if(isset(Block::$class[$this->id])){
|
||||
if(!isset($this->block) and isset(Block::$class[$this->id])){
|
||||
$this->block = BlockAPI::get($this->id, $this->meta);
|
||||
$this->name = $this->block->getName();
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class LadderBlock extends TransparentBlock{
|
||||
}
|
||||
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($block->inWorld === true){
|
||||
if($block->isTransparent === false){
|
||||
if($target->isTransparent === false){
|
||||
$faces = array(
|
||||
2 => 2,
|
||||
3 => 3,
|
||||
|
Loading…
x
Reference in New Issue
Block a user