TU19: merge Minecraft.World/Network

This commit is contained in:
Tropical
2026-03-21 18:09:02 -05:00
parent 0f280b5ed3
commit 11a0440998
66 changed files with 1355 additions and 462 deletions

View File

@@ -5,41 +5,32 @@
#include "PlayerInputPacket.h"
PlayerInputPacket::PlayerInputPacket() {
xa = 0.0f;
ya = 0.0f;
xxa = 0.0f;
yya = 0.0f;
isJumpingVar = false;
isSneakingVar = false;
xRot = 0.0f;
yRot = 0.0f;
}
PlayerInputPacket::PlayerInputPacket(float xa, float ya, bool isJumpingVar,
bool isSneakingVar, float xRot,
float yRot) {
this->xa = xa;
this->ya = ya;
PlayerInputPacket::PlayerInputPacket(float xxa, float yya, bool isJumpingVar,
bool isSneakingVar) {
this->xxa = xxa;
this->yya = yya;
this->isJumpingVar = isJumpingVar;
this->isSneakingVar = isSneakingVar;
this->xRot = xRot;
this->yRot = yRot;
}
void PlayerInputPacket::read(DataInputStream* dis) // throws IOException
{
xa = dis->readFloat();
ya = dis->readFloat();
xRot = dis->readFloat();
yRot = dis->readFloat();
xxa = dis->readFloat();
yya = dis->readFloat();
isJumpingVar = dis->readBoolean();
isSneakingVar = dis->readBoolean();
}
void PlayerInputPacket::write(DataOutputStream* dos) // throws IOException
{
dos->writeFloat(xa);
dos->writeFloat(ya);
dos->writeFloat(xRot);
dos->writeFloat(yRot);
dos->writeFloat(xxa);
dos->writeFloat(yya);
dos->writeBoolean(isJumpingVar);
dos->writeBoolean(isSneakingVar);
}
@@ -48,15 +39,11 @@ void PlayerInputPacket::handle(PacketListener* listener) {
listener->handlePlayerInput(shared_from_this());
}
int PlayerInputPacket::getEstimatedSize() { return 18; }
int PlayerInputPacket::getEstimatedSize() { return 10; }
float PlayerInputPacket::getXa() { return xa; }
float PlayerInputPacket::getXxa() { return xxa; }
float PlayerInputPacket::getXRot() { return xRot; }
float PlayerInputPacket::getYa() { return ya; }
float PlayerInputPacket::getYRot() { return yRot; }
float PlayerInputPacket::getYya() { return yya; }
bool PlayerInputPacket::isJumping() { return isJumpingVar; }