SandroHc / schematic4j

Java parser for the .schem/.schematic/.litematic Minecraft formats. 🗺
MIT License
16 stars 3 forks source link
java litematica minecraft parser schematic sponge

Schematic4j

Latest version

Java parser for the .schem/.schematic/.litematic Minecraft formats. 🗺

Supported formats

Format Extension Links
Sponge Schematic .schem Spec: v1 • v2 • v3
Litematica .litematic Spec • Discussion
Schematica .schematic Spec

Installation

Add the following dependency to your build file.

If using Gradle (build.gradle):

repositories {
    mavenCentral()
}

dependencies {
    implementation 'net.sandrohc:schematic4j:1.1.0'
}

If using Maven (pom.xml):

<dependency>
    <groupId>net.sandrohc</groupId>
    <artifactId>schematic4j</artifactId>
    <version>1.1.0</version>
</dependency>

For development builds, please see: https://jitpack.io/#net.sandrohc/schematic4j

Usage

Here are some examples on how to use this library:

// Load schematic from a file.
// Currently supported formats include .schematic, .schem and .litematic.
Schematic schematic = SchematicLoader.load("/path/to/your.schematic"); 

schematic.name();
schematic.width();
schematic.height();
schematic.length();
schematic.block(0, 0, 0).name;
schematic.blocks().collect(Collectors.toList());
schematic.blockEntities().collect(Collectors.toList());
schematic.entities().collect(Collectors.toList());