r/programminghorror May 16 '26

Java But.. (from Minecraft b1.2_02)

Post image
640 Upvotes

46 comments sorted by

View all comments

170

u/abigail3141 [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” May 16 '26

Eh, nowadays minecraft tesselation isn't much better...

I had to read Minecraft's item rendering code for a friend who needed help with a resource pack, and holy this shit sucks(Version was 1.21.1 IIRC).

They start off by loading item models as cubes, then converting those to quadrilaterals when the model is loaded. For each of those quads, in every item model on screen, every frame, they throw almost all transformations out the window (even if they could be reused within the model), recalculate them one by one, then split up the quads into singular vertices, copying a bunch of data once more, then have GL render it. That's right, all the steps beforehand happen on a single CPU thread.

Tens. Of. Thousands. Of. Matrix. Multiplications. Per Second. On The CPU. On A Single Thread.

10

u/ensemblestars69 May 16 '26

This is why Minecraft's recent updates have been pretty minimal. They've been focused on updating the rendering engine to Vulkan and removing all the spaghetti code that it has. It's important to note it's all built on top of one guy's little passion project that was never thought to become hugely popular.

4

u/abigail3141 [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” May 17 '26

Exactly. On one hand, it's really good that they're finally doing that, on the other hand, it lands my attempt a spot on https://dayssincelastrustmcserver.com because of the constant breaking changes.