mirror of
https://github.com/DrPerkyLegit/LCEServerTest.git
synced 2026-05-22 11:34:33 +00:00
removed git history
This commit is contained in:
69
Minecraft.World/PlayerInputPacket.cpp
Normal file
69
Minecraft.World/PlayerInputPacket.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "stdafx.h"
|
||||
#include <iostream>
|
||||
#include "InputOutputStream.h"
|
||||
#include "PacketListener.h"
|
||||
#include "PlayerInputPacket.h"
|
||||
|
||||
|
||||
|
||||
PlayerInputPacket::PlayerInputPacket()
|
||||
{
|
||||
xxa = 0.0f;
|
||||
yya = 0.0f;
|
||||
isJumpingVar = false;
|
||||
isSneakingVar = false;
|
||||
}
|
||||
|
||||
PlayerInputPacket::PlayerInputPacket(float xxa, float yya, bool isJumpingVar, bool isSneakingVar)
|
||||
{
|
||||
this->xxa = xxa;
|
||||
this->yya = yya;
|
||||
this->isJumpingVar = isJumpingVar;
|
||||
this->isSneakingVar = isSneakingVar;
|
||||
}
|
||||
|
||||
void PlayerInputPacket::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
xxa = dis->readFloat();
|
||||
yya = dis->readFloat();
|
||||
isJumpingVar = dis->readBoolean();
|
||||
isSneakingVar = dis->readBoolean();
|
||||
}
|
||||
|
||||
void PlayerInputPacket::write(DataOutputStream *dos) //throws IOException
|
||||
{
|
||||
dos->writeFloat(xxa);
|
||||
dos->writeFloat(yya);
|
||||
dos->writeBoolean(isJumpingVar);
|
||||
dos->writeBoolean(isSneakingVar);
|
||||
}
|
||||
|
||||
void PlayerInputPacket::handle(PacketListener *listener)
|
||||
{
|
||||
listener->handlePlayerInput(shared_from_this());
|
||||
}
|
||||
|
||||
int PlayerInputPacket::getEstimatedSize()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
float PlayerInputPacket::getXxa()
|
||||
{
|
||||
return xxa;
|
||||
}
|
||||
|
||||
float PlayerInputPacket::getYya()
|
||||
{
|
||||
return yya;
|
||||
}
|
||||
|
||||
bool PlayerInputPacket::isJumping()
|
||||
{
|
||||
return isJumpingVar;
|
||||
}
|
||||
|
||||
bool PlayerInputPacket::isSneaking()
|
||||
{
|
||||
return isSneakingVar;
|
||||
}
|
||||
Reference in New Issue
Block a user