What is the best angle for an enderpearl if I am aiming for distance?
Solution 1:
Interesting question, and I've just performed some test on a superflat world. I started issuing commands to set my player position, as follows:
/tp 0.0 4 0.0 0 -35
The last parameter, is the angle of inclination, with 0 being horizontal, -90 looking straight up into the sky, and +90, being looking straight down. I did a set of tests starting at 20° (-20 in the TP command), increasing by 5° at a time, which revealed the following Z coordinate results on the F3 screen after teleporting to where the ender pearl landed.
20 41.409
25 47.133
30 50.347
35 53.170
40 52.095
45 52.069
50 49.076
55 46.046
The results above show that 35° is the optimal at 5° steps, so I then tested at 34° and 36°, just in case 35 wasn't quite optimal, and the results were as follows
34 52.674
35 53.170
36 52.509
So there you have it, 35° is the optimal value.
Note that I'm running 1.8.1, result may vary between versions, though unlikely I'd say.
Note the testing wasn't very scientific, as I might have moved the mouse a little as I threw the ender pearl (although I'm pretty sure I didn't), also the X coordinate during this testing did vary slightly, it seems to be 0.0 ± 0.5, not significant enough to be an issue though.
Solution 2:
I tried to make a geometry based justification for the observation that angles less than 45° were giving longer ranges. Since in minecraft projectiles are launched at about 1.5m above the ground this is analogous to hitting a golf ball off a cliff. I made this diagram:
So you're standing on a cliff at height Y0 and hit the ball at angle theta. Let's divide the space into two regions, where region 1 is the height above Y0 and region 2 is the height below Y0. In region 1, the range D1 can be modeled by the range equation for level ground, where maximum distance is found at 45°. Because the trajectory is a parabola, and parabolas are symmetric, the angle at the end of the parabola is also theta.
So when the ball crosses Y0 and enters region 2, it is traveling at theta degrees below horizontal because of some geometric property whose name I can't remember. The distance traveled in region 2, D2, is modeled by the X component of the velocity times the time before the ball hits the ground. The time is found from 0 = -g/2 * T^2 - Vy * T + Y0 and the x velocity is the initial velocity times the cosine of theta. D2 is maximized when theta is 0°.
The total distance is D1 + D2, but we can't maximize D1 and D2 at the same time. If we give up some D1 and launch at less than 45° we can get enough more distance in D2 to get a larger sum. As the initial height Y0 increases, the ball spends more time in region 2 before it hits the ground, so lower angles give longer flight times in D2.
I have collected some data using arrows in minecraft. I used a superflat world in creative mode, with a normal bow and arrow. I stood at a set Z and used the F3 debug screen to aim south and fired the bow at full strength several times at each angle from 0 to 90 at 5 degree increments within 0.1 degrees of error. I noticed the arrows fell into a cluster, so I placed a block in the middle of the cluster and took the distance of each block. I did this under 3 conditions, standing on level ground, standing in a 1.5m deep hole (dug 2 blocks down, placed a half-slab), and on a 10 block tall pillar.
It's hard to see here, but on level ground, maximum distance was obtained at about 37.5 degrees. In the 1.5m hole, maximum flight distance was obtained at 40 degrees. On the 10m pillar, maximum flight distance was obtained at 32.5 degrees.
These results support the model hypothesized above. As height above ground increased, the ideal launch angle decreased. Interestingly, the fact that the 1.5m deep hole test also gave an ideal angle less than 45 degrees suggests that the arrows are being launched at a height slightly above 1.5m, so that even in the hole they started at height greater than they landed. Someone would have to look at the minecraft code to know more certainly.