blob: 060068602e82efcf07071de6d35f4d0a63c15194 (
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
70
71
72
73
74
75
76
77
|
#include "stdafx.h"
#include "com.mojang.nbt.h"
#include "Abilities.h"
Abilities::Abilities()
{
invulnerable = false;
flying = false;
mayfly = false;
instabuild = false;
mayBuild = true;
flyingSpeed = 0.05f;
walkingSpeed = 0.1f;
#ifdef _DEBUG_MENUS_ENABLED
debugflying = false;
#endif
}
void Abilities::addSaveData(CompoundTag *parentTag)
{
CompoundTag *tag = new CompoundTag();
tag->putBoolean(L"invulnerable", invulnerable);
tag->putBoolean(L"flying", flying);
tag->putBoolean(L"mayfly", mayfly);
tag->putBoolean(L"instabuild", instabuild);
tag->putBoolean(L"mayBuild", mayBuild);
tag->putFloat(L"flySpeed", flyingSpeed);
tag->putFloat(L"walkSpeed", walkingSpeed);
parentTag->put(L"abilities", tag);
}
void Abilities::loadSaveData(CompoundTag *parentTag)
{
if (parentTag->contains(L"abilities"))
{
CompoundTag *tag = parentTag->getCompound(L"abilities");
invulnerable = tag->getBoolean(L"invulnerable");
flying = tag->getBoolean(L"flying");
mayfly = tag->getBoolean(L"mayfly");
instabuild = tag->getBoolean(L"instabuild");
if (tag->contains(L"flySpeed"))
{
flyingSpeed = tag->getFloat(L"flySpeed");
walkingSpeed = tag->getFloat(L"walkSpeed");
}
if (tag->contains(L"mayBuild"))
{
mayBuild = tag->getBoolean(L"mayBuild");
}
}
}
float Abilities::getFlyingSpeed()
{
return flyingSpeed;
}
void Abilities::setFlyingSpeed(float value)
{
this->flyingSpeed = value;
}
float Abilities::getWalkingSpeed()
{
return walkingSpeed;
}
void Abilities::setWalkingSpeed(float value)
{
this->walkingSpeed = value;
}
|