mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 15:49:54 +00:00
Fixed block durability
This commit is contained in:
parent
5683dca9f6
commit
e42314ade7
@ -275,8 +275,7 @@ class BlockAPI{
|
|||||||
if($target->onBreak($item, $player) === false){
|
if($target->onBreak($item, $player) === false){
|
||||||
return $this->cancelAction($target, $player, false);
|
return $this->cancelAction($target, $player, false);
|
||||||
}
|
}
|
||||||
$item->useOn($target);
|
if($item->useOn($target) and ($player->gamemode & 0x01) === 0 and $item->getMetadata() >= $item->getMaxDurability()){
|
||||||
if($item->getMetadata() >= $item->getMaxDurability()){
|
|
||||||
$player->setSlot($player->slot, new Item(AIR, 0, 0), false);
|
$player->setSlot($player->slot, new Item(AIR, 0, 0), false);
|
||||||
}
|
}
|
||||||
$drops = $target->getDrops($item, $player);
|
$drops = $target->getDrops($item, $player);
|
||||||
|
@ -1519,8 +1519,7 @@ class Player{
|
|||||||
}
|
}
|
||||||
$target->harm($damage, $this->eid);
|
$target->harm($damage, $this->eid);
|
||||||
if($slot->isTool() === true and ($this->gamemode & 0x01) === 0){
|
if($slot->isTool() === true and ($this->gamemode & 0x01) === 0){
|
||||||
$slot->useOn($target);
|
if($slot->useOn($target) and $slot->getMetadata() >= $slot->getMaxDurability()){
|
||||||
if($slot->getMetadata() >= $slot->getMaxDurability()){
|
|
||||||
$this->setSlot($this->slot, new Item(AIR, 0, 0), false);
|
$this->setSlot($this->slot, new Item(AIR, 0, 0), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH);
|
|||||||
ini_set("memory_limit", "128M"); //Default
|
ini_set("memory_limit", "128M"); //Default
|
||||||
define("LOG", true);
|
define("LOG", true);
|
||||||
define("START_TIME", microtime(true));
|
define("START_TIME", microtime(true));
|
||||||
define("MAJOR_VERSION", "Alpha_1.3.4");
|
define("MAJOR_VERSION", "Alpha_1.3.5dev");
|
||||||
define("CURRENT_MINECRAFT_VERSION", "0.7.3 alpha");
|
define("CURRENT_MINECRAFT_VERSION", "0.7.3 alpha");
|
||||||
define("CURRENT_API_VERSION", 9);
|
define("CURRENT_API_VERSION", 9);
|
||||||
define("CURRENT_PHP_VERSION", "5.5");
|
define("CURRENT_PHP_VERSION", "5.5");
|
||||||
|
@ -142,7 +142,9 @@ class Item{
|
|||||||
}else{
|
}else{
|
||||||
$this->meta++;
|
$this->meta++;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function isTool(){
|
final public function isTool(){
|
||||||
|
@ -38,8 +38,7 @@ class FlintSteelItem extends Item{
|
|||||||
$block->level->scheduleBlockUpdate(new Position($block, 0, 0, $block->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
$block->level->scheduleBlockUpdate(new Position($block, 0, 0, $block->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$this->useOn($block);
|
if($this->useOn($block) and ($player->gamemode & 0x01) === 0 and $this->getMetadata() >= $this->getMaxDurability()){
|
||||||
if($this->getMetadata() >= $this->getMaxDurability()){
|
|
||||||
$player->setSlot($player->slot, new Item(AIR, 0, 0), false);
|
$player->setSlot($player->slot, new Item(AIR, 0, 0), false);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user