mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 13:09:44 +00:00
Merge pull request #22 from GameHerobrine/test
isBaby added to entities.yml, armor fix
This commit is contained in:
commit
0f58c2a555
3 changed files with 15 additions and 3 deletions
|
|
@ -2328,7 +2328,14 @@ class Player{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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.
|
||||||
|
if($part->getMetadata() >= $part->getMaxDurability()){
|
||||||
|
$this->setArmor($slot, BlockAPI::getItem(AIR, 0, 0), false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->setArmor($slot, $part, false);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @param Player|string|boolean|void $player
|
* @param Player|string|boolean|void $player
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1056,11 +1056,15 @@ class Entity extends Position{
|
||||||
DIAMOND_LEGGINGS => 6,
|
DIAMOND_LEGGINGS => 6,
|
||||||
DIAMOND_BOOTS => 3,
|
DIAMOND_BOOTS => 3,
|
||||||
);
|
);
|
||||||
foreach($this->player->armor as $part){
|
foreach($this->player->armor as $slot=>$part){
|
||||||
if($part instanceof Item and isset($values[$part->getID()])){
|
if($part instanceof Item and isset($values[$part->getID()])){
|
||||||
$points += $values[$part->getID()];
|
$points += $values[$part->getID()];
|
||||||
|
if(is_numeric($cause)){ //check was entity damage by another entity
|
||||||
|
$this->player->damageArmorPart($slot, $part);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->player->sendArmor($this->player);
|
||||||
$dmg = (int) ($dmg - ($dmg * $points * 0.04));
|
$dmg = (int) ($dmg - ($dmg * $points * 0.04));
|
||||||
$health = $this->health - $dmg;
|
$health = $this->health - $dmg;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ class Level{
|
||||||
"id" => $entity->type,
|
"id" => $entity->type,
|
||||||
"Color" => @$entity->data["Color"],
|
"Color" => @$entity->data["Color"],
|
||||||
"Sheared" => @$entity->data["Sheared"],
|
"Sheared" => @$entity->data["Sheared"],
|
||||||
|
"isBaby" => @$entity->data["isBaby"],
|
||||||
"Health" => $entity->health,
|
"Health" => $entity->health,
|
||||||
"Pos" => array(
|
"Pos" => array(
|
||||||
0 => $entity->x,
|
0 => $entity->x,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue