Advertisement
HalestormXV

Untitled

Mar 3rd, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1.         private int  SPELL_ID = 0;
  2.         private List<Integer> knownSpells = new ArrayList<>();
  3.  
  4.         public void learnedSpell(int spellLearned)
  5.         {
  6.             this.SPELL_ID = spellLearned;
  7.             this.knownSpells.add(SPELL_ID);
  8.             serializeNBT();
  9.         }
  10.  
  11.         private int[] convert2Primative(List<Integer> integers)
  12.         {
  13.             int[] ret = new int[integers.size()];
  14.             Iterator<Integer> iterator = integers.iterator();
  15.             for (int i = 0; i < ret.length; i++)
  16.             {
  17.                 ret[i] = iterator.next().intValue();
  18.             }
  19.             return ret;
  20.         }
  21.  
  22.         private NBTTagCompound writeNBT(List<Integer> knownSpells )
  23.         {
  24.             NBTTagCompound nbt = new NBTTagCompound();
  25.             nbt.setIntArray("LearnedSpells", convert2Primative(knownSpells));
  26.             return nbt;
  27.         }
  28.  
  29.         @Override
  30.         public NBTTagCompound serializeNBT()
  31.         {
  32.             return writeNBT(this.knownSpells);
  33.         }
  34.  
  35.         @Override
  36.         public void deserializeNBT(NBTTagCompound nbt)
  37.         {
  38.             //NEXT STEP AFTER TOP IS FINSIHED
  39.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement