4th batch

This commit is contained in:
Leah Anderson
2026-03-02 12:00:59 -07:00
parent 9cfc2e5b16
commit 79c1737c34
33 changed files with 94 additions and 93 deletions

View File

@@ -14,8 +14,8 @@ AddMobPacket::AddMobPacket()
x = 0;
y = 0;
z = 0;
yRot = static_cast<std::byte>(0);
xRot = static_cast<std::byte>(0);
yRot = static_cast<byte>(0);
xRot = static_cast<byte>(0);
entityData = nullptr;
unpack = NULL;
}
@@ -36,9 +36,9 @@ AddMobPacket::AddMobPacket(shared_ptr<Mob> mob, int yRotp, int xRotp, int xp, in
y = yp;//Mth::floor(mob->y * 32);
z = zp;//Mth::floor(mob->z * 32);
// 4J - changed - send current "previously sent" value of rotations to put this in sync with other clients
yRot = static_cast<std::byte>(yRotp);
xRot = static_cast<std::byte>(xRotp);
yHeadRot = static_cast<std::byte>(yHeadRotp);
yRot = static_cast<byte>(yRotp);
xRot = static_cast<byte>(xRotp);
yHeadRot = static_cast<byte>(yHeadRotp);
// yRot = (byte) (mob->yRot * 256 / 360);
// xRot = (byte) (mob->xRot * 256 / 360);
// yHeadRot = (byte) (mob->yHeadRot * 256 / 360);
@@ -67,7 +67,7 @@ AddMobPacket::AddMobPacket(shared_ptr<Mob> mob, int yRotp, int xRotp, int xp, in
void AddMobPacket::read(DataInputStream *dis) //throws IOException
{
id = dis->readShort();
type = std::to_integer<int>(dis->readByte()) & 0xff;
type = static_cast<int>(dis->readByte()) & 0xff;
#ifdef _LARGE_WORLDS
x = dis->readInt();
y = dis->readInt();
@@ -91,7 +91,7 @@ void AddMobPacket::read(DataInputStream *dis) //throws IOException
void AddMobPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeShort(id);
dos->writeByte(static_cast<std::byte>(type & 0xff));
dos->writeByte(static_cast<byte>(type & 0xff));
#ifdef _LARGE_WORLDS
dos->writeInt(x);
dos->writeInt(y);