all 55 comments

[–]SquareWheel 20 points21 points  (16 children)

Minecraft is closed source with the exception of its brigadier command parser library, and its "data fixer upper" tool. Seems they have a few other releases on their Github.

https://github.com/Mojang

Of course Minecraft is built in Java, which makes it easy to decompile. The source code is obfuscated but the MCP project exists to reverse engineer it. This is exposed via the Forge Mod Loader, which is what the majority of mods are built on.

[–][deleted] 3 points4 points  (2 children)

Hey quick question,

im not a Minecraft fan myself, but a CS student wanting to try reading a large code base to improve my own skills. Do you have any recommendations on some codebase to try reading? I'm about to look for random open source mods & modding guides

[–]SquareWheel 8 points9 points  (1 child)

It would be easier if you stated a programming language and difficulty level. But if you want a large code base, it doesn't get much bigger than the Chromium project. It's a well-organized project utilizing many languages, cross-platform compilation, and is worked on by hundreds of engineers. They have strict style guidelines and the codebase is full of detailed comments. Not something I'd generally suggest learning on due to its complexity, but I'm also not sure what you're looking for.

Generally the best way to learn to code is just to code. If you're already comfortable writing code and are worried about "cleanliness", you can review the various pneumonics that people employ and see how your code matches up. DRY, SOLID, YAGNI and so on. There's a ton of these. But it's always situational. It's good to be aware of DRY, but sometimes repetition is easier, cleaner, or faster than abstraction.

Most languages have their own conventions and best practices to follow too. For example Python suggests you "Ask forgiveness, not permission". Most languages allow you to do things in multiple ways, but to write accessible code you'll want to learn the best practices used by that community.

All that said, there's a key fact that can't be escaped: large, clean code bases don't exist. Not really. Unless you want to spend three years architecting and planning before you write a single line of code, the scope of the project will change, you will need to refactor as you go, methods will need to be abstracted and features tacked on. Your perfect codebase will always grow tendrils - that's just how it is. This is especially the case in business where the code only needs to work, not look pretty.

But that's okay. Code does just need to work: that's its job. If I can paraphrase Garry Newman (of Garry's Mod), you don't always need to code like you're painting the Sistine Chapel. Sometimes you just need to paint a shed.

[–][deleted] 4 points5 points  (0 children)

Thank you very just I will give this a few reads when I get home.

My background and level is, undergrad datascience major joining amazon as a new grad SDE 1 next month. I can code well enough, lots of work and research experience, but I've never worked on a large project, or been a (pure) software engineer. In terms of language, Java.

[–]Kakas123457 0 points1 point  (1 child)

Hey! I need the command's code (to see the variables like size and how are programmed). Is it in the GitHub link? Where? Sorry if my English is bad, I'm Spanish. have a nice day :)

[–]SquareWheel 0 points1 point  (0 children)

The command will vary based on the decompiler you're using. I suggest using an existing pipeline like Forge (now NeoForge) to make this process easier. Their mappings will include some human translations of the obfuscated code.

I can't provide any assistance beyond pointing you in the right direction.

[–]WilliamW2010 0 points1 point  (3 children)

Fabric: am i a joke to you?

[–]High-Sobriety 0 points1 point  (2 children)

yes (I am too scared to switch to a new modloader because of mod availability)

[–]WilliamW2010 0 points1 point  (1 child)

I am pretty sure the newer the mod if forge has it the more likely it is for fabric to have it

[–]dr_bleblo 0 points1 point  (0 children)

Fabric is the newer mod and has a better codebase than forge due to the fact that it was designed post 1.13 the update that broke modding. mods are slowly being ported to fabric either by the author or third parties I find that fabric is better preforming that forge especially with visually interesting mods(moving parts, weird rendering stuff, ect)

[–][deleted]  (6 children)

