Advertisement
Guest User

Untitled

a guest
Aug 19th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. public static void cast(EntityPlayer player) {
  2. AxisAlignedBB fanBox = getEffectAABB(player.worldObj, player);
  3. Vec3d lookVec = player.getLookVec();
  4.  
  5. fanEntitiesAABB(player.worldObj, player, fanBox);
  6. }
  7.  
  8. private static void fanEntitiesAABB(World world, EntityPlayer player, AxisAlignedBB fanBox) {
  9. Vec3d moveVec = player.getLookVec();
  10.  
  11. List<Entity> inBox = world.getEntitiesWithinAABBExcludingEntity(player, fanBox);
  12.  
  13. float force = 2.0F;
  14.  
  15. for(Entity entity : inBox) {
  16. if(entity.canBePushed() || entity instanceof EntityItem) {
  17. entity.motionX = moveVec.xCoord * force;
  18. entity.motionY = moveVec.yCoord * force;
  19. entity.motionZ = moveVec.zCoord * force;
  20. }
  21. }
  22. }
  23.  
  24. private static AxisAlignedBB getEffectAABB(World world, EntityPlayer player) {
  25. double range = 3.0D;
  26. double radius = 2.0D;
  27.  
  28. Vec3d srcVec = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
  29. Vec3d lookVec = player.getLookVec();
  30. Vec3d destVec = srcVec.addVector(lookVec.xCoord * range, lookVec.yCoord * range, lookVec.zCoord * range);
  31.  
  32. AxisAlignedBB crumbleBox = new AxisAlignedBB(destVec.xCoord - radius, destVec.yCoord - radius, destVec.zCoord - radius, destVec.xCoord + radius, destVec.yCoord + radius, destVec.zCoord + radius);
  33.  
  34. return crumbleBox;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement