Advertisement
FuskedLLCC

Untitled

Apr 10th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. code snippets Cloud :
  2.  
  3. public void onMouse(final MouseEvent a) {
  4.  
  5. if (a.buttonstate && a.button == 0 && (mc.objectMouseOver == null || mc.objectMouseOver.entityHit == null) && findEnt(R) != null) {
  6.  
  7. mc.playerController.attackEntity((EntityPlayer)mc.thePlayer, findEnt(R));
  8.  
  9. }
  10.  
  11. }
  12.  
  13.  
  14.  
  15. public static Entity findEnt(final double a) {
  16.  
  17. final Minecraft minecraft;
  18.  
  19. final Minecraft getMinecraft = minecraft = Minecraft.getMinecraft();
  20.  
  21. final MovingObjectPosition rayTrace = getMinecraft.thePlayer.rayTrace(a, 1.0f);
  22.  
  23. double distanceTo = a;
  24.  
  25. final Vec3 getPosition = getMinecraft.thePlayer.getPosition(1.0f);
  26.  
  27. if (rayTrace != null) {
  28. distanceTo = rayTrace.hitVec.distanceTo(getPosition);
  29.  
  30. }
  31.  
  32. final Minecraft minecraft2 = minecraft;
  33.  
  34. final Vec3 getLook = minecraft2.thePlayer.getLook(1.0f);
  35.  
  36. final Vec3 addVector = getPosition.addVector(getLook.xCoord * a, getLook.yCoord * a, getLook.zCoord * a);
  37.  
  38. Entity entity = null;
  39.  
  40. final float n = 1.0f;
  41.  
  42. final WorldClient theWorld = minecraft2.theWorld;
  43.  
  44. final Minecraft minecraft3 = minecraft;
  45.  
  46. final List getEntitiesWithinAABBExcludingEntity = theWorld.getEntitiesWithinAABBExcludingEntity((Entity)minecraft3.thePlayer, minecraft3.thePlayer.boundingBox.addCoord(getLook.xCoord * a, getLook.yCoord * a, getLook.zCoord * a).expand(1.0, 1.0, 1.0));
  47.  
  48. double n2 = distanceTo;
  49.  
  50. int i;
  51.  
  52. for (int n3 = i = 0; i < getEntitiesWithinAABBExcludingEntity.size(); i = ++n3) {
  53.  
  54. final Entity entity2;
  55.  
  56. if ((entity2 = (Entity) getEntitiesWithinAABBExcludingEntity.get(n3)).canBeCollidedWith()) {
  57.  
  58. final Entity entity3 = entity2;
  59.  
  60. final float getCollisionBorderSize = entity3.getCollisionBorderSize();
  61.  
  62. final AxisAlignedBB expand = entity3.boundingBox.expand((double)getCollisionBorderSize, (double)getCollisionBorderSize, (double)getCollisionBorderSize);
  63.  
  64. final MovingObjectPosition calculateIntercept = expand.calculateIntercept(getPosition, addVector);
  65.  
  66. if (expand.isVecInside(getPosition)) {
  67.  
  68. if (0.0 < n2 || n2 == 0.0) {
  69.  
  70. entity = entity2;
  71.  
  72. n2 = 0.0;
  73.  
  74. }
  75.  
  76. }
  77.  
  78. else {
  79.  
  80. final double distanceTo2;
  81.  
  82. if (calculateIntercept != null && ((distanceTo2 = getPosition.distanceTo(calculateIntercept.hitVec)) < n2 || n2 == 0.0)) {
  83.  
  84. if (entity2 == minecraft.thePlayer.ridingEntity) {
  85.  
  86. if (n2 == 0.0) {
  87.  
  88. entity = entity2;
  89.  
  90. }
  91.  
  92. }else {
  93.  
  94. entity = entity2;
  95.  
  96. n2 = distanceTo2;
  97.  
  98. }
  99.  
  100. }
  101.  
  102. }
  103.  
  104. }
  105.  
  106. }
  107.  
  108. return entity;
  109.  
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement