mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-23 11:26:37 +00:00
Correct Ice drop
This commit is contained in:
parent
47b54cfd28
commit
228075851c
@ -273,7 +273,9 @@ class BlockAPI{
|
||||
|
||||
if($this->server->api->dhandle("player.block.break", array("player" => $player, "target" => $target, "item" => $item)) !== false){
|
||||
$drops = $target->getDrops($item, $player);
|
||||
$target->onBreak($item, $player);
|
||||
if($target->onBreak($item, $player) === false){
|
||||
return $this->cancelAction($target, $player);
|
||||
}
|
||||
}else{
|
||||
return $this->cancelAction($target, $player);
|
||||
}
|
||||
|
@ -60,20 +60,19 @@ class DoorBlock extends TransparentBlock{
|
||||
}
|
||||
|
||||
public function onBreak(Item $item, Player $player){
|
||||
if(($this->meta & 0x08) === 0x08){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === $this->id){
|
||||
$this->level->setBlock($down, new AirBlock());
|
||||
}
|
||||
}else{
|
||||
$up = $this->getSide(1);
|
||||
if($up->getID() === $this->id){
|
||||
$this->level->setBlock($up, new AirBlock());
|
||||
}
|
||||
if(($this->meta & 0x08) === 0x08){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === $this->id){
|
||||
$this->level->setBlock($down, new AirBlock());
|
||||
}
|
||||
$this->level->setBlock($this, new AirBlock());
|
||||
return true;
|
||||
return false;
|
||||
}else{
|
||||
$up = $this->getSide(1);
|
||||
if($up->getID() === $this->id){
|
||||
$this->level->setBlock($up, new AirBlock());
|
||||
}
|
||||
}
|
||||
$this->level->setBlock($this, new AirBlock());
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
|
@ -30,6 +30,11 @@ class IceBlock extends TransparentBlock{
|
||||
parent::__construct(ICE, 0, "Ice");
|
||||
}
|
||||
|
||||
public function onBreak(Item $item, Player $player){
|
||||
$this->level->setBlock($this, new WaterBlock());
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
|
Loading…
x
Reference in New Issue
Block a user