Jump to content

1.10.2 Error with write to nbt


Recommended Posts

public void writeToNBT(NBTTagCompound nbt) {

    NBTTagList list = new NBTTagList();
    for (int i = 0; i < this.getSizeInventory(); ++i) {
        if (this.getStackInSlot(i) != null) {
            NBTTagCompound stackTag = new NBTTagCompound();
            stackTag.setByte("Slot", (byte) i);
    nbt.setTag("Items", list);

    if (this.hasCustomName()) {
        nbt.setString("CustomName", this.getCustomName());

Thats my problem it does not want to have void and i am so confused it might be basic but im confused as hell on the WriteToNBT Method

Are You Feeling it now Mr.Krabs?




Link to comment
Share on other sites

writeToNBT is no longer a void method, instead, it is now a method using the object NBTTagCompound. This means that you need to return said object.

public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
   //Do stuff with the gained nbt parameter.
   return nbt;

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.