Package crazypants.vecmath

Examples of crazypants.vecmath.Vector3d


    }
    return v;
  }

  public static Vector3d getEyePositionEio(EntityPlayer player) {
    Vector3d res = new Vector3d(player.posX, player.posY, player.posZ);
    if(player.worldObj.isRemote) {
      //take into account any eye changes done by mods.
      res.y += player.getEyeHeight() - player.getDefaultEyeHeight();
    } else {
      res.y += player.getEyeHeight();
View Full Code Here


    return res;
  }

  public static Vector3d getLookVecEio(EntityPlayer player) {
    Vec3 lv = player.getLookVec();
    return new Vector3d(lv.xCoord, lv.yCoord, lv.zCoord);
  }
View Full Code Here

  public static Vector3d forDir(ForgeDirection dir) {
    return OFFSETS[dir.ordinal()];
  }

  public static Vector3d forDirCopy(ForgeDirection dir) {
    return new Vector3d(OFFSETS[dir.ordinal()]);
  }
View Full Code Here

  public static Vector3d forDirCopy(ForgeDirection dir) {
    return new Vector3d(OFFSETS[dir.ordinal()]);
  }

  public static Vector3d offsetScaled(ForgeDirection dir, double scale) {
    Vector3d res = forDirCopy(dir);
    res.scale(scale);
    return res;
  }
View Full Code Here

 
  private EntityUtil() {   
  }

  public static Vector3d getEntityPosition(Entity ent) {
    return new Vector3d(ent.posX, ent.posY, ent.posZ);
  }
View Full Code Here

    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
  }

  public static Matrix4d createBillboardMatrix(TileEntity te, EntityLivingBase entityPlayer) {
    return createBillboardMatrix(new Vector3d(te.xCoord + 0.5, te.yCoord + 0.5, te.zCoord + 0.5), entityPlayer);
  }
View Full Code Here

  public static Matrix4d createBillboardMatrix(TileEntity te, EntityLivingBase entityPlayer) {
    return createBillboardMatrix(new Vector3d(te.xCoord + 0.5, te.yCoord + 0.5, te.zCoord + 0.5), entityPlayer);
  }

  public static Matrix4d createBillboardMatrix(Vector3d lookAt, EntityLivingBase entityPlayer) {
    Vector3d playerEye = new Vector3d(entityPlayer.posX, entityPlayer.posY + 1.62 - entityPlayer.yOffset, entityPlayer.posZ);
    Vector3d blockOrigin = new Vector3d(lookAt.x, lookAt.y, lookAt.z);
    Matrix4d lookMat = VecmathUtil.createMatrixAsLookAt(blockOrigin, playerEye, RenderUtil.UP_V);
    lookMat.setTranslation(new Vector3d());
    lookMat.invert();
    return lookMat;
  }
View Full Code Here

    Tessellator tes = Tessellator.instance;
    tes.startDrawingQuads();
    tes.setBrightness(brightness);

    double s = size / 2;
    Vector3d v = new Vector3d();
    v.set(-s, s, 0);
    lookMat.transform(v);
    tes.addVertexWithUV(v.x, v.y, v.z, minU, maxV);
    v.set(s, s, 0);
    lookMat.transform(v);
    tes.addVertexWithUV(v.x, v.y, v.z, maxU, maxV);
    v.set(s, -s, 0);
    lookMat.transform(v);
    tes.addVertexWithUV(v.x, v.y, v.z, maxU, minV);
    v.set(-s, -s, 0);
    lookMat.transform(v);
    tes.addVertexWithUV(v.x, v.y, v.z, minU, minV);
    tes.draw();
  }
View Full Code Here

    ITravelAccessable ta = (ITravelAccessable) tileentity;
    if(!ta.canSeeBlock(Minecraft.getMinecraft().thePlayer)) {
      return;
    }

    Vector3d eye = Util.getEyePositionEio(Minecraft.getMinecraft().thePlayer);
    Vector3d loc = new Vector3d(tileentity.xCoord + 0.5, tileentity.yCoord + 0.5, tileentity.zCoord + 0.5);
    double maxDistance = TravelController.instance.isTravelItemActive(Minecraft.getMinecraft().thePlayer) ? TravelSource.STAFF.maxDistanceTravelledSq
        : TravelSource.BLOCK.maxDistanceTravelledSq;
    if(eye.distanceSquared(loc) > maxDistance) {
      return;
    }
View Full Code Here

  }

  private AxisAlignedBB getKillBounds() {
    if(killBounds == null) {
      BoundingBox bb = new BoundingBox(getLocation());
      Vector3d min = bb.getMin();
      Vector3d max = bb.getMax();
      max.y += Config.killerJoeAttackHeight;
      min.y -= Config.killerJoeAttackHeight;

      ForgeDirection facingDir = ForgeDirection.getOrientation(facing);
      if(ForgeDirectionOffsets.isPositiveOffset(facingDir)) {
        max.add(ForgeDirectionOffsets.offsetScaled(facingDir, Config.killerJoeAttackLength));
        min.add(ForgeDirectionOffsets.forDir(facingDir));
      } else {
        min.add(ForgeDirectionOffsets.offsetScaled(facingDir, Config.killerJoeAttackLength));
        max.add(ForgeDirectionOffsets.forDir(facingDir));

      }
      if(facingDir.offsetX == 0) {
        min.x -= Config.killerJoeAttackWidth;
        max.x += Config.killerJoeAttackWidth;
View Full Code Here

TOP

Related Classes of crazypants.vecmath.Vector3d

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.