Converting Files into Minecraft Worlds

https://news.ycombinator.com/rss Hits: 9
Summary

Did you ever want to store the Minecraft movie in Minecraft? No? Too bad, because now you can. The Idea I recently had the silly idea to convert a file into a Minecraft world. This led me down a really cool rabbit-hole, learning a ton about 3D geometry, byte layouts and Minecraft. The core idea is pretty simple: I want to take any file and be able to view it in Minecraft blocks. Along the way I also managed to convince my code that a tiny text-file is 2.3 exabytes large. Why Why not. Palette Generator The first thing you need is a lookup table. A byte can hold one of 256 values (0–255), and luckily there are way more than 256 blocks in Minecraft, so I can hand every single byte its own block. Byte 0 becomes stone, byte 1 becomes granite, all the way up to 255. A bunch of blocks carry state that changes on its own or depends on placement: wheat, carrots and other crops have an age, water and lava have a level. If byte 42 decoded to wheat and that wheat grew a stage, my decoder would read the wrong byte and the whole file would be in shambles. I first get the block data for 1.21.11 with mcdata_rs, throw out anything with an age or level state (plus beds and chests, more on those later), take the first 256 blocks, and write them into a Rust file as a fixed array. ( At the end of the video you can see the filter process where the blocks get filtered down to only good blocks ) The code: use mcdata_rs::mc_data; use std::{fs, path::Path}; const NAUGHTY_LIST: &[&str] = &[ "sand", "gravel", "anvil", "dragon_egg", "scaffolding", "dripstone", "snow", "farmland", "chest", "_bed", "door", "ice", "grass_block", ]; fn main() { let data_1_21_11 = mc_data("1.21.11").expect("Failed to download Minecraft Block Data"); let palette = data_1_21_11 .blocks_array .iter() .filter(|b| b.bounding_box.eq("block")) .filter(|b| { !b.states .iter() .any(|s| matches!(s.name.as_str(), "age" | "level" | "part")) }) .filter(|b| !NAUGHTY_LIST.iter().any(|g| b.name.contains(g))) .collect::<Vec<_>>(); l...

First seen: 2026-07-23 20:10

Last seen: 2026-07-24 04:14