mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
fixed items getting damaged when hitting players in gm 1
This commit is contained in:
parent
e30586fff2
commit
b63741dc22
3 changed files with 6 additions and 5 deletions
|
|
@ -1230,6 +1230,7 @@ class Player{
|
|||
$motionSent = false;
|
||||
$moveSent = false;
|
||||
$headSent = false;
|
||||
|
||||
if($e->speedX != 0 || $e->speedY != 0 || $e->speedZ != 0 || $e->speedY != $e->lastSpeedY || $e->speedX != $e->lastSpeedX || $e->speedZ != $e->lastSpeedZ){
|
||||
if(!($e->speedY < 0 && $e->onGround) || $e->speedX != 0 || $e->speedZ != 0 || $e->speedY != $e->lastSpeedY || $e->speedX != $e->lastSpeedX || $e->speedZ != $e->lastSpeedZ){
|
||||
$motion = new SetEntityMotionPacket();
|
||||
|
|
@ -2653,7 +2654,7 @@ class Player{
|
|||
}
|
||||
|
||||
public function damageArmorPart($slot, $part){
|
||||
$part->useOn($this->entity, true); //PocketMine is forced to do it =<. Even if PocketMine doesnt want, he have to damage your armor.
|
||||
$part->useOn($this->entity, true);
|
||||
if($part->getMetadata() >= $part->getMaxDurability()){
|
||||
$this->setArmor($slot, BlockAPI::getItem(AIR, 0, 0), false);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -945,10 +945,10 @@ class Entity extends Position
|
|||
|
||||
if($action === InteractPacket::ACTION_ATTACK && $e->isPlayer()){
|
||||
$slot = $e->player->getHeldItem();
|
||||
$damage = $slot->getDamageAgainstOf($e);
|
||||
$damage = $slot->getDamageAgainstOf($this);
|
||||
$this->harm($damage, $e->eid);
|
||||
if($slot->isTool() === true and ($e->player->gamemode & 0x01) === 0){
|
||||
if($slot->useOn($e) and $slot->getMetadata() >= $slot->getMaxDurability()){
|
||||
if($slot->isTool() and ($this->player->gamemode & 0x01) === 0){
|
||||
if($slot->useOn($this) and $slot->getMetadata() >= $slot->getMaxDurability()){
|
||||
$e->player->removeItem($slot->getID(), $slot->getMetadata(), 1, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class TaskAttackPlayer 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 ?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue