net.morbz.minecraft.level
Class Level

java.lang.Object
  extended by net.morbz.minecraft.level.Level
All Implemented Interfaces:
ITagProvider

public class Level
extends java.lang.Object
implements ITagProvider

The level defines the settings for the world. Like game mode, spawn point, etc.

Author:
MorbZ

Constructor Summary
Level(java.lang.String levelName)
          Creates a new instance.
Level(java.lang.String levelName, IGenerator generator)
          Creates a new instance.
 
Method Summary
 boolean getAllowCommands()
           
 GameType getGameType()
           
 java.lang.String getLevelName()
           
 boolean getMapFeatures()
           
 long getRandomSeed()
           
 org.jnbt.Tag getTag()
          Returns an instance of a subclass of the NBT-Tag class.
 void setAllowCommands(boolean allowCommands)
           
 void setGameType(GameType gameType)
           
 void setMapFeatures(boolean mapFeatures)
           
 void setRandomSeed(long randomSeed)
           
 void setSpawnPoint(int x, int y, int z)
          Sets the default world spawn position.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Level

public Level(java.lang.String levelName)
Creates a new instance. The default level generator is 'FlatGenerator'.

Parameters:
levelName - The name of the world. This value is also used as directory name for the generated world.

Level

public Level(java.lang.String levelName,
             IGenerator generator)
Creates a new instance.

Parameters:
levelName - The name of the world. This value is also used as directory name for the generated world.
generator - The generator that is used for the world.
Method Detail

getLevelName

public java.lang.String getLevelName()
Returns:
The name of the world. This value is also used as directory name for the generated world.

getAllowCommands

public boolean getAllowCommands()
Returns:
If cheats are allowed. The default value is 'false'.

setAllowCommands

public void setAllowCommands(boolean allowCommands)
Parameters:
allowCommands - If cheats are allowed. The default value is 'false'.

getMapFeatures

public boolean getMapFeatures()
Returns:
If structures like villages, mineshafts, etc. should be generated. The default value is 'true'.

setMapFeatures

public void setMapFeatures(boolean mapFeatures)
Parameters:
mapFeatures - If structures like villages, mineshafts, etc. should be generated. The default value is 'true'.

getGameType

public GameType getGameType()
Returns:
The game mode. The default value is 'GameType.CREATIVE'.

setGameType

public void setGameType(GameType gameType)
Parameters:
gameType - The game mode. The default value is 'GameType.CREATIVE'.

setSpawnPoint

public void setSpawnPoint(int x,
                          int y,
                          int z)
Sets the default world spawn position. In singleplayer mode the player will be spawned within 20x20 blocks around this position. The default values are '0'.

Parameters:
x - The X-coordinate
y - The Y-coordinate
z - The Z-coordinate

getRandomSeed

public long getRandomSeed()
Returns:
The random seed that is used for world generation. The default value is a random positive long.

setRandomSeed

public void setRandomSeed(long randomSeed)
Parameters:
randomSeed - The random seed that is used for world generation. The default value is a random positive long.

getTag

public org.jnbt.Tag getTag()
Returns an instance of a subclass of the NBT-Tag class.

Specified by:
getTag in interface ITagProvider
Returns:
The Tag representation of this class