If you have any questions or feel like there are ways to improve this resource (which there is), then please tell me all about it. You can find the chunk from a location with Dinnerbones Coordinate Tool. The region folder will contain all chunks which will then contain all entities in that chunk. The playerdata folder will contain all players NBT data (inventory, position, rotation, etc). You will find the files to modify with NBTExplorer in either the "world/playerdata/" folder or the "world/region/" folder. NBTTagCompound tag = new NBTTagCompound ( ) EntityPlayer nmsPlayer = ( (CraftPlayer )player ). What the code does is to first get the item in the players main hand, then convert it to a NMS ItemStack and lastly get (or create) the item tag. We will first need to get or create the item tag. ![]() I will be covering how to modify enchants and attributes. So, you are now familiar with the NBT structure so let's get to writing the code. To get a list from a compound we need to know the list type ID which can be found below: They start at 0 and will also be able to store any type of variable. Lists are ordered by in which order they were added. What differs lists from compounds is exactly what you would expect. The tag will contain all additional information (such as enchants, attributes, display name, lore, etc). ![]() There could also be another compound within the items compound, this is called the item tag. It will also contain a string which will be the items ID (ex. If you take any items compound, it will contain 2 bytes, one for the count (amount of items) and one for the slot (where the item is placed in your inventory). Whenever you create a new item (in the inventory) or entity a new item compound will be created to store all information. It can contain any type of all the "variables", even itself.Ĭompounds will work as a mix of variables that can be accessed in any order and defined and accessible by their "name". The "main" variable type is the compound. Bytes, shorts, integers, doubles, strings, etc. You can think of NBT as a tree of different types of variables (tags) all nested within each other. If you do not feel like installing NBTExplorer and only want it explained, then you can continue taking my basic description on how NBT is structured below. Here is an example of an item I created which I viewed it in NBTExplorer, something I strongly recommend before continuing which would make it easier to understand the entire "learning the NBT structure part". Note: When I talk about compounds I will be referring to NBTTagCompounds.Ī good way to learn an items NBT structure is to actually look at it yourself. If you want to take a look at some more advanced NBT modification code you can take a look at my plugin here. I will also try to answer questions or issues that I myself met along the way. This resource will have as a goal to give you at least a basic understanding of how to modify existing entities or inventory items NBT. The intent is to give you a basic understanding of how NBT tags works and how to edit them. The intent of this resource is not to learn you how to add enchantments/attributes. If you use 1.14+, NBT modification is not always needed (see comments). The version will be based on 1.13 but you can follow the tutorial with minimal change for versions 1.12.2 to 1.14.4. To add NBT tags to existing compounds/lists, only edit already existing tags (thats next on my list of things to implement).Note: I will be underlining all terms that should be paid attention to as they are important. Please be aware that at the moment there is no way That I hope to implement by full release. That it has not been heavily tested and still lacks some features NBT Explorer is currently flagged as experimental due to the fact
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |