Properly switch to string entity IDs

This commit is contained in:
Dylan K. Taylor
2020-06-20 13:43:31 +01:00
parent a988578ee0
commit d38c17835d
20 changed files with 179 additions and 43 deletions

View File

@ -32,7 +32,7 @@ use pocketmine\event\inventory\InventoryPickupArrowEvent;
use pocketmine\item\VanillaItems;
use pocketmine\math\RayTraceResult;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
use pocketmine\network\mcpe\protocol\types\entity\EntityIds;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataFlags;
use pocketmine\player\Player;
@ -42,7 +42,7 @@ use function sqrt;
class Arrow extends Projectile{
public static function getNetworkTypeId() : int{ return EntityLegacyIds::ARROW; }
public static function getNetworkTypeId() : string{ return EntityIds::ARROW; }
public const PICKUP_NONE = 0;
public const PICKUP_ANY = 1;

View File

@ -25,11 +25,11 @@ namespace pocketmine\entity\projectile;
use pocketmine\event\entity\ProjectileHitEvent;
use pocketmine\item\VanillaItems;
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
use pocketmine\network\mcpe\protocol\types\entity\EntityIds;
use pocketmine\world\particle\ItemBreakParticle;
class Egg extends Throwable{
public static function getNetworkTypeId() : int{ return EntityLegacyIds::EGG; }
public static function getNetworkTypeId() : string{ return EntityIds::EGG; }
//TODO: spawn chickens on collision

View File

@ -25,12 +25,12 @@ namespace pocketmine\entity\projectile;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\event\entity\ProjectileHitEvent;
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
use pocketmine\network\mcpe\protocol\types\entity\EntityIds;
use pocketmine\world\particle\EndermanTeleportParticle;
use pocketmine\world\sound\EndermanTeleportSound;
class EnderPearl extends Throwable{
public static function getNetworkTypeId() : int{ return EntityLegacyIds::ENDER_PEARL; }
public static function getNetworkTypeId() : string{ return EntityIds::ENDER_PEARL; }
protected function onHit(ProjectileHitEvent $event) : void{
$owner = $this->getOwningEntity();

View File

@ -24,13 +24,13 @@ declare(strict_types=1);
namespace pocketmine\entity\projectile;
use pocketmine\event\entity\ProjectileHitEvent;
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
use pocketmine\network\mcpe\protocol\types\entity\EntityIds;
use pocketmine\world\particle\PotionSplashParticle;
use pocketmine\world\sound\PotionSplashSound;
use function mt_rand;
class ExperienceBottle extends Throwable{
public static function getNetworkTypeId() : int{ return EntityLegacyIds::XP_BOTTLE; }
public static function getNetworkTypeId() : string{ return EntityIds::XP_BOTTLE; }
protected $gravity = 0.07;

View File

@ -24,11 +24,11 @@ declare(strict_types=1);
namespace pocketmine\entity\projectile;
use pocketmine\event\entity\ProjectileHitEvent;
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
use pocketmine\network\mcpe\protocol\types\entity\EntityIds;
use pocketmine\world\particle\SnowballPoofParticle;
class Snowball extends Throwable{
public static function getNetworkTypeId() : int{ return EntityLegacyIds::SNOWBALL; }
public static function getNetworkTypeId() : string{ return EntityIds::SNOWBALL; }
protected function onHit(ProjectileHitEvent $event) : void{
for($i = 0; $i < 6; ++$i){

View File

@ -34,7 +34,7 @@ use pocketmine\event\entity\ProjectileHitEntityEvent;
use pocketmine\event\entity\ProjectileHitEvent;
use pocketmine\item\Potion;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
use pocketmine\network\mcpe\protocol\types\entity\EntityIds;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataFlags;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties;
@ -46,7 +46,7 @@ use function sqrt;
class SplashPotion extends Throwable{
public static function getNetworkTypeId() : int{ return EntityLegacyIds::SPLASH_POTION; }
public static function getNetworkTypeId() : string{ return EntityIds::SPLASH_POTION; }
protected $gravity = 0.05;
protected $drag = 0.01;