Comparison to NBT API
Installations
Benchmark
FastNbt is ~190% faster than NBT API.
Check the benchmark here
Usability
FastNbt is easier to use compared to NBT API and requires less boilerplate code.
Creating an head texture
NItem nItem = new nItem ( new ItemStack (Material. PLAYER_HEAD ) ) ;
nItem. setSkull ( "dummy", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc4ZWYyZTRjZjJjNDFhMmQxNGJmZGU5Y2FmZjEwMjE5ZjViMWJmNWIzNWE0OWViNTFjNjQ2Nzg4MmNiNWYwIn19fQ==" ) ;
nItem. save ( ) ; // If finished editing
Renaming an item
NOTE: FastNBT supports only Compound strings.
If you want to use legacy notation you have to call the Spigot API as usual.
NItem nItem = new nItem ( new ItemStack (Material. STONE ) ) ;
nItem. setDisplayNameCompound ( "{\"text\":\"Example Compound Name\",\"color\":\"blue\"}" ) ;
nItem. save ( ) ; // If finished editing
Setting an attribute modifier
nItem. setAttributeModifier (
"minecraft:generic.movement_speed",
1,
6,
"bro",
"mainhand",
1337,
1337
) ;
nItem. save ( ) ; // If finished editing
Setting an attribute modifier (manual method)
NList attributes = nItem. getOrAddList ( "AttributeModifiers", NBTType. Compound ) ;
NCompound attribute = new NCompound ( ) ;
attribute. setString ( "AttributeName", attributeName ) ;
attribute. setInt ( "Operation", operation ) ;
attribute. setInt ( "UUIDLeast", uuidLeast ) ;
attribute. setInt ( "UUIDMost", uuidMost ) ;
attribute. setDouble ( "Amount", amount ) ;
attribute. setString ( "Name", name ) ;
attribute. setString ( "Slot", slot ) ;
attributes. addCompound (attribute ) ;
Limitations
Currently, supports only items.
Adding it to your project
Plugin.yml
This is the easiest way.
name: Your Plugin
author: You
# ....
libraries:
- beer.devs:FastNbt-jar:1.4.5
Maven
<dependency>
<groupId>beer.devs </groupId>
<artifactId>FastNbt-jar </artifactId>
<version>1.4.5 </version>
<scope>provided </scope>
</dependency>
Shading
<plugin>
<groupId>org.apache.maven.plugins </groupId>
<artifactId>maven-shade-plugin </artifactId>
<version>3.5.0 </version>
<executions>
<execution>
<phase>package </phase>
<goals>
<goal>shade </goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>beer.devs.fastnbt. </pattern>
<shadedPattern>YOUR_PACKAGE_HERE.libs.beer.devs.fastnbt. </shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
Installations
Benchmark
FastNbt is ~190% faster than NBT API.
Check the benchmark here
Usability
FastNbt is easier to use compared to NBT API and requires less boilerplate code.
Creating an head texture
Code (Java):
NItem nItem = new nItem ( new ItemStack (Material. PLAYER_HEAD ) ) ;
nItem. setSkull ( "dummy", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc4ZWYyZTRjZjJjNDFhMmQxNGJmZGU5Y2FmZjEwMjE5ZjViMWJmNWIzNWE0OWViNTFjNjQ2Nzg4MmNiNWYwIn19fQ==" ) ;
nItem. save ( ) ; // If finished editing
NOTE: FastNBT supports only Compound strings.
If you want to use legacy notation you have to call the Spigot API as usual.
Code (Java):
NItem nItem = new nItem ( new ItemStack (Material. STONE ) ) ;
nItem. setDisplayNameCompound ( "{\"text\":\"Example Compound Name\",\"color\":\"blue\"}" ) ;
nItem. save ( ) ; // If finished editing
Code (Java):
nItem. setAttributeModifier (
"minecraft:generic.movement_speed",
1,
6,
"bro",
"mainhand",
1337,
1337
) ;
nItem. save ( ) ; // If finished editing
Code (Java):
NList attributes = nItem. getOrAddList ( "AttributeModifiers", NBTType. Compound ) ;
NCompound attribute = new NCompound ( ) ;
attribute. setString ( "AttributeName", attributeName ) ;
attribute. setInt ( "Operation", operation ) ;
attribute. setInt ( "UUIDLeast", uuidLeast ) ;
attribute. setInt ( "UUIDMost", uuidMost ) ;
attribute. setDouble ( "Amount", amount ) ;
attribute. setString ( "Name", name ) ;
attribute. setString ( "Slot", slot ) ;
attributes. addCompound (attribute ) ;
Currently, supports only items.
Adding it to your project
Plugin.yml
This is the easiest way.
Code (yml (Unknown Language)):
name: Your Plugin
author: You
# ....
libraries:
- beer.devs:FastNbt-jar:1.4.5
Code (XML):
<dependency>
<groupId>beer.devs </groupId>
<artifactId>FastNbt-jar </artifactId>
<version>1.4.5 </version>
<scope>provided </scope>
</dependency>
Code (XML):
<plugin>
<groupId>org.apache.maven.plugins </groupId>
<artifactId>maven-shade-plugin </artifactId>
<version>3.5.0 </version>
<executions>
<execution>
<phase>package </phase>
<goals>
<goal>shade </goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>beer.devs.fastnbt. </pattern>
<shadedPattern>YOUR_PACKAGE_HERE.libs.beer.devs.fastnbt. </shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.17, 1.18, 1.19
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
[API] FastNBT is a free Minecraft Java mod. Compatible with Minecraft 1.17, 1.18, 1.19, 1.20 and newer. Downloaded 955 times (via Spigot). Download it and open it directly in the game.