Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/EmortalMC/TNT

TNT is an experimental world format for Minestom
https://github.com/EmortalMC/TNT

minestom minestom-extension minestom-library

Last synced: 3 days ago
JSON representation

TNT is an experimental world format for Minestom

Awesome Lists containing this project

README

        

EmortalMC Banner

# TNT
TNT is a world format for Minestom designed for super fast 🚀 loading and portability.

TNT should only be used for small worlds.

## Check out the [polar](https://github.com/hollow-cube/polar) world format created by Hollow Cube. It handles version updates and will work better.

### âš  TNT is experimental and is not backwards compatible. Your worlds will break when TNT or Minecraft updates. It is highly recommended to keep your original worlds.

## Cool stuff
- Very fast loading times (23ms for my lobby - idk what Anvil is)
- Small file size (~80kb in TNT vs ~13mb in Anvil for my lobby)
- [Converts from Anvil automatically](#anvil-conversion)
- [Very portable - can be loaded from databases](#tnt-sources)
- Stores block nbt (e.g. sign text)
- Stores cached light from Anvil (useful because only minestom-ce has a lighting engine)
- [World saving](#saving)

Unfortunately does not save entities (yet) as Minestom does not have entity (de)serialisation.

# Usage
Importing via Gradle (browse versions [here](https://repo.emortal.dev/#/releases/dev/emortal/tnt/TNT))
```groovy
repositories {
maven { url "https://repo.emortal.dev/releases" }
}

dependencies {
implementation("dev.emortal.tnt:TNT:{releaseTag}")
}
```
Creating a Minestom instance

```java
InstanceContainer instance = MinecraftServer.getInstanceManager().createInstanceContainer();
TNTLoader tntLoader = new TNTLoader(instance, new FileTNTSource(Path.of("path/to/world.tnt")));
// or
TNTLoader tntLoader = new TNTLoader(instance, "path/to/world.tnt")

instance.setChunkLoader(tntLoader);
```

## Signs are blank? (or any other block has no data)
TNT needs some block handlers in order to load block data.

You can find some [example handlers in Immortal](https://github.com/EmortalMC/Immortal/tree/main/src/main/kotlin/dev/emortal/immortal/blockhandler) which are then registered like [this](https://github.com/EmortalMC/Immortal/blob/ea9f03249d01b7f2544bd96d588e6341d7bfbc99/src/main/kotlin/dev/emortal/immortal/ImmortalExtension.kt#L409)

## Anvil Conversion
In order for TNT to convert a TNT world automatically, the Anvil folder and TNT file need to be named the same and be in the same folder.

For example:
- /worlds/world/ <- Anvil world folder
- /worlds/world.tnt <- TNT world file (Put this path into the `TNTSource`)

You may also convert an anvil world to TNT manually with `TNT.convertAnvilToTNT(pathToAnvil, tntSaveSource)`

## TNT Sources
TNT worlds can be loaded and saved wherever you want (however only `FileTNTSource` is built in)

For example, you could make it read from Redis, MongoDB, MySQL or any sort of datastore.

You can do this by extending `TNTSource` and creating your own source.

## Saving
Use `TNT.convertChunksToTNT(chunkList, source)`