Skip to content

How to creating NBT list #2397

Discussion options

You must be logged in to vote

The (S)NBT format is explained here:
https://minecraft.fandom.com/wiki/NBT_format#:~:text=The%20Named%20Binary%20Tag%20(NBT,Binary%20Tag%20(SNBT)%20format.
a list is expressed like in json using square brackets and commas.

For doing it in java, this should give you some idea how it works (see NbtElement and its subclasses):

                // A list of lists
		NbtList list = new NbtList();
		NbtList innerList1 = new NbtList();
		list.add(innerList1);

                // Add tags to the inner list
		NbtCompound tag1 = new NbtCompound();
		tag1.putString("greeting", "hello");
		tag1.putInt("amount", 0);
		innerList1.add(tag1);

		NbtCompound tag2 = new NbtCompound();
		tag2.putString("greet…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Intezium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants