rewritten how item durability/count is handled on serverside

This commit is contained in:
GameHerobrine 2025-05-29 05:30:33 +03:00
parent 4880be5452
commit 841e12b9ea
30 changed files with 128 additions and 152 deletions

View file

@ -11,11 +11,7 @@ class DirtBlock extends SolidBlock{
public function onActivate(Item $item, Player $player){
if($item->isHoe()){
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);
}
$item->hurtAndBreak(1, $player); //TODO move to ItemHoe
$this->level->fastSetBlockUpdate($this->x, $this->y, $this->z, FARMLAND, 0, true);
return true;
}