mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
fixed mobs sending damage animation to player when they spawn
This commit is contained in:
parent
f572605472
commit
d28dad2a07
15 changed files with 15 additions and 15 deletions
|
|
@ -11,7 +11,7 @@ abstract class Creature extends Living{
|
|||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->inPanic = false; //force for now
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 1, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 1, "generic", allowHarm: false);
|
||||
$this->enableAutojump = true;
|
||||
$this->searchForClosestPlayers = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Chicken extends Animal{
|
|||
$this->timeUntilEgg = mt_rand(0,6000) + 6000;
|
||||
$this->setSize(0.4, 0.7);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 4, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 4, "generic", allowHarm: false);
|
||||
$this->setName('Chicken');
|
||||
$this->setSpeed(0.25);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Cow extends Animal{
|
|||
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.9, 1.3);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 10, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 10, "generic", allowHarm: false);
|
||||
$this->setName("Cow");
|
||||
$this->setSpeed(0.2);
|
||||
$this->ai->addTask(new TaskRandomWalk(0.8));
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Pig extends Animal implements Rideable{
|
|||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.9, 0.9);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 10, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 10, "generic", allowHarm: false);
|
||||
$this->server = ServerAPI::request();
|
||||
$this->setName("Pig");
|
||||
$this->setSpeed(0.25);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Sheep extends Animal{
|
|||
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.9, 1.3);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 8, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 8, "generic", allowHarm: false);
|
||||
$this->setName("Sheep");
|
||||
$this->data["Sheared"] = $this->data["Sheared"] ?? 0;
|
||||
$this->data["Color"] = $this->data["Color"] ?? $this->sheepColor();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Creeper extends Monster{
|
|||
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.6, 1.7);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 16, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 16, "generic", allowHarm: false);
|
||||
$this->setName("Creeper");
|
||||
$this->ignited = 0;
|
||||
$this->setSpeed(0.25);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class PigZombie extends Monster{ //TODO extends zombie
|
|||
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.3, 1.95);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 12, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 12, "generic", allowHarm: false);
|
||||
$this->setName("Pigman");
|
||||
$this->setSpeed(0.25);
|
||||
$this->isImmuneToFire = true;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Skeleton extends Monster{
|
|||
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.6, 1.99);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 10, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 10, "generic", allowHarm: false);
|
||||
$this->setName("Skeleton");
|
||||
$this->ai->removeTask("TaskAttackPlayer");
|
||||
$this->setSpeed(0.25);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Spider extends Monster{
|
|||
function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
||||
$this->setSize(1.4, 0.9);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 8, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 8, "generic", allowHarm: false);
|
||||
$this->setName("Spider");
|
||||
$this->setSpeed(0.3);
|
||||
$this->ai->addTask(new TaskRandomWalk(1.2));
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Zombie extends Monster{
|
|||
function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
||||
$this->setSize(0.6, 1.85);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth($this->data["Health"] ?? 12, "generic");
|
||||
$this->setHealth($this->data["Health"] ?? 12, "generic", allowHarm: false);
|
||||
$this->setName("Zombie");
|
||||
$this->setSpeed(0.23);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class FallingSand extends Entity{
|
|||
|
||||
public function __construct($level, $eid, $class, $type = 0, $data = []){
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth(PHP_INT_MAX, "generic");
|
||||
$this->setHealth(PHP_INT_MAX, "generic", allowHarm: false);
|
||||
$this->height = 0.98;
|
||||
$this->width = 0.98;
|
||||
$this->yOffset = $this->height / 2;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class ItemEntity extends Entity{
|
|||
$this->itemID = (int) $data["itemID"];
|
||||
}
|
||||
$this->hasGravity = true;
|
||||
$this->setHealth(5, "generic");
|
||||
$this->setHealth(5, "generic", allowHarm: false);
|
||||
$this->gravity = 0.04;
|
||||
$this->delayBeforePickup = 40; //in vanilla it is 0 by default
|
||||
$this->stepHeight = 0;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class Minecart extends Vehicle{
|
|||
$this->x = $this->data["TileX"] ?? $this->x;
|
||||
$this->y = $this->data["TileY"] ?? $this->y;
|
||||
$this->z = $this->data["TileZ"] ?? $this->z;
|
||||
$this->setHealth(1, "generic"); //orig: 3
|
||||
$this->setHealth(1, "generic", allowHarm: false); //orig: 3
|
||||
$this->setSize(0.98, 0.7);
|
||||
$this->yOffset = $this->height / 2;
|
||||
$this->stepHeight = 0;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class PrimedTNT extends Entity{
|
|||
$this->gravity = 0.04;
|
||||
$this->setSize(0.98, 0.98);
|
||||
$this->yOffset = $this->height / 2;
|
||||
$this->setHealth(10000000, "generic");
|
||||
$this->setHealth(10000000, "generic", allowHarm: false);
|
||||
}
|
||||
|
||||
public function isPickable(){
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class TripodCamera extends Entity{
|
|||
|
||||
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth(PHP_INT_MAX, "generic");
|
||||
$this->setHealth(PHP_INT_MAX, "generic", allowHarm: false);
|
||||
}
|
||||
|
||||
public function isPickable(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue