@Override
  public void writeToNBT(NBTTagCompound NBT) {
    super.writeToNBT(NBT);

    NBT.setInteger("numsafe", numSafePlayers);

    NBT.setBoolean("aim", isCustomAim);

    for (int i = 0; i < safePlayers.size(); i++) {
      NBT.setString("Safe_Player_" + String.valueOf(i), safePlayers.get(i));
    }
  }
  @Override
  public void readFromNBT(NBTTagCompound NBT) {
    super.readFromNBT(NBT);

    isCustomAim = NBT.getBoolean("aim");

    safePlayers = new ArrayList<String>();
    numSafePlayers = NBT.getInteger("numsafe");
    for (int i = 0; i < numSafePlayers; i++) {
      safePlayers.add(NBT.getString("Safe_Player_" + String.valueOf(i)));
    }
  }
 @Override
 public void updateTileEntity() {
   // this.printSafeList();
   super.updateTileEntity();
   tickcount++;
   if (worldObj.isRemote) return;
   switch (this.getBlockMetadata()) {
     case 0:
       this.getPowerBelow();
       dir = 1;
       break;
     case 1:
       this.getPowerAbove();
       dir = -1;
       break;
   }
   if (power < MINPOWER) return;
   if (isCustomAim) {
     if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
       phi--;
     }
     if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
       phi++;
     }
     if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
       if (theta < 45) theta++;
     }
     if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
       if (theta > MAXLOWANGLE) theta--;
     }
     if (Keyboard.isKeyDown(Keyboard.KEY_TAB)) {
       if (this.hasAmmo()) {
         double dd = 20;
         double[] tg = ReikaPhysicsHelper.polarToCartesian(dd, theta, 90 - phi);
         tg[0] += xCoord;
         tg[1] += yCoord;
         tg[2] += zCoord;
         this.fire(worldObj, tg);
       }
     }
     return;
   } else {
     target = this.getTarget(worldObj, xCoord, yCoord, zCoord);
     this.adjustAim(worldObj, xCoord, yCoord, zCoord, target);
   }
 }
 @Override
 protected void readSyncTag(NBTTagCompound NBT) {
   super.readSyncTag(NBT);
   theta = NBT.getFloat("theta");
   dir = NBT.getInteger("direction");
 }
 @Override
 protected void writeSyncTag(NBTTagCompound NBT) {
   super.writeSyncTag(NBT);
   NBT.setFloat("theta", theta);
   NBT.setInteger("direction", dir);
 }