WolfyUtilities | Core API [1.17.1 - 1.21.1] icon

WolfyUtilities | Core API [1.17.1 - 1.21.1] -----

Inventory GUI API, JSON/HOCON Serialization, Plugin Compatibility Utils, etc.



Bug Fixes & NBT API Beta | v1.6.3.8
This update tries to fix an issue where it isn't correctly loaded before CustomCrafting.

It also adds a new NBT Tag API, that makes it easy to read and edit the NBT Tags of items.
All you need to use this in your code is an instance of the WolfyUtilities API.

Note that this NBT API was not fully tested on all Minecraft versions yet and lacks some features e.g. NBT Tag Lists have no methods yet to read/edit their value.
Code (Java):
ItemBuilder itemBuilder = new ItemBuilder (Material. DIAMOND_SWORD ) ;
itemBuilder. addLoreLine ( "Test Sword" ) ;
itemBuilder. addEnchantment (Enchantment. DAMAGE_ALL, 5 ) ;
itemBuilder. addItemFlags (ItemFlag. HIDE_ENCHANTS ) ;
ItemStack itemStack = itemBuilder. create ( ) ; //Build the example ItemStack. Of course any ItemStack can be used!

NBTUtil nbt = wolfyUtilities. getNmsUtil ( ). getNBTUtil ( ) ; //Get the NBTUtil from your plugins WolfyUtilities instance.
NBTItem nbtItem = nbt. getItem (itemStack ) ; //Creates a wrapper for the ItemStack

//Directly set Tags to the item
nbtItem. setTag ( "test_string", nbt. getTag ( ). ofString ( "Test String!" ) ) ;

//Get the Tag of the item for more advanced options
NBTCompound compound = nbtItem. getCompound ( ) ;
compound. setInt ( "Test_Int", 10 ) ;

//Create a new Compound Tag using the NBTTag API
NBTCompound wolfyCompound = nbt. getTag ( ). compound ( ) ;
//There are tons of options to add/edit any kind of NBT Tag
wolfyCompound. setByte ( "Byte", ( byte ) 4 ) ;
wolfyCompound. setBoolean ( "Boolean", true ) ;
wolfyCompound. setDouble ( "Double", 2d ) ;
wolfyCompound. setFloat ( "Float", 7f ) ;
wolfyCompound. setInt ( "Int", 9 ) ;
wolfyCompound. setLong ( "Long", 9999 ) ;
wolfyCompound. setShort ( "Short", ( short ) 200 ) ;
wolfyCompound. setString ( "String", "TestString" ) ;
wolfyCompound. setByteArray ( "ByteArray", new byte [ ] { 9, 9, 5, 2, 3 } ) ;
wolfyCompound. setIntArray ( "IntArray", new int [ ] { 9, 3543, 2134, 123 } ) ;
wolfyCompound. setLongArray ( "LongArray", new long [ ] { 54, 65, 23244343, 1000000000000000000L } ) ;

NBTCompound nestedComp = nbt. getTag ( ). compound ( ) ;
nestedComp. setString ( "LUL", "xD this is a nested Text!" ) ;
nestedComp. setBoolean ( "Funny", false ) ;

//Set nested compounds
wolfyCompound. set ( "Nested", nestedComp ) ;
//Setting values to the items root tag will automatically be applied to the NBTItem instance
compound. set ( "wolfy", wolfyCompound ) ;

//Get the ItemStack with the updated NBT Tags
ItemStack newItem = nbtItem. create ( ) ;
 
----------, Feb 11, 2021
Resource Information
Author:
----------
Total Downloads: 107,482
First Release: Jan 19, 2019
Last Update: May 2, 2024
Category: ---------------
All-Time Rating:
11 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings