Giter Club home page Giter Club logo

levelparser's Introduction

LevelParser

A Minecraft level parser.

Currently Supporting: Minecraft: Java Edition 1.19.x

This project only supports Anvil world files at the moment, but has been designed in such a way that alternative formats can also be used.

Usage

To start, you will need to create a LevelParser object like so:

LevelParser<AnvilLevel> parser = LevelParser.<AnvilLevel>builder()
        .input(Paths.get("input"))
        .output(Paths.get("output"))
        .reader(new AnvilLevelReader())
        .writer(new AnvilLevelWriter())
        .build();

Afterward, create a new AnvilLevel which you can do like so:

AnvilLevel level = new AnvilLevel(
        0, // minHeight
        256, // maxHeight
        0, // worldTime
        new LevelData( // levelData
                new LevelData.LevelVersion( // levelVersion
                        false, // snapshot
                        "main", // series
                        3120, // dataVersion
                        "1.19.2" // name
                ),
                "My World Name", // worldName
                1, // gameType (1 = creative mode)
                10, // spawnX
                0, // spawnY
                10, // spawnZ
                System.currentTimeMillis(), // lastPlayed
                false, // hardcore
                true, // allowCommands
                List.of("vanilla"), // enabledDataPacks
                List.of(), // disabledDataPacks
                new LevelData.WorldGenSettings( // worldGenSettings
                        false, // bonusChest
                        0, // seed
                        false, // generateFeatures
                        ... // dimensions
                )
        )
);

With this level, you can now manipulate it in any way. Once you are done modifying your level, you can write it by doing the following using your parser:

parser.writeLevel(level);

Repository

Gradle

repositories {
    maven("https://jitpack.io")
}

dependencies {
    implementation("com.github.Redned235.LevelParser:anvil:master-SNAPSHOT")
}

Maven:

<repositories>
    <repository>
        <id>jitpack</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.Redned235.LevelParser</groupId>
        <artifactId>anvil</artifactId>
        <version>master-SNAPSHOT</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

levelparser's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

levelparser's Issues

Feature request: Load chunks on-demand

Currently, the library loads all the world chunks into the memory this can be useful for some but not for others. I'm suggesting adding a feature that allows loading the chunks only when it is necessary.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.