feat: allow parsing dimension from string
This commit is contained in:
parent
e74da435ea
commit
f0be394458
1 changed files with 13 additions and 0 deletions
|
@ -17,18 +17,31 @@ class Dimension(Enum):
|
||||||
NETHER = -1
|
NETHER = -1
|
||||||
OVERWORLD = 0
|
OVERWORLD = 0
|
||||||
END = 1
|
END = 1
|
||||||
|
UNKNOWN = 666
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_str(cls, txt:str) -> 'Dimension':
|
||||||
|
if txt == 'minecraft:overworld':
|
||||||
|
return Dimension.OVERWORLD
|
||||||
|
if txt == 'minecraft:the_nether':
|
||||||
|
return Dimension.NETHER
|
||||||
|
if txt == 'minecraft:the_end':
|
||||||
|
return Dimension.END
|
||||||
|
return Dimension.UNKNOWN
|
||||||
|
|
||||||
class Difficulty(Enum):
|
class Difficulty(Enum):
|
||||||
PEACEFUL = 0
|
PEACEFUL = 0
|
||||||
EASY = 1
|
EASY = 1
|
||||||
NORMAL = 2
|
NORMAL = 2
|
||||||
HARD = 3
|
HARD = 3
|
||||||
|
UNKNOWN = -1
|
||||||
|
|
||||||
class Gamemode(Enum):
|
class Gamemode(Enum):
|
||||||
SURVIVAL = 0
|
SURVIVAL = 0
|
||||||
CREATIVE = 1
|
CREATIVE = 1
|
||||||
ADVENTURE = 2
|
ADVENTURE = 2
|
||||||
SPECTATOR = 3
|
SPECTATOR = 3
|
||||||
|
UNKNOWN = -1
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class GameProfile:
|
class GameProfile:
|
||||||
|
|
Loading…
Reference in a new issue