12#include <unordered_map>
40 return "player.speed";
42 return "player.health";
44 return "player.fireRate";
46 return "player.damage";
48 return "player.spawnX";
50 return "player.spawnY";
52 return "game.speedMultiplier";
63 inline std::optional<GameruleKey>
fromString(
const std::string &str) {
64 static const std::unordered_map<std::string, GameruleKey>
map = {
73 auto it =
map.find(str);
74 if (it !=
map.end()) {
81 [[deprecated(
"Use GameruleKey::PLAYER_SPEED with GameruleKeys::toString() instead")]]
84 [[deprecated(
"Use GameruleKey::PLAYER_HEALTH with GameruleKeys::toString() instead")]]
87 [[deprecated(
"Use GameruleKey::PLAYER_FIRE_RATE with GameruleKeys::toString() instead")]]
90 [[deprecated(
"Use GameruleKey::PLAYER_DAMAGE with GameruleKeys::toString() instead")]]
93 [[deprecated(
"Use GameruleKey::PLAYER_SPAWN_X with GameruleKeys::toString() instead")]]
96 [[deprecated(
"Use GameruleKey::PLAYER_SPAWN_Y with GameruleKeys::toString() instead")]]
GameruleKey
Type-safe enum for gamerule identifiers.
@ GAME_SPEED_MULTIPLIER
Game speed multiplier (0.25 to 1.0, accessibility feature)
const char * toString(GameruleKey key)
Convert GameruleKey enum to string.
std::optional< GameruleKey > fromString(const std::string &str)
Convert string to GameruleKey enum (optional, for deserialization)
static constexpr const char * PLAYER_SPAWN_X
static constexpr const char * PLAYER_SPAWN_Y
static constexpr const char * PLAYER_HEALTH
static constexpr const char * PLAYER_SPEED
static constexpr const char * PLAYER_FIRE_RATE
static constexpr const char * PLAYER_DAMAGE