public Point getDrag() {
   Point mouse = getMousePosition();
   Point drag = new Point(mouse.x - dragDown.x, mouse.y - dragDown.y);
   Dimension size = displaySize();
   Dimension sample = sampleSize();
   drag.x *= 10000;
   drag.y *= 10000;
   drag.x /= (size.width - sample.width);
   drag.y /= (size.height - sample.height);
   Point pos = getPos();
   drag.x = (int) MathHelper.clip(drag.x, -pos.x, 10000 - pos.x);
   drag.y = (int) MathHelper.clip(drag.y, -pos.y, 10000 - pos.y);
   return drag;
 }
  public static void drawMultilineTip(int x, int y, List<String> list) {
    if (list.isEmpty()) return;

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    RenderHelper.disableStandardItemLighting();

    int w = 0;
    int h = -2;
    for (int i = 0; i < list.size(); i++) {
      String s = list.get(i);
      ITooltipLineHandler line = getTipLine(s);
      Dimension d =
          line != null
              ? line.getSize()
              : new Dimension(
                  getStringWidth(s),
                  list.get(i).endsWith(TOOLTIP_LINESPACE) && i + 1 < list.size() ? 12 : 10);
      w = Math.max(w, d.width);
      h += d.height;
    }

    if (x < 8) x = 8;
    else if (x > displaySize().width - w - 8) x -= 24 + w; // flip side of cursor
    y = (int) MathHelper.clip(y, 8, displaySize().height - 8 - h);

    gui.incZLevel(300);
    drawTooltipBox(x - 4, y - 4, w + 7, h + 7);
    for (String s : list) {
      ITooltipLineHandler line = getTipLine(s);
      if (line != null) {
        line.draw(x, y);
        y += line.getSize().height;
      } else {
        fontRenderer.drawStringWithShadow(s, x, y, -1);
        y += s.endsWith(TOOLTIP_LINESPACE) ? 12 : 10;
      }
    }

    tipLineHandlers.clear();
    gui.incZLevel(-300);

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableGUIStandardItemLighting();
  }
  @Override
  public boolean generate(World world, Random random, int x, int y, int z) {
    // Randomly space out blocks in vein
    float f = random.nextFloat() * 3.141593F;
    double d = x + 8 + MathHelper.sin(f) * this.veinSize / 8.0F;
    double d1 = x + 8 - MathHelper.sin(f) * this.veinSize / 8.0F;
    double d2 = z + 8 + MathHelper.cos(f) * this.veinSize / 8.0F;
    double d3 = z + 8 - MathHelper.cos(f) * this.veinSize / 8.0F;
    double d4 = y + random.nextInt(3) + 2;
    double d5 = y + random.nextInt(3) + 2;

    // Do this once for every block of ore we need to generate.
    for (int l = 0; l <= this.veinSize; l++) {
      double d6 = d + (d1 - d) * l / this.veinSize;
      double d7 = d4 + (d5 - d4) * l / this.veinSize;
      double d8 = d2 + (d3 - d2) * l / this.veinSize;
      double d9 = random.nextDouble() * this.veinSize / 16.0D;
      double d10 = (MathHelper.sin(l * 3.141593F / this.veinSize) + 1.0F) * d9 + 1.0D;
      double d11 = (MathHelper.sin(l * 3.141593F / this.veinSize) + 1.0F) * d9 + 1.0D;
      int i1 = MathHelper.floor_double(d6 - d10 / 2.0D);
      int j1 = MathHelper.floor_double(d7 - d11 / 2.0D);
      int k1 = MathHelper.floor_double(d8 - d10 / 2.0D);
      int l1 = MathHelper.floor_double(d6 + d10 / 2.0D);
      int i2 = MathHelper.floor_double(d7 + d11 / 2.0D);
      int j2 = MathHelper.floor_double(d8 + d10 / 2.0D);
      for (int k2 = i1; k2 <= l1; k2++) {
        double d12 = (k2 + 0.5D - d6) / (d10 / 2.0D);
        if (d12 * d12 < 1.0D) {
          for (int l2 = j1; l2 <= i2; l2++) {
            double d13 = (l2 + 0.5D - d7) / (d11 / 2.0D);
            if (d12 * d12 + d13 * d13 < 1.0D) {
              for (int i3 = k1; i3 <= j2; i3++) {
                double d14 = (i3 + 0.5D - d8) / (d10 / 2.0D);
                if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) {
                  swapStoneBlock(world, random, k2, l2, i3);
                }
              }
            }
          }
        }
      }
    }
    return true;
  }