classinternalSource
public class WorldSave

Represents a world. Note: Fields are marked nullable to prevent NullPointerExceptions, although Minecraft usually generates default Nbt Structures when loading a World.

Constructors

public WorldSave(Path worldDirectory)
Parameters
worldDirectoryPath

Methods

public Optional<CustomBossEvents> getCustomBossEvents()
public Optional<GameRules> getGameRules()
public Level getLevel()

Returns the level value.

Returns
Level

Generated by Lombok's @Getter for the field level

public SessionLock getLock()

Returns the lock value.

Returns
SessionLock

Generated by Lombok's @Getter for the field lock

public List<Player> getPlayers()

Returns the players value.

Returns
List<Player>

Generated by Lombok's @Getter for the field players

public Optional<RandomSequences> getRandomSequences()
public Optional<Scoreboard> getScoreboard()
public Optional<StopWatches> getStopWatches()
public Optional<WanderingTrader> getWanderingTrader()
public Optional<Weather> getWeather()
public Optional<WorldClocks> getWorldClocks()
public Path getWorldDirectory()

Returns the worldDirectory value.

Returns
Path

Generated by Lombok's @Getter for the field worldDirectory

public Optional<WorldGenSettings> getWorldGenSettings()
public void save() throws IOException
Writes whatever changed since loading (or the last save): level.dat, data/minecraft and the players. level.dat and the player files keep a .dat_old, like Minecraft does. Chunks go through Dimension.saveChunkData instead
Throws
IOExceptionIf writing fails, or Minecraft has the world open right now