Fixed block durability

This commit is contained in:
Shoghi Cervantes 2013-08-20 04:53:22 +02:00
parent 5683dca9f6
commit e42314ade7
5 changed files with 6 additions and 7 deletions

View File

@ -275,8 +275,7 @@ class BlockAPI{
if($target->onBreak($item, $player) === false){
return $this->cancelAction($target, $player, false);
}
$item->useOn($target);
if($item->getMetadata() >= $item->getMaxDurability()){
if($item->useOn($target) and ($player->gamemode & 0x01) === 0 and $item->getMetadata() >= $item->getMaxDurability()){
$player->setSlot($player->slot, new Item(AIR, 0, 0), false);
}
$drops = $target->getDrops($item, $player);

View File

@ -1519,8 +1519,7 @@ class Player{
}
$target->harm($damage, $this->eid);
if($slot->isTool() === true and ($this->gamemode & 0x01) === 0){
$slot->useOn($target);
if($slot->getMetadata() >= $slot->getMaxDurability()){
if($slot->useOn($target) and $slot->getMetadata() >= $slot->getMaxDurability()){
$this->setSlot($this->slot, new Item(AIR, 0, 0), false);
}
}

View File

@ -65,7 +65,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH);
ini_set("memory_limit", "128M"); //Default
define("LOG", 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_API_VERSION", 9);
define("CURRENT_PHP_VERSION", "5.5");

View File

@ -142,7 +142,9 @@ class Item{
}else{
$this->meta++;
}
return true;
}
return false;
}
final public function isTool(){

View File

@ -38,8 +38,7 @@ class FlintSteelItem extends Item{
$block->level->scheduleBlockUpdate(new Position($block, 0, 0, $block->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
return true;
}
$this->useOn($block);
if($this->getMetadata() >= $this->getMaxDurability()){
if($this->useOn($block) and ($player->gamemode & 0x01) === 0 and $this->getMetadata() >= $this->getMaxDurability()){
$player->setSlot($player->slot, new Item(AIR, 0, 0), false);
}
return false;