Package net.minecraft.util

Examples of net.minecraft.util.Vec3


    ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
    if (!ConfigHandler.enableFlight) {
      return itemstack;
    }
    if (wand.consumeAllVis(itemstack, p, getVisCost(), true, false)) {
      Vec3 vec = p.getLookVec();
      double force = 1 / 1.5 * (1 + EnchantmentHelper.getEnchantmentLevel(Config.enchPotency.effectId, wand.getFocusItem(itemstack)) * 0.2);
      p.motionX = vec.xCoord * force;
      p.motionY = vec.yCoord * force;
      p.motionZ = vec.zCoord * force;
      p.fallDistance = 0F;
View Full Code Here


  {
    if(densityDir > 0)
    {
      return;
    }
    Vec3 vec_flow = this.getFlowVector(world, x, y, z);
    vec.xCoord += vec_flow.xCoord * (quantaPerBlock * 4);
    vec.yCoord += vec_flow.yCoord * (quantaPerBlock * 4);
    vec.zCoord += vec_flow.zCoord * (quantaPerBlock * 4);
  }
 
View Full Code Here

    Block block = Block.blocksList[world.getBlockId(x, y, z)];
    if(!(Block.blocksList[world.getBlockId(x, y, z)] instanceof BlockFluidRoot))
    {
      return -1000.0;
    }
    Vec3 vec = ((BlockFluidRoot) block).getFlowVector(world, x, y, z);

    return vec.xCoord == 0.0D && vec.zCoord == 0.0D ? -1000.0D : Math.atan2(vec.zCoord, vec.xCoord) - Math.PI / 2D;
  }
View Full Code Here

  }

  public Vec3 getFlowVector(IBlockAccess world, int x, int y, int z)
  {

    Vec3 vec = world.getWorldVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D);
    int decay = quantaPerBlock - getQuantaValue(world, x, y, z);

    for(int side = 0; side < 4; ++side)
    {
      int x2 = x;
      int z2 = z;

      switch(side)
      {
      case 0:
        --x2;
        break;
      case 1:
        --z2;
        break;
      case 2:
        ++x2;
        break;
      case 3:
        ++z2;
        break;
      }

      int otherDecay = quantaPerBlock - getQuantaValue(world, x2, y, z2);
      if(otherDecay >= quantaPerBlock)
      {
        if(!world.getBlockMaterial(x2, y, z2).blocksMovement())
        {
          otherDecay = quantaPerBlock - getQuantaValue(world, x2, y - 1, z2);

          if(otherDecay >= 0)
          {
            int power = otherDecay - (decay - quantaPerBlock);
            vec = vec.addVector((x2 - x) * power, (y - y) * power, (z2 - z) * power);
          }
        }
      }
      else if(otherDecay >= 0)
      {
        int power = otherDecay - decay;
        vec = vec.addVector((x2 - x) * power, (y - y) * power, (z2 - z) * power);
      }
    }

    if(world.getBlockId(x, y + 1, z) == blockID)
    {
      boolean flag = false;

      if(this.isBlockSolid(world, x, y, z - 1, 2))
      {
        flag = true;
      }
      else if(this.isBlockSolid(world, x, y, z + 1, 3))
      {
        flag = true;
      }
      else if(this.isBlockSolid(world, x - 1, y, z, 4))
      {
        flag = true;
      }
      else if(this.isBlockSolid(world, x + 1, y, z, 5))
      {
        flag = true;
      }
      else if(this.isBlockSolid(world, x, y + 1, z - 1, 2))
      {
        flag = true;
      }
      else if(this.isBlockSolid(world, x, y + 1, z + 1, 3))
      {
        flag = true;
      }
      else if(this.isBlockSolid(world, x - 1, y + 1, z, 4))
      {
        flag = true;
      }
      else if(this.isBlockSolid(world, x + 1, y + 1, z, 5))
      {
        flag = true;
      }

      if(flag)
      {
        vec = vec.normalize().addVector(0.0D, -6.0D, 0.0D);
      }
    }
    vec = vec.normalize();
    return vec;
  }
View Full Code Here

    return y;
  }

  public static MovingObjectPosition getCurrentMovingObjectPosition(EntityPlayer player, double distance) {

    Vec3 posVec = Vec3.createVectorHelper(player.posX, player.posY, player.posZ);
    Vec3 lookVec = player.getLook(1);
    posVec.yCoord += player.getEyeHeight();
    lookVec = posVec.addVector(lookVec.xCoord * distance, lookVec.yCoord * distance, lookVec.zCoord * distance);
    return player.worldObj.rayTraceBlocks(posVec, lookVec);
  }
View Full Code Here

    }
    return null;
  }

  public static Vec3 getEyePosition(EntityPlayer player) {
    Vec3 v = Vec3.createVectorHelper(player.posX, player.posY, player.posZ);
    if(player.worldObj.isRemote) {
      //take into account any eye changes done by mods.
      v.yCoord += player.getEyeHeight() - player.getDefaultEyeHeight();
    } else {
      v.yCoord += 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

            startVec.xCoord += d6 * d5;
            startVec.yCoord += d7 * d5;
            startVec.zCoord = d2;
          }

          Vec3 vec32 = Vec3.createVectorHelper(startVec.xCoord, startVec.yCoord, startVec.zCoord);
          l = (int) (vec32.xCoord = (double) MathHelper.floor_double(startVec.xCoord));
          if(b0 == 5) {
            --l;
            ++vec32.xCoord;
          }
View Full Code Here

    Vector3d look = Util.getLookVecEio(player);

    Vector3d sample = new Vector3d(look);
    sample.scale(Config.travelStaffMaxBlinkDistance);
    sample.add(eye);
    Vec3 eye3 = Vec3.createVectorHelper(eye.x, eye.y, eye.z);
    Vec3 end = Vec3.createVectorHelper(sample.x, sample.y, sample.z);

    double playerHeight = player.yOffset;
    //if you looking at you feet, and your player height to the max distance, or part there of
    double lookComp = -look.y * playerHeight;
    double maxDistance = Config.travelStaffMaxBlinkDistance + lookComp;
View Full Code Here

  private boolean canTeleportTo(EntityPlayer player, TravelSource source, BlockCoord bc, World w) {
    if(bc.y < 1) {
      return false;
    }
    if(source == TravelSource.STAFF_BLINK && !Config.travelStaffBlinkThroughSolidBlocksEnabled) {
      Vec3 start = Util.getEyePosition(player);
      Vec3 target = Vec3.createVectorHelper(bc.x + 0.5f, bc.y + 0.5f, bc.z + 0.5f);
      if(!canBlinkTo(bc, w, start, target)) {
        return false;
      }
    }  
View Full Code Here

TOP

Related Classes of net.minecraft.util.Vec3

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.