Optimization lessons from a Minecraft structure locatorMarch 18, 2026This post has been sitting in my drafts for a year because I never finished benchmarking stuff to the point I consider thorough enough for release. I’m trying to deal with my backlog, and I think this post has tricks that some of you might enjoy anyway. Treat it as a director’s cut sort of thing.Minecraft generates a bedrock floor at the bottom of the world from a random noise. Since it’s random, it can contain naturally generated unescapable regions – prisons. While small prisons are common, larger ones are hard to find – a Minecraft world is about 60 million by 60 million blocks, so locating these boxes is computationally difficult. So when I saw Bamboo Bot’s video on this concept covering a simple tool written in Java, I knew I had to give a try myself.VIDEOAfter keeping my PC running for a couple days, here’s the largest prison I found:I find this problem a good exercise for performance optimization because it has a limited scope, but also covers lots of topics. And it’s quite a head-scratcher due to its large scale! In this post, I’ll cover various surprising approaches and tricks I used, and hopefully you’ll be able to apply them to your projects.The bedrock noise is generated by a boolean function Bedrock(x,y,z). It computes a random float from 0 to 1 based on the coordinates and compares it with a probability to determine whether it should place bedrock or keep air. At y=−64, the probability of bedrock is 1, and it decreases as we go up, reaching 0 at y=−59.The simplest bedrock prison we’re searching for looks like this. The player cannot perform a two block high jump under normal conditions, so after they get into this box, they’ll never be able to escape it (without damage ticks, anyway).Large boxes of this exact kind are incredibly rare, so even with optimizations we’ll have to look for more complex structures.While we could perform an exact analysis in the 3D space, that would be incred...
First seen: 2026-03-26 12:08
Last seen: 2026-03-26 21:15