Guest User

Untitled

a guest
Jul 17th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. @SubscribeEvent
  2. public void a(final MouseEvent a) {
  3. final double d2 = Reach.min.getMinecraft() + this.r.nextDouble() * (Reach.max.getMinecraft() - Reach.min.getMinecraft());
  4. final Object[] objects = a(d2, 0.0, 0.0f);
  5. if (objects == null) {
  6. return;
  7. }
  8. Reach.mc.objectMouseOver = new MovingObjectPosition((Entity) objects[0], (Vec3) objects[1]);
  9. Reach.mc.pointedEntity = (Entity) objects[0];
  10. }
  11.  
  12. public static Object[] a(final double d, final double expand, final float partialTicks) {
  13. final Entity var2 = Reach.mc.renderViewEntity;
  14. Entity entity = null;
  15. if (var2 == null || Reach.mc.theWorld == null) {
  16. return null;
  17. }
  18. Reach.mc.mcProfiler.startSection("pick");
  19. Random rnd = new Random();
  20. final Vec3 var3 = Reach.mc.renderViewEntity.getPosition(0.0f);
  21. final Vec3 var4 = Reach.mc.renderViewEntity.getLook(0.0f);
  22. final Vec3 var5 = var3.addVector(var4.xCoord * d, var4.yCoord * d, var4.zCoord * d);
  23. Vec3 var6 = null;
  24. final float var7 = 1.0f;
  25. final List var8 = Reach.mc.theWorld.getEntitiesWithinAABBExcludingEntity((Entity) Reach.mc.renderViewEntity,
  26. Reach.mc.renderViewEntity.boundingBox.addCoord(var4.xCoord * d, var4.yCoord * d, var4.zCoord * d)
  27. .expand(1.0, 1.0, 1.0));
  28. double var9 = d;
  29. for (int var10 = 0; var10 < var8.size(); ++var10) {
  30. final Entity var11 = (Entity) var8.get(var10);
  31. if (var11.canBeCollidedWith()) {
  32. final float var12 = var11.getCollisionBorderSize();
  33. AxisAlignedBB var13 = var11.boundingBox.expand((double) var12, (double) var12, (double) var12);
  34. var13 = var13.expand(expand, expand, expand);
  35. final MovingObjectPosition var14 = var13.calculateIntercept(var3, var5);
  36. if (var13.isVecInside(var3)) {
  37. if (0.0 < var9 || var9 == 0.0) {
  38. entity = var11;
  39. var6 = ((var14 == null) ? var3 : var14.hitVec);
  40. var9 = 0.0;
  41. }
  42. } else if (var14 != null) {
  43. final double var15 = var3.distanceTo(var14.hitVec);
  44. if (var15 < var9 || var9 == 0.0) {
  45. final boolean canRiderInteract = false;
  46. if (var11 == var2.ridingEntity) {
  47. if (var9 == 0.0) {
  48. entity = var11;
  49. var6 = var14.hitVec;
  50. }
  51. } else {
  52. entity = var11;
  53. var6 = var14.hitVec;
  54. var9 = var15;
  55. }
  56. }
  57. }
  58. }
  59. }
  60. if (var9 < d && !(entity instanceof EntityLivingBase) && !(entity instanceof EntityItemFrame)) {
  61. entity = null;
  62. }
  63. Reach.mc.mcProfiler.endSection();
  64. if (entity == null || var6 == null) {
  65. return null;
  66. }
  67. return new Object[] { entity, var6 };
  68. }
Advertisement
Add Comment
Please, Sign In to add comment