writenbt - ProjectZulu/JustAnotherSpawner GitHub Wiki
boolean writenbt(String[] nbtOperations)
- This function is used to change the attributes of a mob. For example, it's frequently used with PostSpawn Tags on Mo'Creatures mobs.
- Since NBT properties can be mod-dependent beyond the vanilla Minecraft settings, it's advised to check mod documentation or resort to an NBT editor for property discovery.
- It only takes 1 argument: an array containing one string per NBT property to write. Please see PostSpawn Tags examples below to get a quick idea of how they work.
- The usual format for the string is: 'PropertyName/N/value' where:
- PropertyName is whatever name the mod authors gave to the attribute
- N is a number that defines the type of property (is PropertyName an integer? a string? a floating-point number? a boolean?) Refer to the Minecraft NBT format article for a list.
- The value portion of the string is where you specify the property's new value.
- Enclose each property/type/value combination within single quotes, as its own string. Separate additional strings with commas.
- writenbt({'TypeInt/3/6'})
- This is a Mo'Creatures-specific example.
- Within that mod, the authors have a custom property named 'TypeInt'; they chose that name so it's easy to remember that it's a regular integer value, which Minecraft refers to with number 3.
- We are assigning a value of 6 to the property. Whatever that means depends entirely on how the mob authors intended it; see the example regarding the Mo'Creatures bird.
- writenbt({'TypeInt/3/6','Edad/3/20'})
- This is a Mo'Creatures-specific example.
- Again we are writing the TypeInt property, a regular integer referred to as type 3, and giving it a value of 6, like above.
- We are also writing the Edad (Spanish for 'age') property at the same time. It's another regular integer of type 3, which we are giving the value 20. Note that since this is a different property, it has its own string enclosed within single quotes.