hopefully fixed hoe durability

This commit is contained in:
GameHerobrine 2023-01-23 19:33:53 +03:00
parent 5bd7825736
commit 4df64523f6
3 changed files with 5 additions and 1 deletions

View file

@ -232,7 +232,7 @@ class Item{
}
public function getMaxDurability(){
if(!$this->isTool() and $this->isHoe() === false and $this->id !== BOW){
if(!$this->isTool() and $this->id !== BOW){
return false;
}

View file

@ -12,6 +12,8 @@ class DirtBlock extends SolidBlock{
if($this->getSide(1)->isTransparent === false) return false;
if(($player->gamemode & 0x01) === 0){
$item->useOn($this);
if($item->getMetadata() >= $item->getMaxDurability()) $player->setSlot($player->slot, new Item(AIR, 0, 0), false);
else $player->setSlot($player->slot, $item, true);
}
$this->level->setBlock($this, BlockAPI::get(FARMLAND, 0), true, false, true);
return true;

View file

@ -24,6 +24,8 @@ class GrassBlock extends SolidBlock{
if($this->getSide(1)->isTransparent === false) return false;
if(($player->gamemode & 0x01) === 0){
$item->useOn($this);
if($item->getMetadata() >= $item->getMaxDurability()) $player->setSlot($player->slot, new Item(AIR, 0, 0), false);
else $player->setSlot($player->slot, $item, true);
}
$this->level->setBlock($this, new FarmlandBlock());
$this->seedsDrop();