the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 77 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "com.mojang.nbt.h" 3#include "Abilities.h" 4 5Abilities::Abilities() 6{ 7 invulnerable = false; 8 flying = false; 9 mayfly = false; 10 instabuild = false; 11 mayBuild = true; 12 flyingSpeed = 0.05f; 13 walkingSpeed = 0.1f; 14 15#ifdef _DEBUG_MENUS_ENABLED 16 debugflying = false; 17#endif 18} 19 20void Abilities::addSaveData(CompoundTag *parentTag) 21{ 22 CompoundTag *tag = new CompoundTag(); 23 24 tag->putBoolean(L"invulnerable", invulnerable); 25 tag->putBoolean(L"flying", flying); 26 tag->putBoolean(L"mayfly", mayfly); 27 tag->putBoolean(L"instabuild", instabuild); 28 tag->putBoolean(L"mayBuild", mayBuild); 29 tag->putFloat(L"flySpeed", flyingSpeed); 30 tag->putFloat(L"walkSpeed", walkingSpeed); 31 32 parentTag->put(L"abilities", tag); 33 34} 35 36void Abilities::loadSaveData(CompoundTag *parentTag) 37{ 38 if (parentTag->contains(L"abilities")) 39 { 40 CompoundTag *tag = parentTag->getCompound(L"abilities"); 41 42 invulnerable = tag->getBoolean(L"invulnerable"); 43 flying = tag->getBoolean(L"flying"); 44 mayfly = tag->getBoolean(L"mayfly"); 45 instabuild = tag->getBoolean(L"instabuild"); 46 47 if (tag->contains(L"flySpeed")) 48 { 49 flyingSpeed = tag->getFloat(L"flySpeed"); 50 walkingSpeed = tag->getFloat(L"walkSpeed"); 51 } 52 if (tag->contains(L"mayBuild")) 53 { 54 mayBuild = tag->getBoolean(L"mayBuild"); 55 } 56 } 57} 58 59float Abilities::getFlyingSpeed() 60{ 61 return flyingSpeed; 62} 63 64void Abilities::setFlyingSpeed(float value) 65{ 66 flyingSpeed = value; 67} 68 69float Abilities::getWalkingSpeed() 70{ 71 return walkingSpeed; 72} 73 74void Abilities::setWalkingSpeed(float value) 75{ 76 walkingSpeed = value; 77}