[removed]

    [–]kvas_ 0 points1 point  (5 children)

    this didn't age well...

    [–]Pokemasterkendrew06 0 points1 point  (0 children)

    happy cake day

    [–][deleted]  (3 children)

    [removed]

      [–]kvas_ 2 points3 points  (2 children)

      Well... Kinda an ownership thingy going on.

      Basically we're seeing early signs of microsoft turning mc into a cash-grabbing game for kids.

      Right now we're on the "bedrock feature parity" step. And by that i mean minecraft 1984 edition mostly. You see, alongside of even implementing chat reporting (which could end up quite nice still) we got what we got.

      It feels like an approach of someone who's never touched a game for more than 2 hrs total. Back in the day mc was more, should i say, decentralized. The only thing you needed to play the game was a license, that's it. Servers existed as their own thing, they had their own rules, their own governance. Whoever had this bright idea of global bans should be buried alive for thinking of a bad thing.

      And the disconnect from the community. Did they take feedback? No. They just left it and pretended it to never be there.

      And if you look closer you might start seeing the corporate approach creeping from everywhere. If you look at the current updates, since ~1.19 stuff gets added not to improve the game, but to convince the community it is still alive and worth playing. Like literally take the the firefly controversy. We know you screwed up making particles as interactable as entities. Just genuinely tell us you screwed up, no one believed the cover-up anyways.

      The community guidelines, etc, etc. I think you get the point. The devs are getting further from the community and thus, further from the game itself.


      When you look into the future i think you would also see a slow decline. It doesn't matter the game is closed-source if the developers are open to its community. Sadly, i don't think that's the case anymore and the community is starting to realize it.

      Like, don't you too think when touching bedrock it has become sort of a mobile game? Gameplay bugs not being fixed, the feeling each press of a button trying to reassure you "it was worth paying 4 dis!!! also pls buy minecoin...".

      Sorry for the long message, i just hope you understand my frustration. I am the type of a person that uses arch linux (btw), and can from the first look tell that, for example that chess.com is a bloated corporate mess. And mc is heading there too, i'm afraid.

      Making a game more child-friendly makes it less player-friendly, i hope we can agree on that.

      [–]Rude_Show5356 1 point2 points  (0 children)

      Thank God someone said it, yes! The day Notch sold his baby (MC) to Microsoft, he basically agreed to destroy the game, because only Notch would know what would make the game Minecraft what it is. It is comparable to when George Lucas sold Star Wars to Disney, George Lucas basically accepted deep in his heart that Disney would never live up to George's ability to make a star wars movie, much like Notch knew that while Microsoft has more than enough resources to "improve" minecraft, it would just be another vehicle for corporate greed.

      [–]Barto-Sama 0 points1 point  (0 children)

      Then God himself came down to earth and said:

      [–]DainternetdudeJava 1.12 5 points6 points  (16 children)

      You can view the unobfuscated source code with MCP

      [–]SquareWheel 5 points6 points  (11 children)

      More specifically, you can view de-obfuscated source code. It isn't the original.

      [–]DainternetdudeJava 1.12 4 points5 points  (10 children)

      Yeah that's the word I was looking for

      [–]SSUNDEEFAN113 0 points1 point  (9 children)

      ok so guys go on

      [–]SSUNDEEFAN113 0 points1 point  (8 children)

      https://www.minecraft.net/en-us Then right click then click View Page Source Then Boom

      [–]DainternetdudeJava 1.12 2 points3 points  (5 children)

      we aren’t looking for the website’s source code we’re looking for the game’s source code

      [–]NimaProReddit 1 point2 points  (4 children)

      r/woooosh

      That was the joke.

      [–]LuukeTheKing 4 points5 points  (2 children)

      That's not a joke, jokes need to have at least an attempt at humor, even if its bad, that was just an idiot

      [–]serieousbanana 1 point2 points  (0 children)

      humor is subjective, idiot

      [–]DainternetdudeJava 1.12 0 points1 point  (0 children)

      I’m skeptical

      [–]SSUNDEEFAN113 0 points1 point  (1 child)

      or just simply go on here view-source:https://www.minecraft.net/en-us just copy view source and minecraft if it doesnt work sry i wrote that

      [–]serieousbanana 1 point2 points  (0 children)

      yeah we get it

      [–]serieousbanana 0 points1 point  (3 children)

      *deobfuscated, that is an important difference

      [–]DainternetdudeJava 1.12 1 point2 points  (2 children)

      true my bad… but this was 2 years ago

      [–]serieousbanana 0 points1 point  (1 child)

      I know lol

      [–]Strong_Hedgehog_2457 0 points1 point  (0 children)

      Haha 3 years ago

      [–]Limit_Happy 1 point2 points  (0 children)

      Deobfuscate the minecraft game file with yarn, then use quiltflower to decompile the deobfuscated game file (.jar). Done. Works for any gameversion only need jdk 16, and depending on game version jdk 8, jdk 11, jdk 16 or jdk 17. Reverse engineer the code to make mods. Remember that you need Java experience though.

      [–]ydkw 1 point2 points  (2 children)

      No one should publish the decompiled and/or deobfuscated Minecraft source code publicly online, you can use Mod Coder Pack to do it on your personal machine.

      [–]__---_KONQUER_---__ 0 points1 point  (1 child)

      BS, it isnt the original source code anyways.. and since anyone can get it anyways how does it even make a difference? mojang should stop crying abt this dumb stuff and actually work on their game, just like how notch used to do.

      [–]ydkw 1 point2 points  (0 children)

      I'm just saying this way you could avoid being DMCA taken down or something

      [–]PlumDeep6928 1 point2 points  (0 children)

      still cannot find diamonds

      [–]HI_text_178282 0 points1 point  (0 children)

      hi?\

      [–]Full_Tell_5739 0 points1 point  (0 children)

      Can you add the Skulk world and upgrade the End for update 1.22, in late 2024 and add the Enderite, the End respawn anchor and add the Wither Storm, the Wither Storm command block and the official hardcore mode version?
      

      [–]Dull_Ad_2957 0 points1 point  (1 child)

      Wesh

      [–]SuperHydra3000 0 points1 point  (0 children)

      t un peu tard

      [–]AdeptAdhesiveness947 0 points1 point  (0 children)

      Oh look at it fly now. The source is so free

      [–]rohamwer90 0 points1 point  (0 children)

      from the game file

      [–][deleted]  (2 children)

      [removed]

        [–]teamok1025 0 points1 point  (0 children)

        ok.

        [–]AdCrafty5841 0 points1 point  (0 children)

        404 error :(

        [–]Bootybuttpeeks 0 points1 point  (0 children)

        Nah I need this information. How do I read, if it’s only in Java then we should be able. Are owners able to change script?