fixed spam in console

This commit is contained in:
GameHerobrine 2024-04-27 16:14:19 +03:00
parent a2747dffa8
commit a52e38de5d
2 changed files with 2 additions and 2 deletions

View file

@ -947,7 +947,7 @@ class Entity extends Position
$slot = $e->player->getHeldItem();
$damage = $slot->getDamageAgainstOf($this);
$this->harm($damage, $e->eid);
if($slot->isTool() and ($this->player->gamemode & 0x01) === 0){
if($slot->isTool() && (!$this->isPlayer() || ($this->player->gamemode & 0x01) === 0)){
if($slot->useOn($this) and $slot->getMetadata() >= $slot->getMaxDurability()){
$e->player->removeItem($slot->getID(), $slot->getMetadata(), 1, true);
}

View file

@ -114,7 +114,7 @@ class TaskRangedAttack extends \TaskBase
}
}
$closestTarget = $e->closestPlayerDist <= $this->rangeSquared ? $e->level->entityList[$e->closestPlayerEID] : null;
$closestTarget = $e->closestPlayerDist <= $this->rangeSquared ? ($e->level->entityList[$e->closestPlayerEID] ?? null) : null;
if($closestTarget != null){
$e->target = $closestTarget; //TODO dont save entity object ?