Arctic_Wolfy

TEBank.readFromNBT

Oct 5th, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1. @Override
  2.     public void readFromNBT(NBTTagCompound tag) {
  3.         super.readFromNBT(tag);
  4.         if (tag.hasKey(NBTTags.Bank.ACCOUNTS_TAG)){
  5.             NBTTagCompound accounts = tag.getCompoundTag(NBTTags.Bank.ACCOUNTS_TAG);
  6.             LogHelper.info(accounts);
  7.             if (accounts.hasKey(NBTTags.Bank.ACCOUNT_COUNT_TAG)) {
  8.                 int accountCount = accounts.getInteger(NBTTags.Bank.ACCOUNT_COUNT_TAG);
  9.                 this.accounts = new ArrayList<BankAccount>();
  10.  
  11.                 for (int i = 0; i < accountCount; i++) {
  12.                     String accountX = String.format(NBTTags.Bank.ACCOUNT_X_TAG_fmt, i);
  13.                     if (accounts.hasKey(accountX)) {
  14.                         LogHelper.info("Looking for player: " + i);
  15.                         this.accounts.add(BankAccount.fromNBT(accounts.getCompoundTag(accountX), this)); //Crashes here.
  16.                     }
  17.                 }
  18.             }
  19.         }
  20.         if (tag.hasKey(NBTTags.Bank.NAME_TAG)) name = tag.getString(NBTTags.Bank.NAME_TAG);
  21.         else name = CharLists.getRandomName(worldObj.rand);
  22.     }
Add Comment
Please, Sign In to add comment