top | item 45748879

Minecraft removing obfuscation in Java Edition

1027 points| SteveHawk27 | 4 months ago |minecraft.net

464 comments

order
[+] NelsonMinar|4 months ago|reply
It's extraordinary to me that Minecraft is both the game that has the most robust mod community out there and that the modders were working from obfuscated, decompiled Java binaries. With elaborate tooling to deobfuscate and then reobfuscate using the same mangled names. For over a decade! What dedication.
[+] userbinator|4 months ago|reply
More proof that you don't need the source code to modify software. Then again, Java has always been easy to decompile, and IMHO the biggest obstacle to understanding is the "object-oriented obfuscation" that's inherent in large codebases even when you have the original source.
[+] ZeWaka|4 months ago|reply
To be fair, since 2019 Mojang has been providing the mappings instead of everyone having to use community-created ones.
[+] gretch|4 months ago|reply
In 2004 I played an MMO game on a pirated server. The owner of the server somehow got a version of the server binary, and used a hex editor (!) to add new features to the binary over time.

It's the closest I've ever see to someone literally being one of the hackers from Matrix, literally staring at hexadecimal and changing chars one at a time

[+] krackers|4 months ago|reply
Me too. Having only a vague familiarity with the game, I thought that mods were using some official plugin system. I had no idea that minecraft modders (presumably kids/teens?) were not only reverse engineering things but also creating an entire ecosystem to work around proguard.
[+] Karrot_Kream|4 months ago|reply
Java is pretty easy to decompile and it's not a huge amount of effort to poke into the generated JVM code and start doing things. If you have a decent idea of how VMs work, C-like languages work, and how object dispatch works it's really not that hard. Also the early modding scene for Minecraft was really fun. I was a huge Minecraft player at the time and was early into the deobfuscating -> modding scene and the community was one of the most fun computing communities I've been in. Due to how focused it was on the game and its output it wasn't bogged down in nearly as much bikeshedding and philosophy as most FOSS projects get. Honestly one of the highlights of the coding I've done in my life.
[+] 1313ed01|4 months ago|reply
I am terrified by Minecraft mods always being distributed from dodgy download sites and not rarely come with their own Windows EXE installers. And as far as I know there is no sandboxing at all in the game (uhm, no pun intended) so once installed the mod has full access to your computer?
[+] quantified|4 months ago|reply
I watched one of my young children power themselves through the obfuscation to learn advanced modding. There was zeal for the knowledge and mods in that community.
[+] enknamel|4 months ago|reply
This is fairly common in gaming mods. I wrote some mods myself and had to work with decompiled obfuscated code to find the right hooks, injection points, reverse implementations, etc.
[+] foxyv|4 months ago|reply
Mod developers were able to get the source code for Minecraft through a developer program over a decade ago. I'm not sure that it is still the case. I think they are just de-obfuscating the compiled CLASS files so anyone can decompile them without access to the source.
[+] strbean|4 months ago|reply
This was how many Runescape bots were developed back in the OSRS days. At some point (RS2?) they made the client super thin so there were no longer methods for high level game functionality (walk to here, get amount of gold in inventory, etc.).
[+] odo1242|4 months ago|reply
To be fair, the tooling existed before Minecraft and they published obfuscation maps that map the obfuscated names to the non obfuscated ones.
[+] kachapopopow|4 months ago|reply
it's actually pretty trivial and something a single person can do I had to rebuild a server jar to source since the guy maintaining it disappeared and it had special behaviors in it that were relied upon for the game networks playability.
[+] AyanamiKaine|4 months ago|reply
There is always one thing that I found so facintating with the modding scene in Minecraft. Because Minecraft does not have a modding api but the java byte code can be changed. People simply developed their own way of creating an API. There are 2 main modding APIs. Forge/Neo-Forge and Fabric.

[1]Fabric uses Mix-ins while [2]Forge uses a more event based system that is added to the source code of minecraft where they add hooks into events that users can use.

To me its just incredible. Its not often that I see that users own an abstraction instead of the developers.

I wonder from a modding perspective would it be better if all public methods are just the API users can call and they themselves create a way for mods to exist?

[1] https://wiki.fabricmc.net/tutorial:mixin_introduction [2] https://docs.minecraftforge.net/en/latest/concepts/lifecycle...

[+] NwpierratorR|4 months ago|reply
> I wonder from a modding perspective would it be better if all public methods are just the API users can call and they themselves create a way for mods to exist?

It's the way vintage story implemented modding. They developed the whole game as engine + modapi + hooking engine for stuff outside of hookapi.

Then most of gameplay is implemented as mods on top of engine using api and hooking. And those tools are open source, with central distribution point for mods, so servers can dispatch and send update of required mods to clients as they join.

Marvellous and elegant design. Makes running a server with client side mods a breeze, because mods are automatically pushed to the clients.

