Minecraft Screen Capture & Control

by Octapoo

Tuesday, February 4, 2020 at 06:26:00 UTC

Return to the Summary in Ecstatic Lyrics Blog

I heard about an achievement in Minecraft that you get for flying through a one-block hole. In trying to get this achievement, I found it to be ridiculously difficult. So, I wrote a program to do it.

The program screen captures Minecraft to read the coordinates from the screen and then create fake mouse movements to fly through the hole. Here it is in action.

I made it so that enabling the F3 menu to show the coordinates enables the program, so it only has control after the coordinates appear on the screen. I still have to fly it to a suitable starting location at the beginning and then make it land at the end.

It stops controlling flight as soon as it's through the hole so that I can take control of it immediately without having to disable F3 first.

With no expectation that Minecraft follows any real-world physics, I ended up just having it do a downward glide at every angle to measure the downward slope, and put them all in a table. So, as it approaches, it just calculates the necessary slope to end up in the hole, then looks in the table to figure out which downward angle is going to do that.

There's not much room for error. The player's hit box is 0.6 blocks tall, and at a 10:1 glide ratio, the player will fall 0.16 blocks over the distance which it can collide with the 1 block thick wall. So 1 - 0.6 - 0.16 = 0.24, so aiming at the right spot, the vertical height can only be off by +/- 0.12 blocks. The program aims to go through the hole at Y=91.2 and the frame in the video where it passes the hole shows it going in at 91.18.


If you were logged in, there would be a comment submission form here.
Creating an account is easy. You literally just type in a name and a password.
I don't want your email address, so there won't be any links in any emails to click.

Return to the Summary in Ecstatic Lyrics Blog