mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-04-06 15:33:32 +00:00
65 lines
1.4 KiB
C++
Executable File
65 lines
1.4 KiB
C++
Executable File
#ifndef NET_MINECRAFT_WORLD_LEVEL__LevelSettings_H__
|
|
#define NET_MINECRAFT_WORLD_LEVEL__LevelSettings_H__
|
|
|
|
//package net.minecraft.world.level;
|
|
|
|
namespace GameType {
|
|
const int Undefined = -1;
|
|
const int Survival = 0;
|
|
const int Creative = 1;
|
|
|
|
const int Default = Creative;
|
|
}
|
|
|
|
class LevelSettings
|
|
{
|
|
public:
|
|
LevelSettings(long seed, int gameType, bool allowCheats = false)
|
|
: seed(seed),
|
|
gameType(gameType),
|
|
allowCheats(allowCheats)
|
|
{
|
|
}
|
|
static LevelSettings None() {
|
|
return LevelSettings(-1,-1,false);
|
|
}
|
|
|
|
long getSeed() const {
|
|
return seed;
|
|
}
|
|
|
|
int getGameType() const {
|
|
return gameType;
|
|
}
|
|
|
|
bool getAllowCheats() const {
|
|
return allowCheats;
|
|
}
|
|
|
|
//
|
|
// Those two should actually not be here
|
|
// @todo: Move out when we add LevelSettings.cpp :p
|
|
//
|
|
static int validateGameType(int gameType) {
|
|
switch (gameType) {
|
|
case GameType::Creative:
|
|
case GameType::Survival:
|
|
return gameType;
|
|
}
|
|
return GameType::Default;
|
|
}
|
|
|
|
static std::string gameTypeToString(int gameType) {
|
|
if (gameType == GameType::Survival) return "Survival";
|
|
if (gameType == GameType::Creative) return "Creative";
|
|
return "Undefined";
|
|
}
|
|
|
|
private:
|
|
const long seed;
|
|
const int gameType;
|
|
const bool allowCheats;
|
|
};
|
|
|
|
#endif /*NET_MINECRAFT_WORLD_LEVEL__LevelSettings_H__*/
|