Though in the end, you can't really open all the interfaces and expect it to be stable without making some huge trade offs. When it works, it's extremely pleasing. Some mods for vintage story that are made purely using mod api can work between major game versions. Even server/client version check is intentionally loose as mismatched versions can still for the most part interact across most of mechanics.

In practice, to preserve balance of api evolution and stability, not everything in the game is in the api, and thus you have to use their hooking api, and stuff that is not exposed tends to break much more often, so mods require manual updates, just like in minecraft(though not as bad, tbh. In minecraft nowadays modders tend to support both fabric and neoforge/forge apis, targeting each for at least a few major versions. In vintage story, you only gotta support one modding api heh).

[+] mmis1000|4 months ago|reply
It won't do much though. Although it will make things a bit easier. A lot of minecraft mod requires direct modification to Minecraft's core mechanism. For example in popular mods: create, immersive portal and distant horizon all taps in minecraft's collision mechanism or rendering pipeline in a quite aggressive way that unlikely there will ever an abstraction be able to handle that.

And, no. Although forge does not encourage you to use it. It also supports mixin like direct modification. It's just less polished than mixin(requires more knowledge to java Bytecode)

It's unrealistic to ask mojang to make an abstraction that you can actually change everything in the core without direct modification (let alone how do mojang know what part need to be abstracted?)

[+] giancarlostoro|4 months ago|reply
I wonder if they'll ever just open source the Java Edition on GitHub. People will buy Minecraft on every platform it is released on, just like Skyrim.
[+] bob1029|4 months ago|reply
Obfuscating Minecraft code doesn't make much sense to me from an IP protection angle. It is one of the easier games to build from scratch once you see how it plays. Most of the magic is emergent behavior between many simple rule systems. Nothing in that source code would be much of a revelation. It's not like there's a nanite implementation hiding in there somewhere. It's mostly boring stuff like defining how pig or sheep walk through the scene and respond to various goals. The "scariest" part of Minecraft tech is probably chunk management.
[+] armchairhacker|4 months ago|reply
Minecraft, Roblox, Geometry Dash, Trackmania...these are games that succeeded because of their communities. Alone, they don't provide much for the average player, but creative players build interesting things that appeal to everyone.

I think one of the reasons Vision Pro and metaverse have been struggling is because their engines are bad. Not just locked down, but hard to develop on (although I don't have personal experience, I've heard this about VR in general). If you want to build a community, you must make development easy for hobbyists and small users*. I believe this has held even for the biggest companies, case in point the examples above.

* Though you also need existing reputation, hence small companies struggle to build communities even with good engines.

[+] hackthemack|4 months ago|reply
I much prefer just writing stuff for Luanti (formerly minetest).

You can, pretty much, get the Minecraft experience by downloading mods. Or just use the VoxeLibre game mod.

https://content.luanti.org/packages/Wuzzy/mineclone2/

The mods are written in lua and you can find the source code for most of them.

One I like is Zoonami which turns the experience into a Pokemon like game.

https://content.luanti.org/packages/isaiah658/zoonami/

[+] pwdisswordfishy|4 months ago|reply
> But we encourage people to get creative both in Minecraft and with Minecraft – so in 2019 we tried to make this tedious process a little easier by releasing “obfuscation mappings”. These mappings were essentially a long list that allowed people to match the obfuscated terms to un-obfuscated terms. This alleviated the issue a little, as modders didn’t need to puzzle out what everything did, or what it should be called anymore. But why stop there?

Indeed, why did they even bother with this half-measure in the first place?

[+] Macha|4 months ago|reply
A lot of mod tooling was built around the obfuscated or community names for those APIs.
[+] rirze|4 months ago|reply
If I had to guess, the legal team's brains started melting when de-obfuscation was mentioned.
[+] naruhodo|4 months ago|reply
If my memory serves, the stated justification for not going open source was copyright and trademark protection. Apparently, that is no longer a concern, if it ever really was.

Now I'm bracing for them to drop support for Java Edition entirely and go strictly Bedrock in a couple of years.

Perhaps Minecraft 2.0 is finally nearing release.

[+] ethmarks|4 months ago|reply
Perhaps it was easier? There were also probably legal reasons.
[+] matteotom|4 months ago|reply
Were the mappings only a subset of the obfuscated classes/methods/etc? Basically making the mapping a sort of public API
[+] RGBCube|4 months ago|reply
Even if they made it Source Available it wouldn't hurt them much, because Minecraft is very easy to pirate and the reason anyone pays for anything at all is because you need an account in Mojang's authentication servers (which people do not want to move off of for various reasons).

Hell, they could even make it Open Source with a clause preventing other companies from using to code to make a profit. It's too big to fail.

[+] TheDong|4 months ago|reply
> Hell, they could even make it Open Source with a clause preventing other companies from using to code to make a profit

Such a clause would immediately make it Source Available not Open Source.

