Added EntityIds interface with constants

This commit is contained in:
Dylan K. Taylor 2017-10-19 15:43:55 +01:00
parent 2db13bd114
commit 2b22d5d8cc
11 changed files with 129 additions and 10 deletions

View File

@ -66,7 +66,7 @@ use pocketmine\Player;
use pocketmine\plugin\Plugin;
use pocketmine\Server;
abstract class Entity extends Location implements Metadatable{
abstract class Entity extends Location implements Metadatable, EntityIds{
const MOTION_THRESHOLD = 0.00001;

View File

@ -0,0 +1,119 @@
<?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/
*
*
*/
declare(strict_types=1);
namespace pocketmine\entity;
interface EntityIds{
const CHICKEN = 10;
const COW = 11;
const PIG = 12;
const SHEEP = 13;
const WOLF = 14;
const VILLAGER = 15;
const MOOSHROOM = 16;
const SQUID = 17;
const RABBIT = 18;
const BAT = 19;
const IRON_GOLEM = 20;
const SNOW_GOLEM = 21;
const OCELOT = 22;
const HORSE = 23;
const DONKEY = 24;
const MULE = 25;
const SKELETON_HORSE = 26;
const ZOMBIE_HORSE = 27;
const POLAR_BEAR = 28;
const LLAMA = 29;
const PARROT = 30;
const ZOMBIE = 32;
const CREEPER = 33;
const SKELETON = 34;
const SPIDER = 35;
const ZOMBIE_PIGMAN = 36;
const SLIME = 37;
const ENDERMAN = 38;
const SILVERFISH = 39;
const CAVE_SPIDER = 40;
const GHAST = 41;
const MAGMA_CUBE = 42;
const BLAZE = 43;
const ZOMBIE_VILLAGER = 44;
const WITCH = 45;
const STRAY = 46;
const HUSK = 47;
const WITHER_SKELETON = 48;
const GUARDIAN = 49;
const ELDER_GUARDIAN = 50;
const NPC = 51;
const WITHER = 52;
const ENDER_DRAGON = 53;
const SHULKER = 54;
const ENDERMITE = 55;
const LEARN_TO_CODE_MASCOT = 56;
const VINDICATOR = 57;
const ARMOR_STAND = 61;
const TRIPOD_CAMERA = 62;
const PLAYER = 63;
const ITEM = 64;
const TNT = 65;
const FALLING_BLOCK = 66;
const MOVING_BLOCK = 67;
const XP_BOTTLE = 68;
const XP_ORB = 69;
const EYE_OF_ENDER_SIGNAL = 70;
const ENDER_CRYSTAL = 71;
const FIREWORKS_ROCKET = 72;
const SHULKER_BULLET = 76;
const FISHING_HOOK = 77;
const CHALKBOARD = 78;
const DRAGON_FIREBALL = 79;
const ARROW = 80;
const SNOWBALL = 81;
const EGG = 82;
const PAINTING = 83;
const MINECART = 84;
const LARGE_FIREBALL = 85;
const SPLASH_POTION = 86;
const ENDER_PEARL = 87;
const LEASH_KNOT = 88;
const WITHER_SKULL = 89;
const BOAT = 90;
const WITHER_SKULL_DANGEROUS = 91;
const LIGHTNING_BOLT = 93;
const SMALL_FIREBALL = 94;
const AREA_EFFECT_CLOUD = 95;
const HOPPER_MINECART = 96;
const TNT_MINECART = 97;
const CHEST_MINECART = 98;
const COMMAND_BLOCK_MINECART = 100;
const LINGERING_POTION = 101;
const LLAMA_SPIT = 102;
const EVOCATION_FANG = 103;
const EVOCATION_ILLAGER = 104;
const VEX = 105;
}

View File

@ -35,7 +35,7 @@ use pocketmine\network\mcpe\protocol\AddEntityPacket;
use pocketmine\Player;
class FallingSand extends Entity{
const NETWORK_ID = 66;
const NETWORK_ID = self::FALLING_BLOCK;
public $width = 0.98;
public $height = 0.98;

View File

@ -34,7 +34,7 @@ use pocketmine\network\mcpe\protocol\AddItemEntityPacket;
use pocketmine\Player;
class Item extends Entity{
const NETWORK_ID = 64;
const NETWORK_ID = self::ITEM;
/** @var string */
protected $owner = "";

View File

@ -32,7 +32,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\Player;
class PrimedTNT extends Entity implements Explosive{
const NETWORK_ID = 65;
const NETWORK_ID = self::TNT;
public $width = 0.98;
public $height = 0.98;

View File

@ -33,7 +33,7 @@ use pocketmine\network\mcpe\protocol\EntityEventPacket;
use pocketmine\Player;
class Squid extends WaterAnimal{
const NETWORK_ID = 17;
const NETWORK_ID = self::SQUID;
public $width = 0.95;
public $height = 0.95;

View File

@ -34,7 +34,7 @@ class Villager extends Creature implements NPC, Ageable{
const PROFESSION_BLACKSMITH = 3;
const PROFESSION_BUTCHER = 4;
const NETWORK_ID = 15;
const NETWORK_ID = self::VILLAGER;
public $width = 0.6;
public $height = 1.8;

View File

@ -30,7 +30,7 @@ use pocketmine\network\mcpe\protocol\AddEntityPacket;
use pocketmine\Player;
class Zombie extends Monster{
const NETWORK_ID = 32;
const NETWORK_ID = self::ZOMBIE;
public $width = 0.6;
public $height = 1.8;

View File

@ -30,7 +30,7 @@ use pocketmine\network\mcpe\protocol\AddEntityPacket;
use pocketmine\Player;
class Arrow extends Projectile{
const NETWORK_ID = 80;
const NETWORK_ID = self::ARROW;
public $width = 0.25;
public $height = 0.25;

View File

@ -27,7 +27,7 @@ use pocketmine\network\mcpe\protocol\AddEntityPacket;
use pocketmine\Player;
class Egg extends Throwable{
const NETWORK_ID = 82;
const NETWORK_ID = self::EGG;
public function spawnTo(Player $player){
$pk = new AddEntityPacket();

View File

@ -27,7 +27,7 @@ use pocketmine\network\mcpe\protocol\AddEntityPacket;
use pocketmine\Player;
class Snowball extends Throwable{
const NETWORK_ID = 81;
const NETWORK_ID = self::SNOWBALL;
public function spawnTo(Player $player){
$pk = new AddEntityPacket();