Correct Ice drop

This commit is contained in:
Shoghi Cervantes Pueyo 2013-05-20 16:38:41 +02:00
parent 47b54cfd28
commit 228075851c
3 changed files with 20 additions and 14 deletions

View File

@ -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);
}

View File

@ -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){

View File

@ -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;