Package rekit.persistence.level
Class LevelDefinition
java.lang.Object
rekit.persistence.level.LevelDefinition
- All Implemented Interfaces:
Comparable<LevelDefinition>
This class holds all necessary information about a level.
-
Constructor Summary
ConstructorsConstructorDescriptionLevelDefinition
(InputStream in, LevelType type) Create a new LevelDefinition by data and type.LevelDefinition
(InputStream in, LevelType type, long seed) Create a new LevelDefinition by data and type and rnd seed. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the amount of structures.int
boolean
Get alias by key.getBossSetting
(String key) Get boss-setting by key.Get the data of the level.getName()
Get the name of the level.Get the data of the level.long
getSeed()
Get the seed of the level.getSetting
(SettingKey key) Get setting by key.String[][]
getStructure
(int idx) Get structure by index.getType()
Get the type of the level.int
hashCode()
boolean
isSettingSet
(SettingKey key) Check whether a setting is set (== if setting is "true" or "false", return whether it is "true", otherwise return true if setting is set to a value)
-
Constructor Details
-
LevelDefinition
Create a new LevelDefinition by data and type.- Parameters:
in
- the input data (e.g. from file) of the leveltype
- the type of the level
-
LevelDefinition
Create a new LevelDefinition by data and type and rnd seed.- Parameters:
in
- the input data (e.g. from file) of the leveltype
- the type of the levelseed
- the random seed for the level
-
-
Method Details
-
getAlias
Get alias by key.- Parameters:
key
- the key- Returns:
- the alias or
null
if not set
-
getSetting
Get setting by key.- Parameters:
key
- the key- Returns:
- the setting or
null
if not set
-
isSettingSet
Check whether a setting is set (== if setting is "true" or "false", return whether it is "true", otherwise return true if setting is set to a value)- Parameters:
key
- the key- Returns:
true
if set,false
otherwise
-
getBossSetting
Get boss-setting by key.- Parameters:
key
- the key- Returns:
- the boss-setting or
null
if not set
-
getType
Get the type of the level.- Returns:
- the type
-
getName
Get the name of the level. (If no name is set, this will return the ID of the level.)- Returns:
- the name (or id)
-
getRawData
Get the data of the level.- Returns:
- the data
-
getData
Get the data of the level.- Parameters:
key
- the key- Returns:
- the data of the level or the default value of the
DataKey
if not set
-
getSeed
public long getSeed()Get the seed of the level.- Returns:
- the seed
-
amountOfStructures
public int amountOfStructures()Get the amount of structures.- Returns:
- the amount of structures
-
getStructure
Get structure by index.- Parameters:
idx
- the index- Returns:
- the structure
-
compareTo
- Specified by:
compareTo
in interfaceComparable<LevelDefinition>
-
hashCode
public int hashCode() -
equals
-