[+] ojosilva|4 months ago|reply
I hope Claude Code follows the same path. It's just wrong to have such a key tool in your development toolchain obfuscated. Changes to CC reflect in the way I work. I've been modding the app for ever now. Something as simple as evalling prompt changes, or finding ways to optimize context. Just make it OSS, like Codex. To add insult to injury, Claude has coined some key industry standards, such as MCP, now Skills. It also supports plugins, inviting others to release their plugins as OSS on Github [1], while their core remains proprietary.

[1] https://www.anthropic.com/news/claude-code-plugins#:~:text=P...

[+] nxobject|4 months ago|reply
I got my start coding by modding Minecraft - I added a quest system; one day I wanted to add dialogue trees and slowly turn it into a RPG. I hope future generations will always have this wonderful opportunity, this low barrier to entry opportunity to do substantial personal-passion mods.
[+] kevincox|4 months ago|reply
I'm pretty excited this but for a slightly strange reason. I have a little monitor for the logs that posts things like player joins and deaths to a chat room. It is fun and also encourages people to hop on the server when someone joins.

However the source information was always missing and strange in the logs making matching some messages difficult. Hopefully this will make more messages more unique so that I can easily match the ones I am interested in.

[+] 64718283661|4 months ago|reply
The community obfuscation mappings unrestrictively licensed. The Microsoft ones are not. It's a trap.
[+] charcircuit|4 months ago|reply
I would rather see allowing creators to monetize their Java edition mods again, and to get rid of their restrictive rules on mods. The old version of the EULA actually gave people a lot of freedom, but then they changed the rules on everyone and locked it down. Obfuscation is not a true problem compared to those.
[+] immibis|4 months ago|reply
You're always welcome to just ignore the EULA and hope they don't sue you. Which they won't because the costs to them are much greater than the benefits. Even with the monetized server thing, they didn't sue them, but they did create a server address blacklist, but it only contains a minority of monetized servers.
[+] nullfield|4 months ago|reply
One and only account (Mojang) that I can think of that I lost because it got taken over, and I couldn’t get support to help fix it (something about “go make another Mojang account”?)… and since I don’t really get the migration process they did or final outcome, it’s more of a “oh well losing that sucks”.
[+] lurk2|4 months ago|reply
This situation was a lot more common than people might think. If you bought the game before Notch introduced the EULA (late 2011 if memory serves), what they did was also probably illegal, since they didn’t have the legal boilerplate in place that would allow them to brick the game the way that they did. There was a streamer trying to start a class action over it a few years ago, but I don’t think anything ever came of it.
[+] xxmarkuski|4 months ago|reply
Minecraft modding has done so much to get young people into CS. I started learning Java when I was 10 because I wanted to do modding. At university, I met so many people who had the same experience. The tooling developed for Minecraft modding is world-class and better than what is developed during PhDs. It's very advanced, and people internalized the JVM and Java spec. One problem, though, is that Mojang's updates often change much of the foundation, and upgrading mods is very time-intensive. Mojang announced in 2012 that an official modding API is in the works. This is another step.
[+] PaulKeeble|4 months ago|reply
As I understand it way back in the early Beta days of Minecraft obfuscation was added to avoid mods being embedded into the JAR and it being released as a combination enabling piracy of the game with mods embedded.

This has been a pain to workaround for years as the modding scene has gotten bigger. Hopefully this makes modding a bit more accessible.

[+] LauraMedia|4 months ago|reply
Yeah I still remember when you had to manually patch your minecraft.jar with mods. Always remove the META-INF directory so it works. Back then, when you installed two mods that were incompatible with each other, you had to throw away the whole minecraft.jar and start again.

This already changed A LOT when Forge and later Fabric came out, with a simple patch system akin to BepinEx and a mods folder.

[+] mmis1000|4 months ago|reply
The later generation mod loader use preloader and asm hooks though. So the file isn't even physically patched, just patched in memory. That is such an old day that you still need to patch the jar by yourself. (If I am not remembered it incorrectly, I think the community change happens between 1.3 and 1.5?)
[+] spullara|4 months ago|reply
You know what would make it even easier? Releasing the source code with a license that allows for modding.
[+] nisegami|4 months ago|reply
I consider Microsoft to be genuinely evil as an institution, but this is still nice to see.
[+] Traubenfuchs|4 months ago|reply
I'd like to see a benchmark between the obfuscated and non obfuscated version.
[+] internetter|4 months ago|reply
Probably virtually the same. If I recall, the "obfuscation" was mostly mangling
[+] PaulKeeble|4 months ago|reply
The files will be a little smaller obscured but it doesn't usually impact much other than RAM usage. The algorithms are all the same. Given the size of methods for being JIT compiled is token based not text size I don't think it even impacts that choice. So expect it to be identical.
[+] xxs|4 months ago|reply
same, except for meta space used - the class/variable names don't have pretty much any meaningful impact on java runtime, when the code is JIT'd. Even before (interpret mode) that the className/fields/methods are just references in the constant pool
[+] Chihuahua0633|4 months ago|reply
I have to assume this runs the risk of opening the floodgates for potential vulnerabilities to be discovered now. Hopefully they're prepared to start working on a bunch of new bug reports.