Posted April 25, 201510 yr 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); }
April 25, 201510 yr 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.
April 25, 201510 yr Author i can't believe my stupidity sometimes.... nbt.setDouble("funds", getWallet()); sould have been properties.setDouble("funds", getWallet()); thanks Ernio for helping me debug that
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.