Package vazkii.botania.api.internal

Examples of vazkii.botania.api.internal.IManaBurst


  public static void applyEffect(World world, double x, double y, double z) {
    int range = 8;
    List<Entity> entities = world.getEntitiesWithinAABB(IManaBurst.class, AxisAlignedBB.getBoundingBox(x - range, y - range, z - range, x + range, y + range, z + range));
    for(Entity entity : entities) {
      IManaBurst burst = (IManaBurst) entity;
      ItemStack lens = burst.getSourceLens();
      if(lens != null && lens.getItem() instanceof ITinyPlanetExcempt && !((ITinyPlanetExcempt) lens.getItem()).shouldPull(lens))
        continue;

      int orbitTime = getEntityOrbitTime(entity);
      if(orbitTime == 0)
        burst.setMinManaLoss(burst.getMinManaLoss() * 3);

      float radius = Math.min(7.5F, (Math.max(40, orbitTime) - 40) / 40F + 1.5F);
      int angle = orbitTime % 360;

      float xTarget = (float) (x + Math.cos(angle * 10 * Math.PI / 180F) * radius);
      float yTarget = (float) y;
      float zTarget = (float) (z + Math.sin(angle * 10 * Math.PI / 180F) * radius);

      Vector3 targetVec = new Vector3(xTarget, yTarget, zTarget);
      Vector3 currentVec = new Vector3(entity.posX, entity.posY, entity.posZ);
      Vector3 moveVector = targetVec.copy().sub(currentVec);

      burst.setMotion(moveVector.x, moveVector.y, moveVector.z);

      incrementOrbitTime(entity);
    }
  }
View Full Code Here

TOP

Related Classes of vazkii.botania.api.internal.IManaBurst

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.