Merge pull request #183 from MathiewMay/dev

Fix entity ID TLS key recreating on every call of getSmallid() for linux
This commit is contained in:
Tropical 2026-03-11 15:17:39 -05:00 committed by GitHub
commit 4647b79f5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 192 additions and 130 deletions

View file

@ -44,12 +44,9 @@ int Entity::getSmallId()
// for final notification to the client that the entities are removed. We can't go re-using these small Ids yet, as otherwise we will // for final notification to the client that the entities are removed. We can't go re-using these small Ids yet, as otherwise we will
// potentially end up telling the client that the entity has been removed After we have already re-used its Id and created a new entity. // potentially end up telling the client that the entity has been removed After we have already re-used its Id and created a new entity.
// This ends up with newly created client-side entities being removed by accident, causing invisible mobs. // This ends up with newly created client-side entities being removed by accident, causing invisible mobs.
#ifdef _WIN32
if( ((size_t)TlsGetValue(tlsIdx) != 0 ) ) //4jcraft - i have no idea what 4j was cooking here ngl
#else
pthread_key_create(&tlsIdx, nullptr);
if ( ((size_t)pthread_getspecific(tlsIdx) != 0) ) if ( ((size_t)pthread_getspecific(tlsIdx) != 0) )
#endif
{ {
MinecraftServer *server = MinecraftServer::getInstance(); MinecraftServer *server = MinecraftServer::getInstance();
if( server ) if( server )

View file

@ -69,34 +69,34 @@ MoveEntityPacket::PosRot::PosRot()
hasRot = true; hasRot = true;
} }
MoveEntityPacket::PosRot::PosRot(int id, int8_t xa, int8_t ya, int8_t za, int8_t yRot, int8_t xRot) : MoveEntityPacket( id ) MoveEntityPacket::PosRot::PosRot(int id, char xa, char ya, char za, char yRot, char xRot) : MoveEntityPacket( id )
{ {
this->xa = xa; this->xa = xa;
this->ya = ya; this->ya = ya;
this->za = za; this->za = za;
this->yRot = yRot; this->yRot = yRot;
this->xRot = xRot; this->xRot = xRot;
hasRot = true; hasRot = true;
} }
void MoveEntityPacket::PosRot::read(DataInputStream *dis) //throws IOException void MoveEntityPacket::PosRot::read(DataInputStream *dis) //throws IOException
{ {
MoveEntityPacket::read(dis); MoveEntityPacket::read(dis);
xa = (int8_t)dis->readByte(); xa = (int)dis->readByte();
ya = (int8_t)dis->readByte(); ya = (int)dis->readByte();
za = (int8_t)dis->readByte(); za = (int)dis->readByte();
yRot = (int8_t)dis->readByte(); yRot = (int)dis->readByte();
xRot = (int8_t)dis->readByte(); xRot = (int)dis->readByte();
} }
void MoveEntityPacket::PosRot::write(DataOutputStream *dos) //throws IOException void MoveEntityPacket::PosRot::write(DataOutputStream *dos) //throws IOException
{ {
MoveEntityPacket::write(dos); MoveEntityPacket::write(dos);
dos->writeByte((uint8_t)(xa & 0xFF)); dos->writeByte((uint8_t)xa);
dos->writeByte((uint8_t)(ya & 0xFF)); dos->writeByte((uint8_t)ya);
dos->writeByte((uint8_t)(za & 0xFF)); dos->writeByte((uint8_t)za);
dos->writeByte((uint8_t)(yRot & 0xFF)); dos->writeByte((uint8_t)yRot);
dos->writeByte((uint8_t)(xRot & 0xFF)); dos->writeByte((uint8_t)xRot);
} }
int MoveEntityPacket::PosRot::getEstimatedSize() int MoveEntityPacket::PosRot::getEstimatedSize()
@ -108,7 +108,7 @@ MoveEntityPacket::Pos::Pos()
{ {
} }
MoveEntityPacket::Pos::Pos(int id, int8_t xa, int8_t ya, int8_t za) : MoveEntityPacket(id) MoveEntityPacket::Pos::Pos(int id, char xa, char ya, char za) : MoveEntityPacket(id)
{ {
this->xa = xa; this->xa = xa;
this->ya = ya; this->ya = ya;
@ -118,17 +118,17 @@ MoveEntityPacket::Pos::Pos(int id, int8_t xa, int8_t ya, int8_t za) : MoveEntity
void MoveEntityPacket::Pos::read(DataInputStream *dis) //throws IOException void MoveEntityPacket::Pos::read(DataInputStream *dis) //throws IOException
{ {
MoveEntityPacket::read(dis); MoveEntityPacket::read(dis);
xa = (int8_t)dis->readByte(); xa = (int)dis->readByte();
ya = (int8_t)dis->readByte(); ya = (int)dis->readByte();
za = (int8_t)dis->readByte(); za = (int)dis->readByte();
} }
void MoveEntityPacket::Pos::write(DataOutputStream *dos) //throws IOException void MoveEntityPacket::Pos::write(DataOutputStream *dos) //throws IOException
{ {
MoveEntityPacket::write(dos); MoveEntityPacket::write(dos);
dos->writeByte((uint8_t)(xa & 0xFF)); dos->writeByte((uint8_t)xa);
dos->writeByte((uint8_t)(ya & 0xFF)); dos->writeByte((uint8_t)ya);
dos->writeByte((uint8_t)(za & 0xFF)); dos->writeByte((uint8_t)za);
} }
int MoveEntityPacket::Pos::getEstimatedSize() int MoveEntityPacket::Pos::getEstimatedSize()
@ -141,7 +141,7 @@ MoveEntityPacket::Rot::Rot()
hasRot = true; hasRot = true;
} }
MoveEntityPacket::Rot::Rot(int id, int8_t yRot, int8_t xRot) : MoveEntityPacket(id) MoveEntityPacket::Rot::Rot(int id, char yRot, char xRot) : MoveEntityPacket(id)
{ {
this->yRot = yRot; this->yRot = yRot;
this->xRot = xRot; this->xRot = xRot;
@ -151,15 +151,15 @@ MoveEntityPacket::Rot::Rot(int id, int8_t yRot, int8_t xRot) : MoveEntityPacket(
void MoveEntityPacket::Rot::read(DataInputStream *dis) //throws IOException void MoveEntityPacket::Rot::read(DataInputStream *dis) //throws IOException
{ {
MoveEntityPacket::read(dis); MoveEntityPacket::read(dis);
yRot = (int8_t)dis->readByte(); yRot = (int)dis->readByte();
xRot = (int8_t)dis->readByte(); xRot = (int)dis->readByte();
} }
void MoveEntityPacket::Rot::write(DataOutputStream *dos) //throws IOException void MoveEntityPacket::Rot::write(DataOutputStream *dos) //throws IOException
{ {
MoveEntityPacket::write(dos); MoveEntityPacket::write(dos);
dos->writeByte((uint8_t)(yRot & 0xFF)); dos->writeByte((uint8_t)yRot);
dos->writeByte((uint8_t)(xRot & 0xFF)); dos->writeByte((uint8_t)xRot);
} }
int MoveEntityPacket::Rot::getEstimatedSize() int MoveEntityPacket::Rot::getEstimatedSize()

View file

@ -13,7 +13,7 @@ public:
class Rot; class Rot;
int id; int id;
int8_t xa, ya, za, yRot, xRot; char xa, ya, za, yRot, xRot;
bool hasRot; bool hasRot;
MoveEntityPacket(); MoveEntityPacket();
@ -35,7 +35,7 @@ class MoveEntityPacket::PosRot : public MoveEntityPacket
{ {
public: public:
PosRot(); PosRot();
PosRot(int id, int8_t xa, int8_t ya, int8_t za, int8_t yRot, int8_t xRot); PosRot(int id, char xa, char ya, char za, char yRot, char xRot);
virtual void read(DataInputStream *dis); virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos); virtual void write(DataOutputStream *dos);
@ -50,7 +50,7 @@ class MoveEntityPacket::Pos : public MoveEntityPacket
{ {
public: public:
Pos(); Pos();
Pos(int id, int8_t xa, int8_t ya, int8_t za); Pos(int id, char xa, char ya, char za);
virtual void read(DataInputStream *dis); virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos); virtual void write(DataOutputStream *dos);
@ -65,7 +65,7 @@ class MoveEntityPacket::Rot : public MoveEntityPacket
{ {
public: public:
Rot(); Rot();
Rot(int id, int8_t yRot, int8_t xRot); Rot(int id, char yRot, char xRot);
virtual void read(DataInputStream *dis); virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos); virtual void write(DataOutputStream *dos);

View file

@ -1,6 +1,5 @@
#include "../../Platform/stdafx.h" #include "../../Platform/stdafx.h"
#include <iostream> #include <iostream>
#include <limits>
#include "../../IO/Streams/InputOutputStream.h" #include "../../IO/Streams/InputOutputStream.h"
#include "PacketListener.h" #include "PacketListener.h"
#include "MoveEntityPacketSmall.h" #include "MoveEntityPacketSmall.h"
@ -20,9 +19,20 @@ MoveEntityPacketSmall::MoveEntityPacketSmall()
MoveEntityPacketSmall::MoveEntityPacketSmall(int id) MoveEntityPacketSmall::MoveEntityPacketSmall(int id)
{ {
if( (id < 0 ) || (id >= 2048 ) )
{
// We shouln't be tracking an entity that doesn't have a short type of id
__debugbreak();
}
this->id = id; this->id = id;
hasRot = false; hasRot = false;
xa = ya = za = yRot = xRot = 0;
xa = 0;
ya = 0;
za = 0;
yRot = 0;
xRot = 0;
} }
void MoveEntityPacketSmall::read(DataInputStream *dis) //throws IOException void MoveEntityPacketSmall::read(DataInputStream *dis) //throws IOException
@ -32,7 +42,7 @@ void MoveEntityPacketSmall::read(DataInputStream *dis) //throws IOException
void MoveEntityPacketSmall::write(DataOutputStream *dos) //throws IOException void MoveEntityPacketSmall::write(DataOutputStream *dos) //throws IOException
{ {
if(id < 0 || id > std::numeric_limits<int16_t>::max() ) if( (id < 0 ) || (id >= 2048 ) )
{ {
// We shouln't be tracking an entity that doesn't have a short type of id // We shouln't be tracking an entity that doesn't have a short type of id
__debugbreak(); __debugbreak();
@ -66,7 +76,7 @@ MoveEntityPacketSmall::PosRot::PosRot()
hasRot = true; hasRot = true;
} }
MoveEntityPacketSmall::PosRot::PosRot(int id, int8_t xa, int8_t ya, int8_t za, int8_t yRot, int8_t xRot) : MoveEntityPacketSmall( id ) MoveEntityPacketSmall::PosRot::PosRot(int id, char xa, char ya, char za, char yRot, char xRot) : MoveEntityPacketSmall( id )
{ {
this->xa = xa; this->xa = xa;
this->ya = ya; this->ya = ya;
@ -78,34 +88,38 @@ MoveEntityPacketSmall::PosRot::PosRot(int id, int8_t xa, int8_t ya, int8_t za, i
void MoveEntityPacketSmall::PosRot::read(DataInputStream *dis) //throws IOException void MoveEntityPacketSmall::PosRot::read(DataInputStream *dis) //throws IOException
{ {
MoveEntityPacketSmall::read(dis); int idAndRot = dis->readShort();
xa = (int8_t)dis->readByte(); this->id = idAndRot & 0x07ff;
ya = (int8_t)dis->readByte(); this->yRot = idAndRot >> 11;
za = (int8_t)dis->readByte(); int xAndYAndZ = (int)dis->readShort();
yRot = (int8_t)dis->readByte(); this->xa = xAndYAndZ >> 11;
xRot = (int8_t)dis->readByte(); this->ya = (xAndYAndZ << 21 ) >> 26;
this->za = (xAndYAndZ << 27 ) >> 27;
} }
void MoveEntityPacketSmall::PosRot::write(DataOutputStream *dos) //throws IOException void MoveEntityPacketSmall::PosRot::write(DataOutputStream *dos) //throws IOException
{ {
MoveEntityPacketSmall::write(dos); if( (id < 0 ) || (id >= 2048 ) )
dos->writeByte((uint8_t)(xa & 0xFF)); {
dos->writeByte((uint8_t)(ya & 0xFF)); // We shouln't be tracking an entity that doesn't have a short type of id
dos->writeByte((uint8_t)(za & 0xFF)); __debugbreak();
dos->writeByte((uint8_t)(yRot & 0xFF)); }
dos->writeByte((uint8_t)(xRot & 0xFF)); short idAndRot = id | yRot << 11;
dos->writeShort(idAndRot);
short xAndYAndZ = ( xa << 11 ) | ( ( ya & 0x3f ) << 5 ) | ( za & 0x1f );
dos->writeShort(xAndYAndZ);
} }
int MoveEntityPacketSmall::PosRot::getEstimatedSize() int MoveEntityPacketSmall::PosRot::getEstimatedSize()
{ {
return 2+5; return 4;
} }
MoveEntityPacketSmall::Pos::Pos() MoveEntityPacketSmall::Pos::Pos()
{ {
} }
MoveEntityPacketSmall::Pos::Pos(int id, int8_t xa, int8_t ya, int8_t za) : MoveEntityPacketSmall(id) MoveEntityPacketSmall::Pos::Pos(int id, char xa, char ya, char za) : MoveEntityPacketSmall(id)
{ {
this->xa = xa; this->xa = xa;
this->ya = ya; this->ya = ya;
@ -114,23 +128,30 @@ MoveEntityPacketSmall::Pos::Pos(int id, int8_t xa, int8_t ya, int8_t za) : MoveE
void MoveEntityPacketSmall::Pos::read(DataInputStream *dis) //throws IOException void MoveEntityPacketSmall::Pos::read(DataInputStream *dis) //throws IOException
{ {
MoveEntityPacketSmall::read(dis); int idAndY = dis->readShort();
xa = (int8_t)dis->readByte(); this->id = idAndY & 0x07ff;
ya = (int8_t)dis->readByte(); this->ya = idAndY >> 11;
za = (int8_t)dis->readByte(); int XandZ = (int)((signed char)(dis->readByte()));
xa = XandZ >> 4;
za = ( XandZ << 28 ) >> 28;
} }
void MoveEntityPacketSmall::Pos::write(DataOutputStream *dos) //throws IOException void MoveEntityPacketSmall::Pos::write(DataOutputStream *dos) //throws IOException
{ {
MoveEntityPacketSmall::write(dos); if( (id < 0 ) || (id >= 2048 ) )
dos->writeByte((uint8_t)(xa & 0xFF)); {
dos->writeByte((uint8_t)(ya & 0xFF)); // We shouln't be tracking an entity that doesn't have a short type of id
dos->writeByte((uint8_t)(za & 0xFF)); __debugbreak();
}
short idAndY = id | ya << 11;
dos->writeShort(idAndY);
char XandZ = ( xa << 4 ) | ( za & 0x0f );
dos->writeByte((uint8_t)XandZ);
} }
int MoveEntityPacketSmall::Pos::getEstimatedSize() int MoveEntityPacketSmall::Pos::getEstimatedSize()
{ {
return 2+3; return 3;
} }
MoveEntityPacketSmall::Rot::Rot() MoveEntityPacketSmall::Rot::Rot()
@ -138,7 +159,7 @@ MoveEntityPacketSmall::Rot::Rot()
hasRot = true; hasRot = true;
} }
MoveEntityPacketSmall::Rot::Rot(int id, int8_t yRot, int8_t xRot) : MoveEntityPacketSmall(id) MoveEntityPacketSmall::Rot::Rot(int id, char yRot, char xRot) : MoveEntityPacketSmall(id)
{ {
this->yRot = yRot; this->yRot = yRot;
@ -148,17 +169,23 @@ MoveEntityPacketSmall::Rot::Rot(int id, int8_t yRot, int8_t xRot) : MoveEntityPa
void MoveEntityPacketSmall::Rot::read(DataInputStream *dis) //throws IOException void MoveEntityPacketSmall::Rot::read(DataInputStream *dis) //throws IOException
{ {
MoveEntityPacketSmall::read(dis); int idAndRot = (int)dis->readShort();
yRot = (int8_t)dis->readByte(); this->id = idAndRot & 0x07ff;
this->yRot = idAndRot >> 11;
} }
void MoveEntityPacketSmall::Rot::write(DataOutputStream *dos) //throws IOException void MoveEntityPacketSmall::Rot::write(DataOutputStream *dos) //throws IOException
{ {
MoveEntityPacketSmall::write(dos); if( (id < 0 ) || (id >= 2048 ) )
dos->writeByte((uint8_t)(yRot & 0xFF)); {
// We shouln't be tracking an entity that doesn't have a short type of id
__debugbreak();
}
short idAndRot = id | yRot << 11;
dos->writeShort(idAndRot);
} }
int MoveEntityPacketSmall::Rot::getEstimatedSize() int MoveEntityPacketSmall::Rot::getEstimatedSize()
{ {
return 2+1; return 2;
} }

View file

@ -13,8 +13,8 @@ public:
class Rot; class Rot;
int id; int id;
int8_t xa, ya, za, yRot, xRot; char xa, ya, za, yRot, xRot;
bool hasRot; bool hasRot;
MoveEntityPacketSmall(); MoveEntityPacketSmall();
MoveEntityPacketSmall(int id); MoveEntityPacketSmall(int id);
@ -34,8 +34,8 @@ public:
class MoveEntityPacketSmall::PosRot : public MoveEntityPacketSmall class MoveEntityPacketSmall::PosRot : public MoveEntityPacketSmall
{ {
public: public:
PosRot(); PosRot();
PosRot(int id, int8_t xa, int8_t ya, int8_t za, int8_t yRot, int8_t xRot); PosRot(int id, char xa, char ya, char za, char yRot, char xRot);
virtual void read(DataInputStream *dis); virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos); virtual void write(DataOutputStream *dos);
@ -50,7 +50,7 @@ class MoveEntityPacketSmall::Pos : public MoveEntityPacketSmall
{ {
public: public:
Pos(); Pos();
Pos(int id, int8_t xa, int8_t ya, int8_t za); Pos(int id, char xa, char ya, char za);
virtual void read(DataInputStream *dis); virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos); virtual void write(DataOutputStream *dos);
@ -66,7 +66,7 @@ class MoveEntityPacketSmall::Rot : public MoveEntityPacketSmall
{ {
public: public:
Rot(); Rot();
Rot(int id, int8_t yRot, int8_t xRot); Rot(int id, char yRot, char xRot);
virtual void read(DataInputStream *dis); virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos); virtual void write(DataOutputStream *dos);

View file

@ -17,11 +17,19 @@ void SetEntityMotionPacket::_init(int id, double xd, double yd, double zd)
if (xd > m) xd = m; if (xd > m) xd = m;
if (yd > m) yd = m; if (yd > m) yd = m;
if (zd > m) zd = m; if (zd > m) zd = m;
xa = (int16_t) (xd * 8000.0); xa = (int) (xd * 8000.0);
ya = (int16_t) (yd * 8000.0); ya = (int) (yd * 8000.0);
za = (int16_t) (zd * 8000.0); za = (int) (zd * 8000.0);
// 4J - if we could transmit this as bytes (in 1/16 accuracy) then flag to do so
useBytes = false; if( ( xa >= (-128 * 16 ) ) && ( ya >= (-128 * 16 ) ) && ( za >= (-128 * 16 ) ) &&
( xa < (128 * 16 ) ) && ( ya < (128 * 16 ) ) && ( za < (128 * 16 ) ) )
{
useBytes = true;
}
else
{
useBytes = false;
}
} }
SetEntityMotionPacket::SetEntityMotionPacket() SetEntityMotionPacket::SetEntityMotionPacket()
@ -41,22 +49,46 @@ SetEntityMotionPacket::SetEntityMotionPacket(int id, double xd, double yd, doubl
void SetEntityMotionPacket::read(DataInputStream *dis) //throws IOException void SetEntityMotionPacket::read(DataInputStream *dis) //throws IOException
{ {
id = dis->readShort(); short idAndFlag = dis->readShort();
id = idAndFlag & 0x07ff;
xa = dis->readShort(); if( idAndFlag & 0x0800 )
ya = dis->readShort(); {
za = dis->readShort(); xa = (int)dis->readByte();
ya = (int)dis->readByte();
useBytes = false; za = (int)dis->readByte();
xa = ( xa << 24 ) >> 24;
ya = ( ya << 24 ) >> 24;
za = ( za << 24 ) >> 24;
xa *= 16;
ya *= 16;
za *= 16;
useBytes = true;
}
else
{
xa = dis->readShort();
ya = dis->readShort();
za = dis->readShort();
useBytes = false;
}
} }
void SetEntityMotionPacket::write(DataOutputStream *dos) //throws IOException void SetEntityMotionPacket::write(DataOutputStream *dos) //throws IOException
{ {
dos->writeShort(id); if( useBytes )
{
dos->writeShort(xa); dos->writeShort(id | 0x800);
dos->writeShort(ya); dos->writeByte(xa/16);
dos->writeShort(za); dos->writeByte(ya/16);
dos->writeByte(za/16);
}
else
{
dos->writeShort(id);
dos->writeShort(xa);
dos->writeShort(ya);
dos->writeShort(za);
}
} }
void SetEntityMotionPacket::handle(PacketListener *listener) void SetEntityMotionPacket::handle(PacketListener *listener)
@ -66,7 +98,7 @@ void SetEntityMotionPacket::handle(PacketListener *listener)
int SetEntityMotionPacket::getEstimatedSize() int SetEntityMotionPacket::getEstimatedSize()
{ {
return 8; return useBytes ? 5 : 8;
} }
bool SetEntityMotionPacket::canBeInvalidated() bool SetEntityMotionPacket::canBeInvalidated()

View file

@ -7,7 +7,7 @@ class SetEntityMotionPacket : public Packet, public std::enable_shared_from_this
{ {
public: public:
int id; int id;
int16_t xa, ya, za; int xa, ya, za;
bool useBytes; // 4J added bool useBytes; // 4J added
private: private:

View file

@ -27,7 +27,7 @@ TeleportEntityPacket::TeleportEntityPacket(std::shared_ptr<Entity> e)
xRot = (uint8_t) (e->xRot * 256 / 360); xRot = (uint8_t) (e->xRot * 256 / 360);
} }
TeleportEntityPacket::TeleportEntityPacket(int id, int32_t x, int32_t y, int32_t z, uint8_t yRot, uint8_t xRot) TeleportEntityPacket::TeleportEntityPacket(int id, int x, int y, int z, uint8_t yRot, uint8_t xRot)
{ {
this->id = id; this->id = id;
this->x = x; this->x = x;
@ -55,10 +55,16 @@ void TeleportEntityPacket::read(DataInputStream *dis) //throws IOException
void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException
{ {
dos->writeShort((short)id); dos->writeShort(id);
#ifdef _LARGE_WORLDS
dos->writeInt(x); dos->writeInt(x);
dos->writeInt(y); dos->writeInt(y);
dos->writeInt(z); dos->writeInt(z);
#else
dos->writeShort(x);
dos->writeShort(y);
dos->writeShort(z);
#endif
dos->write(yRot); dos->write(yRot);
dos->write(xRot); dos->write(xRot);
} }

View file

@ -7,19 +7,19 @@ class TeleportEntityPacket : public Packet, public std::enable_shared_from_this<
{ {
public: public:
int id; int id;
int32_t x, y, z; int x, y, z;
uint8_t yRot, xRot; uint8_t yRot, xRot;
TeleportEntityPacket(); TeleportEntityPacket();
TeleportEntityPacket(std::shared_ptr<Entity> e); TeleportEntityPacket(std::shared_ptr<Entity> e);
TeleportEntityPacket(int id, int32_t x, int32_t y, int32_t z, uint8_t yRot, uint8_t xRot); TeleportEntityPacket(int id, int x, int y, int z, uint8_t yRot, uint8_t xRot);
virtual void read(DataInputStream *dis); virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos); virtual void write(DataOutputStream *dos);
virtual void handle(PacketListener *listener); virtual void handle(PacketListener *listener);
virtual int getEstimatedSize(); virtual int getEstimatedSize();
virtual bool canBeInvalidated(); virtual bool canBeInvalidated();
virtual bool isInvalidatedBy(std::shared_ptr<Packet> packet); virtual bool isInvalidatedBy(std::shared_ptr<Packet> packet);
public: public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new TeleportEntityPacket()); } static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new TeleportEntityPacket()); }