Skip to content

API reference Obsidian.API

LevelData class

https://minecraft.wiki/w/Java_Edition_level_format

public sealed class LevelData

In Obsidian.API.

Constructors

public LevelData();

Properties

AllowCommands

public bool AllowCommands { get; set; }

1 or 0 (true/false) - true if cheats are enabled.

BorderCenterX

public double BorderCenterX { get; set; }

Center of the world border on the X coordinate. Defaults to 0.

BorderCenterZ

public double BorderCenterZ { get; set; }

Center of the world border on the Z coordinate. Defaults to 0.

BorderDamagePerBlock

public double BorderDamagePerBlock { get; set; }

Defaults to 0.2.

BorderSafeZone

public double BorderSafeZone { get; set; }

Defaults to 5.

BorderSize

public double BorderSize { get; set; }

Width and length of the border of the border. Defaults to 60000000.

BorderSizeLerpTarget

public double BorderSizeLerpTarget { get; set; }

Defaults to 60000000.

BorderSizeLerpTime

public long BorderSizeLerpTime { get; set; }

Defaults to 0.

BorderWarningBlocks

public double BorderWarningBlocks { get; set; }

Defaults to 5.

BorderWarningTime

public double BorderWarningTime { get; set; }

Defaults to 15.

ClearWeatherTime

public int ClearWeatherTime { get; set; }

The number of ticks until "clear weather" has ended.

DayTime

public int DayTime { get; set; }

The time of day. 0 is sunrise, 6000 is mid day, 12000 is sunset, 18000 is mid night, 24000 is the next day's 0.

DefaultGamemode

public GameMode DefaultGamemode { get; set; }

The default game mode for the singleplayer player when they initially spawn.

Difficulty

public Difficulty Difficulty { get; set; }

The current difficulty: normal unless the level data says otherwise, like vanilla's.

DifficultyLocked

public bool DifficultyLocked { get; set; }

True if the difficulty has been locked. Defaults to 0.

GameRules

public ConcurrentDictionary<string, string> GameRules { get; set; }

The game rules by name, as their saved values. A world's levels share one set, which commands change while the levels tick and read it, so it's safe to read and write from several threads at once.

GameTime

public long GameTime { get; set; }

The elapsed simulation ticks, unaffected by clock commands or advance_time.

GeneratorName

public string GeneratorName { get; set; }

Used in 1.15 and below. The name of the world generator.

GeneratorOptions

public object GeneratorOptions { get; set; }

Used in 1.15 and below. Used in buffet, superflat and old customized worlds.

GeneratorVersion

public int GeneratorVersion { get; set; }

Used in 1.15 and below. The version of the level generator.

Hardcore

public bool Hardcore { get; set; }

true if the player will respawn in Spectator on death in singleplayer. Affects all three game modes.

Initialized

public bool Initialized { get; set; }

Normally true after a world has been initialized properly after creation. If the initial simulation was canceled somehow, this can be false and the world will be re-initialized on next load.

LastPlayed

public long LastPlayed { get; set; }

The Unix time in milliseconds when the level was last loaded.

public string LevelName { get; set; }

MapFeatures

public bool MapFeatures { get; set; }

true if the map generator should place structures such as villages, strongholds, and mineshafts. Defaults to 1. Always 1 if the world type is Customized.

Raining

public bool Raining { get; set; }

true if the level is currently experiencing rain, snow, and cloud cover.

RainTime

public int RainTime { get; set; }

The number of ticks before "raining" is toggled and this value gets set to another random value.

RandomSeed

public long RandomSeed { get; set; }

The random level seed used to generate consistent terrain.

SpawnPosition

public VectorD SpawnPosition { get; set; }

The level's spawn: for a world's own level, the world spawn, which its other levels read too.

Remarks

Read and set whole, so a level reading it while another sets it (levels tick in parallel) never sees a mix of the old and new position.

Thundering

public bool Thundering { get; set; }

true if the rain/snow/cloud cover is a lightning storm and dark enough for mobs to spawn under the sky.

ThunderTime

public int ThunderTime { get; set; }

The number of ticks before "thundering" is toggled and this value gets set to another random value.

Time

public long Time { get; set; }

The overworld clock's ticks. Setting the time does not change the elapsed game time.

Version

public int Version { get; set; }

The NBT version of the level

WanderingTraderId

public Guid WanderingTraderId { get; set; }

The UUID of the current wandering trader in the world saved as four ints.

WanderingTraderSpawnChance

public int WanderingTraderSpawnChance { get; set; }

The current chance of the wandering trader spawning next attempt; this value is the percentage and will be divided by 10 when loaded by the game, for example a value of 50 means 5.0% chance.

WanderingTraderSpawnDelay

public int WanderingTraderSpawnDelay { get; set; }

The amount of ticks until another wandering trader is attempted to spawn

WorldClocks

public WorldClocks WorldClocks { get; set; }

The clocks shared by every dimension of this world.

public WorldGenSetting WorldGenSettings { get; set; }

Methods

public bool GetBooleanRule(string name, bool defaultValue = true);public int GetIntegerRule(string name, int defaultValue = 3);

On this page