Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- public void a(final MouseEvent a) {
- final double d2 = Reach.min.getMinecraft() + this.r.nextDouble() * (Reach.max.getMinecraft() - Reach.min.getMinecraft());
- final Object[] objects = a(d2, 0.0, 0.0f);
- if (objects == null) {
- return;
- }
- Reach.mc.objectMouseOver = new MovingObjectPosition((Entity) objects[0], (Vec3) objects[1]);
- Reach.mc.pointedEntity = (Entity) objects[0];
- }
- public static Object[] a(final double d, final double expand, final float partialTicks) {
- final Entity var2 = Reach.mc.renderViewEntity;
- Entity entity = null;
- if (var2 == null || Reach.mc.theWorld == null) {
- return null;
- }
- Reach.mc.mcProfiler.startSection("pick");
- Random rnd = new Random();
- final Vec3 var3 = Reach.mc.renderViewEntity.getPosition(0.0f);
- final Vec3 var4 = Reach.mc.renderViewEntity.getLook(0.0f);
- final Vec3 var5 = var3.addVector(var4.xCoord * d, var4.yCoord * d, var4.zCoord * d);
- Vec3 var6 = null;
- final float var7 = 1.0f;
- final List var8 = Reach.mc.theWorld.getEntitiesWithinAABBExcludingEntity((Entity) Reach.mc.renderViewEntity,
- Reach.mc.renderViewEntity.boundingBox.addCoord(var4.xCoord * d, var4.yCoord * d, var4.zCoord * d)
- .expand(1.0, 1.0, 1.0));
- double var9 = d;
- for (int var10 = 0; var10 < var8.size(); ++var10) {
- final Entity var11 = (Entity) var8.get(var10);
- if (var11.canBeCollidedWith()) {
- final float var12 = var11.getCollisionBorderSize();
- AxisAlignedBB var13 = var11.boundingBox.expand((double) var12, (double) var12, (double) var12);
- var13 = var13.expand(expand, expand, expand);
- final MovingObjectPosition var14 = var13.calculateIntercept(var3, var5);
- if (var13.isVecInside(var3)) {
- if (0.0 < var9 || var9 == 0.0) {
- entity = var11;
- var6 = ((var14 == null) ? var3 : var14.hitVec);
- var9 = 0.0;
- }
- } else if (var14 != null) {
- final double var15 = var3.distanceTo(var14.hitVec);
- if (var15 < var9 || var9 == 0.0) {
- final boolean canRiderInteract = false;
- if (var11 == var2.ridingEntity) {
- if (var9 == 0.0) {
- entity = var11;
- var6 = var14.hitVec;
- }
- } else {
- entity = var11;
- var6 = var14.hitVec;
- var9 = var15;
- }
- }
- }
- }
- }
- if (var9 < d && !(entity instanceof EntityLivingBase) && !(entity instanceof EntityItemFrame)) {
- entity = null;
- }
- Reach.mc.mcProfiler.endSection();
- if (entity == null || var6 == null) {
- return null;
- }
- return new Object[] { entity, var6 };
- }
Advertisement
Add Comment
Please, Sign In to add comment