mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
added some new mobs
This commit is contained in:
parent
5fdf1f6b75
commit
d5d634b6fb
9 changed files with 111 additions and 1 deletions
|
|
@ -55,7 +55,7 @@ class EntityAPI{
|
|||
|
||||
if(is_int($args[0])) $type = $args[0];
|
||||
else $type = $mob[strtolower($args[0])];
|
||||
if($type < 10 || $type > 36){
|
||||
if($type < 10 || $type > 39){
|
||||
return "Unknown mob.";
|
||||
}
|
||||
$mobName = ucfirst(array_flip($mob)[$type]);
|
||||
|
|
|
|||
7
src/entity/Neutral.php
Normal file
7
src/entity/Neutral.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
abstract class Neutral extends Creature
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
9
src/entity/Tameable.php
Normal file
9
src/entity/Tameable.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
interface Tameable
|
||||
{
|
||||
public function isTamed();
|
||||
|
||||
public function getOwner();
|
||||
}
|
||||
|
||||
31
src/entity/animal/Wolf.php
Normal file
31
src/entity/animal/Wolf.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
class Wolf extends Animal implements Tameable
|
||||
{
|
||||
const TYPE = MOB_WOLF;
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.6, 0.8);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setSpeed(0.3);
|
||||
$this->setName("Wolf");
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 10, "generic");
|
||||
}
|
||||
|
||||
|
||||
public function isTamed()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getOwner()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public function isFood($id) //TODO
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
16
src/entity/monster/Enderman.php
Normal file
16
src/entity/monster/Enderman.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
class Enderman extends Monster
|
||||
{
|
||||
const TYPE = MOB_ENDERMAN;
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.6, 2.9);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setName("Enderman");
|
||||
$this->setSpeed(0.3);
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 40, "generic");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
14
src/entity/monster/SilverFish.php
Normal file
14
src/entity/monster/SilverFish.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
class SilverFish extends Monster
|
||||
{
|
||||
const TYPE = MOB_SILVERFISH;
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.3, 0.7);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setSpeed(0.3);
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 8, "generic");
|
||||
$this->setName("Silverfish");
|
||||
}
|
||||
}
|
||||
|
||||
15
src/entity/monster/Slime.php
Normal file
15
src/entity/monster/Slime.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
class Slime extends Monster
|
||||
{
|
||||
const TYPE = MOB_SLIME;
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setName("Slime");
|
||||
/* Health formula
|
||||
* SlimeSize = Slime::getSlimeSize(this);
|
||||
* return SlimeSize * SlimeSize;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
13
src/entity/neutral/Villager.php
Normal file
13
src/entity/neutral/Villager.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Villager extends Neutral //TODO AI
|
||||
{
|
||||
const TYPE = MOB_VILLAGER;
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->setSize(0.6, 1.8);
|
||||
$this->setSpeed(0.3);
|
||||
$this->setName("Villager");
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -11,11 +11,16 @@ class EntityRegistry{
|
|||
self::registerEntity(Sheep::class);
|
||||
self::registerEntity(Cow::class);
|
||||
self::registerEntity(Mooshroom::class);
|
||||
self::registerEntity(Villager::class);
|
||||
self::registerEntity(Wolf::class);
|
||||
self::registerEntity(Creeper::class);
|
||||
self::registerEntity(PigZombie::class);
|
||||
self::registerEntity(Skeleton::class);
|
||||
self::registerEntity(Spider::class);
|
||||
self::registerEntity(Zombie::class);
|
||||
self::registerEntity(SilverFish::class);
|
||||
//self::registerEntity(Slime::class); TODO some missing property probably
|
||||
self::registerEntity(Enderman::class);
|
||||
self::registerEntity(Arrow::class);
|
||||
self::registerEntity(PrimedTNT::class);
|
||||
self::registerEntity(Painting::class);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue