mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Added entity id names
This commit is contained in:
parent
f4b92bcdfc
commit
90fa40de34
@ -25,6 +25,7 @@ namespace pocketmine\entity;
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\tag\Short;
|
||||
use pocketmine\nbt\tag\String;
|
||||
use pocketmine\network\protocol\AddEntityPacket;
|
||||
use pocketmine\network\protocol\SetEntityMotionPacket;
|
||||
use pocketmine\Player;
|
||||
@ -39,13 +40,12 @@ class Arrow extends Projectile{
|
||||
protected $drag = 0.01;
|
||||
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Arrow");
|
||||
$this->setMaxHealth(1);
|
||||
$this->setHealth(1);
|
||||
if(isset($this->namedtag->Age)){
|
||||
$this->age = $this->namedtag["Age"];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function onUpdate(){
|
||||
|
@ -22,6 +22,11 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Chicken extends Animal{
|
||||
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Chicken");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Cow extends Animal{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Cow extends Animal{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Cow");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Creeper extends Monster implements Explosive{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Creeper extends Monster implements Explosive{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Creeper");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Egg extends Projectile{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Egg extends Projectile{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Egg");
|
||||
}
|
||||
}
|
@ -23,7 +23,10 @@ namespace pocketmine\entity;
|
||||
|
||||
|
||||
use pocketmine\inventory\InventoryHolder;
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Enderman extends Monster implements InventoryHolder{
|
||||
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Enderman");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class EnderPearl extends Projectile{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class FallingSand extends Entity{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "FallingSand");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Ocelot extends Animal implements Tameable{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Ocelot extends Animal implements Tameable{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Ozelot");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Painting extends Hanging{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Painting extends Hanging{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Painting");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Pig extends Animal implements Rideable{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Pig extends Animal implements Rideable{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Pig");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class PigZombie extends Zombie{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class PigZombie extends Zombie{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "PigZombie");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class FallingBlock extends Entity{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class PrimedTNT extends Entity implements Explosive{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "PrimedTNT");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Sheep extends Animal implements Colorable{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Sheep extends Animal implements Colorable{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Sheep");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Silverfish extends Monster{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Silverfish extends Monster{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Silverfish");
|
||||
}
|
||||
}
|
@ -23,5 +23,7 @@ namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Skeleton extends Monster implements ProjectileSource{
|
||||
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new Skeleton("id", "Chicken");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Slime extends Living{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Slime extends Living{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Slime");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Snowball extends Projectile{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Snowball extends Projectile{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Snowball");
|
||||
}
|
||||
}
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Spider extends Monster{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Spider extends Monster{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Spider");
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class TNTPrimed extends Entity implements Explosive{
|
||||
|
||||
}
|
@ -23,6 +23,7 @@ namespace pocketmine\entity;
|
||||
|
||||
|
||||
use pocketmine\nbt\tag\Int;
|
||||
use pocketmine\nbt\tag\String;
|
||||
use pocketmine\network\protocol\AddMobPacket;
|
||||
use pocketmine\network\protocol\SetEntityMotionPacket;
|
||||
use pocketmine\Player;
|
||||
@ -47,6 +48,7 @@ class Villager extends Creature implements NPC, Ageable{
|
||||
|
||||
protected function initEntity(){
|
||||
parent::initEntity();
|
||||
$this->namedtag->id = new String("id", "Villager");
|
||||
if(!isset($this->namedtag->Profession)){
|
||||
$this->setProfession(self::PROFESSION_GENERIC);
|
||||
}
|
||||
|
@ -22,6 +22,10 @@
|
||||
namespace pocketmine\entity;
|
||||
|
||||
|
||||
class Wolf extends Animal implements Tameable{
|
||||
use pocketmine\nbt\tag\String;
|
||||
|
||||
class Wolf extends Animal implements Tameable{
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Wolf");
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ namespace pocketmine\entity;
|
||||
|
||||
use pocketmine\event\entity\EntityDamageByEntityEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\nbt\tag\String;
|
||||
use pocketmine\network\protocol\AddMobPacket;
|
||||
use pocketmine\network\protocol\SetEntityMotionPacket;
|
||||
use pocketmine\Player;
|
||||
@ -35,6 +36,10 @@ class Zombie extends Monster{
|
||||
public $length = 0.6;
|
||||
public $height = 1.8;
|
||||
|
||||
protected function initEntity(){
|
||||
$this->namedtag->id = new String("id", "Zombie");
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Zombie";
|
||||
}
|
||||
|
@ -105,7 +105,8 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
if(!isset($nbt->id)){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//TODO: add all entities
|
||||
if($nbt->id instanceof String){ //New format
|
||||
switch($nbt["id"]){
|
||||
case "Item":
|
||||
|
@ -106,6 +106,7 @@ abstract class BaseFullChunk implements FullChunk{
|
||||
continue;
|
||||
}
|
||||
|
||||
//TODO: add all entities
|
||||
if($nbt->id instanceof String){ //New format
|
||||
switch($nbt["id"]){
|
||||
case "Item":
|
||||
|
Loading…
x
Reference in New Issue
Block a user