Giter VIP home page Giter VIP logo

tnt's Introduction

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 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

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

Usage

Importing via Gradle (browse versions here)

repositories {
    maven { url "https://repo.emortal.dev/releases" }
}

dependencies {
    implementation("dev.emortal.tnt:TNT:{releaseTag}")
}

Creating a Minestom instance

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 which are then registered like this

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)

tnt's People

Contributors

emortaldev avatar zakshearman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tnt's Issues

Using TNT with paper/spigot

I know this was written with Minestom and Minestom in mind, however in theory a lot of this could be implemented for spigot/paper. At least converting a tnt world to anvil and vice verca for the server start/stop. Could anyone help me on this?

Misleading information in the readme

Since this project is ever-evolving, I figured that I'd pitch my two cents, so here goes.

When I was attempting to use TNT, the readme states that the anvil world and the .tnt file are to be named the same thing when converting an anvil world to TNT. I believe this to be misleading, as when you attempt this in practice, the it attempts to load the world (which would be an empty file), and throws an ArrayIndexOutOfBoundsException, which is the expected behavior (the file is empty, but exists, just no world to load from the .tnt file). It should be said in this area that on conversion, the .tnt file should not exist yet.

The reason I didn't submit a PR and chose issues instead was that I didn't want to decide the wording of the readme or the behavior of the library for you guys, but at the same time wanted to help out others who may stumble upon this in the future.

Also, yes, hindsight is 20/20 and this should have been obvious to me ๐Ÿ˜›

Convert MCA (Anvil) to TNT fails on backup region files

This isn't a major issue, but I found a issue while converting an Anvil world it threw an error

Unexpected exception thrown: java.lang.NumberFormatException: For input string: "mca"

I found that it was trying to read r.0.0.mca.2710657221739100675.backup
This line here reads the last two items in the array... which from the backup file is ["mca", "2710657221739100675"]

My suggestion to fix it would be
Replace val args = it.nameWithoutExtension.split(".").takeLast(2) with

  • Regex - Something along the lines of val args = Regex("(-?\\d+).(-?\\d+)").find(it.nameWithoutExtension)?.groupValues?.drop(0)
  • val args = it.nameWithoutExtension.split(".").slice(1..2)

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.