@Override
  public void onUpdate() {
    if (this.ticksExisted == 1 && !worldObj.isRemote)
      IELogger.debug("init tick at " + System.currentTimeMillis());
    super.onUpdate();
    //		if(this.ticksExisted>40)
    //			this.setDead();
    if (worldObj.isRemote) return;

    EntityPlayer player = null;
    if (this.riddenByEntity instanceof EntityPlayer) player = ((EntityPlayer) this.riddenByEntity);

    if (subPoints != null && targetPoint < subPoints.length - 1) {
      double dist = subPoints[targetPoint].distanceTo(Vec3.createVectorHelper(posX, posY, posZ));
      IELogger.debug("dist: " + dist);
      if (dist <= .05) {
        this.posX = subPoints[targetPoint].xCoord;
        this.posY = subPoints[targetPoint].yCoord;
        this.posZ = subPoints[targetPoint].zCoord;
        targetPoint++;
        IELogger.debug("next vertex: " + targetPoint);
        //				double dx = (subPoints[targetPoint].xCoord-posX);//connection.length;
        //				double dy = (subPoints[targetPoint].yCoord-posY);//connection.length;
        //				double dz = (subPoints[targetPoint].zCoord-posZ);//connection.length;
        //				Vec3 moveVec = Vec3.createVectorHelper(dx,dy,dz);
        float speed = 3f;
        if (player != null
            && player.getCurrentEquippedItem() != null
            && player.getCurrentEquippedItem().getItem() instanceof ItemSkyhook)
          speed =
              ((ItemSkyhook) player.getCurrentEquippedItem().getItem())
                  .getSkylineSpeed(player.getCurrentEquippedItem());
        Vec3 moveVec =
            SkylineHelper.getSubMovementVector(
                Vec3.createVectorHelper(posX, posY, posZ), subPoints[targetPoint], speed);
        motionX = moveVec.xCoord; // *speed;
        motionY = moveVec.yCoord; // *speed;
        motionZ = moveVec.zCoord; // *speed;
        return;
      }
    }

    if (target != null && targetPoint == subPoints.length - 1) {
      TileEntity end = this.worldObj.getTileEntity(target.posX, target.posY, target.posZ);
      IImmersiveConnectable iicEnd = Utils.toIIC(end, worldObj);
      if (iicEnd == null) {
        this.setDead();
        return;
      }
      Vec3 vEnd = Vec3.createVectorHelper(target.posX, target.posY, target.posZ);
      vEnd = Utils.addVectors(vEnd, iicEnd.getConnectionOffset(connection));

      double gDist = vEnd.distanceTo(Vec3.createVectorHelper(posX, posY, posZ));
      IELogger.debug("distance to goal: " + gDist);
      if (gDist <= .3) {
        reachedTarget(end);
        return;
      } else if (gDist > 5) {
        setDead();
        return;
      }
    }
    this.posX += this.motionX;
    this.posY += this.motionY;
    this.posZ += this.motionZ;
    float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
    this.rotationYaw = (float) (Math.atan2(this.motionZ, this.motionX) * 180.0D / Math.PI) + 90.0F;

    for (this.rotationPitch =
            (float) (Math.atan2((double) f1, this.motionY) * 180.0D / Math.PI) - 90.0F;
        this.rotationPitch - this.prevRotationPitch < -180.0F;
        this.prevRotationPitch -= 360.0F) ;

    while (this.rotationPitch - this.prevRotationPitch >= 180.0F) this.prevRotationPitch += 360.0F;
    while (this.rotationYaw - this.prevRotationYaw < -180.0F) this.prevRotationYaw -= 360.0F;
    while (this.rotationYaw - this.prevRotationYaw >= 180.0F) this.prevRotationYaw += 360.0F;

    this.rotationPitch =
        this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
    this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;

    if (this.isInWater()) {
      for (int j = 0; j < 4; ++j) {
        float f3 = 0.25F;
        this.worldObj.spawnParticle(
            "bubble",
            this.posX - this.motionX * (double) f3,
            this.posY - this.motionY * (double) f3,
            this.posZ - this.motionZ * (double) f3,
            this.motionX,
            this.motionY,
            this.motionZ);
      }
    }

    this.setPosition(this.posX, this.posY, this.posZ);
  }
  public static void renderAllIEConnections(float partial) {
    if (connectionsRendered) return;
    GL11.glPushMatrix();

    GL11.glDisable(GL11.GL_CULL_FACE);
    //		GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    RenderHelper.enableStandardItemLighting();

    Tessellator.instance.startDrawing(GL11.GL_QUADS);

    EntityLivingBase viewer = ClientUtils.mc().renderViewEntity;
    double dx =
        viewer.lastTickPosX
            + (viewer.posX - viewer.lastTickPosX) * partial; // (double)event.partialTicks;
    double dy =
        viewer.lastTickPosY
            + (viewer.posY - viewer.lastTickPosY) * partial; // (double)event.partialTicks;
    double dz =
        viewer.lastTickPosZ
            + (viewer.posZ - viewer.lastTickPosZ) * partial; // (double)event.partialTicks;

    for (Object o : ClientUtils.mc().renderGlobal.tileEntities)
      if (o instanceof IImmersiveConnectable) {
        TileEntity tile = (TileEntity) o;
        //				int lb = tile.getWorldObj().getLightBrightnessForSkyBlocks(tile.xCoord, tile.yCoord,
        // tile.zCoord, 0);
        //				int lb_j = lb % 65536;
        //				int lb_k = lb / 65536;
        //				OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lb_j /
        // 1.0F, (float)lb_k / 1.0F);

        Tessellator.instance.setTranslation(tile.xCoord - dx, tile.yCoord - dy, tile.zCoord - dz);
        //				GL11.glTranslated((tile.xCoord+.5-dx), (tile.yCoord+.5-dy), (tile.zCoord+.5-dz));
        ClientUtils.renderAttachedConnections((TileEntity) tile);
        //				GL11.glTranslated(-(tile.xCoord+.5-dx), -(tile.yCoord+.5-dy), -(tile.zCoord+.5-dz));

      }

    Iterator<ImmersiveNetHandler.Connection> it = skyhookGrabableConnections.iterator();
    World world = viewer.worldObj;
    while (it.hasNext()) {
      ImmersiveNetHandler.Connection con = it.next();
      Tessellator.instance.setTranslation(
          con.start.posX - dx, con.start.posY - dy, con.start.posZ - dz);
      double r = con.cableType.getRenderDiameter() / 2;
      ClientUtils.drawConnection(
          con, Utils.toIIC(con.start, world), Utils.toIIC(con.end, world), 0x00ff99, 128, r * 1.75);
    }

    Tessellator.instance.setTranslation(0, 0, 0);
    Tessellator.instance.draw();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_CULL_FACE);

    GL11.glPopMatrix();
    connectionsRendered = true;
  }