blob: 04aebf0fd87bced1d193c01be5ae643b02445801 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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;
}
|