Advertisement
yarinch

Untitled

Sep 23rd, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. @Override
  2.     public void readFromNBT(NBTTagCompound compound) {
  3.         super.readFromNBT(compound);
  4.  
  5.         isFormed = compound.getBoolean("isFormed");
  6.         checkBefore = compound.getBoolean("checkBefore");
  7.  
  8.         byte size = compound.getByte("Size");
  9.         components.clear();
  10.  
  11.         for (int i = 0; i < size; i++) {
  12.             String str = compound.getString("component" + i);
  13.             components.add(MachineComponents.getFromString(str));
  14.         }
  15.     }
  16.  
  17.     @Override
  18.     public void writeToNBT(NBTTagCompound compound) {
  19.         super.writeToNBT(compound);
  20.  
  21.         compound.setBoolean("isFormed", isFormed);
  22.         compound.setBoolean("checkBefore", checkBefore);
  23.  
  24.         compound.setByte("Size", (byte)components.size());
  25.  
  26.         for (int i = 0; i < components.size(); i++) {
  27.             compound.setString("component" + i, components.get(i).getLocalizedName());
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement