Jump to content

[Solved] NBT tag not loading after relogging


jamiemac262

Recommended Posts

I'm not really sure how to even debug this to find out what's wrong.

 

i have an IEEP "Wallet"

 

when i give my wallet a value, the console tells me it's saving the property.

 

when i log out of the server and log back in i get a message telling me it's loaded the property from NBT, but it seems it hasn't, because the property has reset itself.

 

could someone take a look and help me work out what's wrong here please?

 

public void loadNBTData(NBTTagCompound nbt){
        System.out.println("[MineConomy] Loading Player Wallet");
        NBTTagCompound properties = (NBTTagCompound) nbt.getTag(EXT_PROP_NAME);
       setFunds(properties.getDouble("funds"));
        System.out.println("PLAYER'S FUNDS ARE NOW: " + getWallet());  //getWallet is 0.00 here. even after i set it to something like 1000
    }
    public void saveNBTData(NBTTagCompound nbt){
        System.out.println("[MineConomy] Saving Player Wallet");
        NBTTagCompound properties = new NBTTagCompound();
        nbt.setDouble("funds", getWallet());
        nbt.setTag(EXT_PROP_NAME, properties);
    }

 

Link to comment
Share on other sites

What can be wrong:

- Your getter/setters are broken

- You are looking at wrong output (there is client AND server output) - only server side loads NBT, client one needs to be synchronized manually.

- You fkd up something else :) Post more code (maybe you are looking in wronge place? Any ticking events that use your wallet, anything?)

 

EDIT

In loadNBT - add Syso(nbt); or Syso(properties); Is there any (your) data? (yes, you can print NBT).

1.7.10 is no longer supported by forge, you are on your own.

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.

Announcements



×
×
  • Create New...

Important Information

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