mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-31 00:36:41 +00:00
TU19: merge Minecraft.World/Network
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user