@Override
 public void renderTileEntityAt(
     TileEntity tile, double par2, double par4, double par6, float par8) {
   if (tile.hasWorldObj() && MinecraftForgeClient.getRenderPass() == 0) {
     CrystalTransmitterBase te = (CrystalTransmitterBase) tile;
     GL11.glPushMatrix();
     GL11.glTranslated(par2, par4, par6);
     ChromaFX.drawEnergyTransferBeams(new WorldLocation(te), te.getTargets());
     GL11.glPopMatrix();
   }
 }
  @Override
  protected void writeSyncTag(NBTTagCompound NBT) {
    super.writeSyncTag(NBT);

    NBT.setInteger("color", color.ordinal());
    NBT.setBoolean("multi", hasMultiblock);
    NBT.setInteger("energy", energy);
    NBT.setBoolean("enhance", enhanced);
  }
  @Override
  protected void readSyncTag(NBTTagCompound NBT) {
    super.readSyncTag(NBT);

    facing = dirs[NBT.getInteger("face")];
    hasMultiblock = NBT.getBoolean("multi");
    depth = NBT.getInteger("depth");
    isTurbo = NBT.getBoolean("turbo");
  }
  @Override
  protected void readSyncTag(NBTTagCompound NBT) {
    super.readSyncTag(NBT);

    color = CrystalElement.elements[NBT.getInteger("color")];
    hasMultiblock = NBT.getBoolean("multi");
    energy = NBT.getInteger("energy");
    enhanced = NBT.getBoolean("enhance");
  }
  @Override
  protected void writeSyncTag(NBTTagCompound NBT) {
    super.writeSyncTag(NBT);

    if (facing != null) NBT.setInteger("face", facing.ordinal());

    NBT.setBoolean("multi", hasMultiblock);
    NBT.setInteger("depth", depth);
    NBT.setBoolean("turbo", isTurbo);
  }
  @Override
  protected void onFirstTick(World world, int x, int y, int z) {
    super.onFirstTick(world, x, y, z);
    PylonGenerator.instance.cachePylon(this);
    if (ChromaOptions.PYLONLOAD.getState()) {
      if (forceLoad) {
        ChunkManager.instance.loadChunks(this);
      }
    } else {
      forceLoad = false;
      ChunkManager.instance.unloadChunks(this);
    }

    if (ModList.THAUMCRAFT.isLoaded() && nodeCache != null) {
      ArrayList li = new ArrayList();
      li.add(world.provider.dimensionId);
      li.add(x);
      li.add(y);
      li.add(z);
      nodeCache.put(this.getId(), li);
    }
  }
  @Override
  public void readFromNBT(NBTTagCompound NBT) {
    super.readFromNBT(NBT);

    forceLoad = NBT.getBoolean("load");
  }
  @Override
  public void writeToNBT(NBTTagCompound NBT) {
    super.writeToNBT(NBT);

    NBT.setBoolean("load", forceLoad);
  }
  @Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateEntity(world, x, y, z, meta);

    if (DragonAPICore.debugtest) {
      if (!hasMultiblock) {
        CrystalElement e = CrystalElement.randomElement();
        FilledBlockArray b = ChromaStructures.getPylonStructure(world, x, y - 9, z, e);
        b.place();
        // world.setBlock(x, y+9, z, this.getTile().getBlock(), this.getTile().getBlockMetadata(),
        // 3);
        // TileEntityCrystalPylon te = (TileEntityCrystalPylon)world.getTileEntity(x, y+9, z);
        color = e;
        hasMultiblock = true;
        this.syncAllData(true);
      }
    }

    if (hasMultiblock) {
      // ReikaJavaLibrary.pConsole(energy, Side.SERVER, color == CrystalElement.BLUE);

      int max = this.getCapacity();
      if (world.getTotalWorldTime() != lastWorldTick) {
        this.charge(world, x, y, z, max);
        lastWorldTick = world.getTotalWorldTime();
      }
      energy = Math.min(energy, max);

      if (world.isRemote) {
        this.spawnParticle(world, x, y, z);
      }

      if (!world.isRemote && rand.nextInt(80) == 0) {
        int r = 8 + rand.nextInt(8);
        AxisAlignedBB box = ReikaAABBHelper.getBlockAABB(x, y, z).expand(r, r, r);
        List<EntityLivingBase> li = world.getEntitiesWithinAABB(EntityLivingBase.class, box);
        for (EntityLivingBase e : li) {
          boolean attack = !e.isDead && e.getHealth() > 0;
          if (e instanceof EntityPlayer) {
            EntityPlayer ep = (EntityPlayer) e;
            attack =
                attack && !ep.capabilities.isCreativeMode && !Chromabilities.PYLON.enabledOn(ep);
          } else if (e instanceof EntityBallLightning) {
            attack = ((EntityBallLightning) e).getElement() != color;
          }
          if (attack) {
            this.attackEntity(e);
            this.sendClientAttack(this, e);
          }
        }
      }

      float f = this.isEnhanced() ? 1.125F : 1;

      if (TileEntityCrystalPylon.TUNED_PYLONS)
        f *= CrystalMusicManager.instance.getDingPitchScale(color);

      if (this.getTicksExisted() % (int) (72 / f) == 0) {
        ChromaSounds.POWER.playSoundAtBlock(this, 1, f);
      }

      int n = this.isEnhanced() ? 24 : 36;
      if (world.isRemote && rand.nextInt(n) == 0) {
        this.spawnLightning(world, x, y, z);
      }

      if (!world.isRemote
          && ChromaOptions.BALLLIGHTNING.getState()
          && energy >= this.getCapacity() / 2
          && rand.nextInt(24000) == 0
          && this.isChunkLoaded()) {
        world.spawnEntityInWorld(
            new EntityBallLightning(world, color, x + 0.5, y + 0.5, z + 0.5)
                .setPylon()
                .setNoDrops());
      }
    }
  }
 @Override
 protected void onFirstTick(World world, int x, int y, int z) {
   super.onFirstTick(world, x, y, z);
   this.validateStructure();
   // this.checkConnectivity();
 }
 @Override
 public void updateEntity(World world, int x, int y, int z, int meta) {
   super.updateEntity(world, x, y, z, meta);
 }