Jump to content

[1.12.2] NBT inconsistencies


BeardlessBrady

Recommended Posts

Hello, so I have this weird issue where if I change the 'cost' and 'amount' variable on the tile and restart the world the change will stay....but if I then change them again and restart the world they will revert back to the previous numbers. Anyone have any idea why this could be occuring?

 

Tile Entity: https://github.com/Beardlessbrady/Currency-Mod/blob/master-2-1.12/src/main/java/beardlessbrady/modcurrency/block/vending/TileVending.java#L127-L194

Custom ItemHandler: https://github.com/Beardlessbrady/Currency-Mod/blob/master-2-1.12/src/main/java/beardlessbrady/modcurrency/block/vending/ItemVendorHandler.java#L44-L60

Custom Item: https://github.com/Beardlessbrady/Currency-Mod/blob/master-2-1.12/src/main/java/beardlessbrady/modcurrency/block/vending/ItemVendor.java#L133-L179

 

Link to comment
Share on other sites

For the amount value I am changing it in the #setAmnt method here

 

https://github.com/Beardlessbrady/Currency-Mod/blob/master-2-1.12/src/main/java/beardlessbrady/modcurrency/block/vending/GuiVending.java#L989-L1007

 

Its not even just the values...If I add a new item into the machine and restart it will revert back to how it was before. Odd how it will save nbt once but after that revert for some reason.. Any ideas?

Edited by BeardlessBrady
Link to comment
Share on other sites

I tried debugging the #toNBT and #fromNBT methods in my itemVendor class. It seems to only save the NBT when I pause the game for the very first time after first placing the block but when I quit the world it does not save the NBT nor does it do it when I pause any other time. It will however save NBT and load NBT on world startup... Any ideas?

Edited by BeardlessBrady
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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.