mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +00:00
pigmans fire resistance added
This commit is contained in:
parent
c60ccb4f1b
commit
535cba9f6f
2 changed files with 24 additions and 16 deletions
|
|
@ -1257,24 +1257,24 @@ class Entity extends Position
|
||||||
|
|
||||||
public function harm($dmg, $cause = "generic", $force = false)
|
public function harm($dmg, $cause = "generic", $force = false)
|
||||||
{
|
{
|
||||||
if(!$this->canBeAttacked){
|
if (! $this->canBeAttacked) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$ret = $this->setHealth(max(- 128, $this->getHealth() - ((int) $dmg)), $cause, $force);
|
$ret = $this->setHealth(max(- 128, $this->getHealth() - ((int) $dmg)), $cause, $force);
|
||||||
|
|
||||||
if($ret != false && $this->hasKnockback && is_numeric($cause) && ($entity = $this->server->api->entity->get($cause)) != false){
|
if ($ret != false && $this->hasKnockback && is_numeric($cause) && ($entity = $this->server->api->entity->get($cause)) != false) {
|
||||||
$d = $entity->x - $this->x;
|
$d = $entity->x - $this->x;
|
||||||
|
|
||||||
for($d1 = $entity->z - $this->z; $d * $d + $d1 * $d1 < 0.0001; $d1 = (Utils::randomFloat() - Utils::randomFloat()) * 0.01){
|
for ($d1 = $entity->z - $this->z; $d * $d + $d1 * $d1 < 0.0001; $d1 = (Utils::randomFloat() - Utils::randomFloat()) * 0.01) {
|
||||||
$d = (Utils::randomFloat() - Utils::randomFloat()) * 0.01;
|
$d = (Utils::randomFloat() - Utils::randomFloat()) * 0.01;
|
||||||
|
}
|
||||||
|
|
||||||
|
// attackedAtYaw = (float)((Math.atan2($d1, $d) * 180D) / 3.1415927410125732D) >
|
||||||
|
$this->knockBack($d, $d1);
|
||||||
|
$this->sendMotion();
|
||||||
}
|
}
|
||||||
|
|
||||||
// attackedAtYaw = (float)((Math.atan2($d1, $d) * 180D) / 3.1415927410125732D) >
|
return $ret;
|
||||||
$this->knockBack($d, $d1);
|
|
||||||
$this->sendMotion();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setState($v)
|
public function setState($v)
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,12 @@ class PigZombie extends Monster{
|
||||||
[GOLD_INGOT, 0, mt_rand(0,1)]
|
[GOLD_INGOT, 0, mt_rand(0,1)]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function harm($dmg, $cause = "generic", $force = false)
|
||||||
|
{
|
||||||
|
if($cause === "fire" || $cause === "lava" || $cause === "burning"){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return parent::harm($dmg, $cause, $force);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue