Skip to content

A kotlin/java lib that allows you to read and write MCA files in a clean way

License

Notifications You must be signed in to change notification settings

PowerNukkit/Region-Manipulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Region Manipulator

A Kotlin/Java library that allows you to read and write mca files in a simple way.

Here you can find the library documentation:

You may also want to see the changelog file to be aware of all changes in the tool that may impact you.

Adding to your project

The library is shared in the maven center, so you don't need to declare any custom repository.

Gradle

repositories {
    mavenCentral() // or jcenter()
}

dependencies {
    compile 'br.com.gamemods:region-manipulator:1.0.1'
}

Maven

<dependencies>
    <dependency>
      <groupId>br.com.gamemods</groupId>
      <artifactId>region-manipulator</artifactId>
      <version>1.0.1</version>
    </dependency>
</dependencies>

Ivy

<dependency org="br.com.gamemods" name="region-manipulator" rev="1.0.1"/>

Direct JAR

Download it from maven central.

Examples

internal fun clearEntities(from: File, to: File) {
    val region = RegionIO.readRegion(from)
    val chunk = region[ChunkPos(region.position.xPos * 32, region.position.zPos * 32)] ?: return
    chunk.level.getCompoundList("Entities").forEach { 
        println(it.getString("id") + " "+ it.getDoubleList("Pos"))
    }
    chunk.level["Entities"] = emptyListOf<NbtCompound>().toNbtList()
    RegionIO.writeRegion(to, region)
}