Package thaumcraft.codechicken.lib.vec

Examples of thaumcraft.codechicken.lib.vec.Vector3


  @Override
  public void onUsingFocusTick(ItemStack stack, EntityPlayer player, int ticks) {
    ItemWandCasting wand = (ItemWandCasting) stack.getItem();

    Vector3 target = Vector3.fromEntityCenter(player);

    final int range = 6 + EnchantmentHelper.getEnchantmentLevel(Config.enchPotency.effectId, wand.getFocusItem(stack));
    final double distance = range - 1;
    if (!player.isSneaking())
      target.add(new Vector3(player.getLookVec()).multiply(distance));

    target.y += 0.5;

    List<EntityItem> entities = player.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(target.x - range, target.y - range, target.z - range, target.x + range, target.y + range, target.z + range));
View Full Code Here


  public static MinecraftServer server() {
    return MinecraftServer.getServer();
  }

  public static void setEntityMotionFromVector(Entity entity, Vector3 originalPosVector, float modifier) {
    Vector3 entityVector = Vector3.fromEntityCenter(entity);
    Vector3 finalVector = originalPosVector.copy().subtract(entityVector);

    if (finalVector.mag() > 1)
      finalVector.normalize();

    entity.motionX = finalVector.x * modifier;
    entity.motionY = finalVector.y * modifier;
    entity.motionZ = finalVector.z * modifier;
  }
 
View Full Code Here

    List<Entity> projectiles = p.worldObj.getEntitiesWithinAABB(IProjectile.class, AxisAlignedBB.getBoundingBox(p.posX - 4, p.posY - 4, p.posZ - 4, p.posX + 3, p.posY + 3, p.posZ + 3));

    for (Entity e : projectiles) {
      if (DeflectBlacklist.contains(e.getClass()) || ProjectileHelper.getOwner(e) == p)
        continue;
      Vector3 motionVec = new Vector3(e.motionX, e.motionY, e.motionZ).normalize().multiply(Math.sqrt((e.posX - p.posX) * (e.posX - p.posX) + (e.posY - p.posY) * (e.posY - p.posY) + (e.posZ - p.posZ) * (e.posZ - p.posZ)) * 2);

      for (int i = 0; i < 6; i++)
        ThaumicTinkerer.tcProxy.sparkle((float) e.posX, (float) e.posY, (float) e.posZ, 6);

      e.posX += motionVec.x;
View Full Code Here

    int x = (int) Math.floor(player.posX);
    int y = (int) player.posY + 1;
    int z = (int) Math.floor(player.posZ);

    float yaw = MathHelper.wrapAngleTo180_float(player.rotationYaw + 90F) * (float) Math.PI / 180F;
    Vector3 lookVector = new Vector3(Math.cos(yaw), Math.sin(yaw), 0).normalize();
    Vector3 newVector = new Vector3(lookVector.x, lookVector.y, 0);

    for (int i = 0; i < 5; i++) {
      newVector = newVector.add(lookVector);

      int x1 = x + (int) newVector.x;
      int z1 = z + (int) newVector.y;
      ItemBrightNitor.setBlock(x1, y, z1, player.worldObj);
    }
View Full Code Here

    public Beam(World par1World, EntityLivingBase par2EntityLivingBase, int potency) {
      super(par1World, par2EntityLivingBase);

      this.potency = potency;
      setProjectileVelocity(motionX / 10, motionY / 10, motionZ / 10);
      movementVector = new Vector3(motionX, motionY, motionZ);
    }
View Full Code Here

        if ((MinecraftServer.getServer().isPVPEnabled() || !(movingobjectposition.entityHit instanceof EntityPlayer)) && movingobjectposition.entityHit != getThrower() && getThrower() instanceof EntityPlayer && !movingobjectposition.entityHit.worldObj.isRemote)
          movingobjectposition.entityHit.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) getThrower()), 8 + potency);
        return;
      }

      Vector3 movementVec = new Vector3(motionX, motionY, motionZ);
      ForgeDirection dir = ForgeDirection.getOrientation(movingobjectposition.sideHit);
      Vector3 normalVector = new Vector3(dir.offsetX, dir.offsetY, dir.offsetZ).normalize();

      movementVector = normalVector.multiply(-2 * movementVec.dotProduct(normalVector)).add(movementVec);

      motionX = movementVector.x;
      motionY = movementVector.y;
      motionZ = movementVector.z;
    }
View Full Code Here

    }

    List<Entity> entitiesAtEnd = getEntitiesAtPoint(endCoords);
    List<Entity> entitiesAtTarget = getEntitiesAtPoint(targetCoords);

    Vector3 targetToEnd = asVector(targetCoords, endCoords);
    Vector3 endToTarget = asVector(endCoords, targetCoords);

    for (Entity entity : entitiesAtEnd)
      moveEntity(entity, endToTarget);
    for (Entity entity : entitiesAtTarget)
      moveEntity(entity, targetToEnd);
View Full Code Here

  private List<Entity> getEntitiesAtPoint(ChunkCoordinates coords) {
    return worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(coords.posX, coords.posY, coords.posZ, coords.posX + 1, coords.posY + 1, coords.posZ + 1));
  }

  private Vector3 asVector(ChunkCoordinates source, ChunkCoordinates target) {
    return new Vector3(target.posX, target.posY, target.posZ).subtract(new Vector3(source.posX, source.posY, source.posZ));
  }
View Full Code Here

        double z2 = entity.posZ;

        float distanceSqrd = blue ? (float) ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)) : 1.1F;

        if (distanceSqrd > 1) {
          MiscHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), speedMod * 0.25F);
          ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of thaumcraft.codechicken.lib.vec.Vector3

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.