User Tools

Site Tools


tutorial:primer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:primer [2022/10/19 22:43] – addd introduction miirtutorial:primer [2023/03/03 18:08] (current) – [What is Fabric?] miir
Line 1: Line 1:
-====== Minecraft Modding Primer (DRAFT) ======+====== Minecraft Modding Primer ======
  
 //Note: This primer assumes no prior experience modding Minecraft. However, you will need to have a firm grasp on programming in Java to work with Minecraft (see the Prerequisites section). If you are coming to Fabric from another modloader, like Forge, the [[introduction]] will probably be more at your level.// //Note: This primer assumes no prior experience modding Minecraft. However, you will need to have a firm grasp on programming in Java to work with Minecraft (see the Prerequisites section). If you are coming to Fabric from another modloader, like Forge, the [[introduction]] will probably be more at your level.//
Line 8: Line 8:
 ===== Prerequisites for Minecraft Modding ===== ===== Prerequisites for Minecraft Modding =====
  
--You must understand the basics of coding. If you have never touched code before, you must learn how to code first. "The basics" here means having a firm grasp on variables, functions, classes and methods, and object-oriented programming concepts like inheritance, polymorphism, and object casting. Your search engine is your friend! +  * You must understand the basics of coding. If you have never touched code before, you must learn how to code first. "The basics" here means having a firm grasp on variables, functions, classes and methods, and object-oriented programming concepts like inheritance, polymorphism, and object casting. Your search engine is your friend! 
- +  You should have some experience in a programming language like Java or C/C++/C#. Java's syntax is relatively simple to pick up for someone coming from the C family. 
--You should have some experience in a programming language like Java or C/C++/C#. Java's syntax is relatively simple to pick up for someone coming from the C family. +  Familiarity with Java's syntax for lambda methods, generics (you should know what these are), and syntactic sugar like the ternary operator will be very helpful-- but this is something that a quick learner can pick up along the way. 
- +  You must know how to use the Internet to find answers to questions, and etiquette for asking for help on forums.
--Familiarity with Java's syntax for lambda methods, generics (you should know what these are), and syntactic sugar like the ternary operator will be very helpful-- but this is something that a quick learner can pick up along the way. +
- +
--You must know how to use the Internet to find answers to questions, and etiquette for asking for help on forums.+
  
 ===== What is Modding? ===== ===== What is Modding? =====
Line 30: Line 27:
   * the **Fabric Installer**-- a tool that installs the Fabric Loader on an end user's Minecraft installation.   * the **Fabric Installer**-- a tool that installs the Fabric Loader on an end user's Minecraft installation.
  
-To more easily understand what is going on in Minecraft's code, when you mod with Fabric, you will also have access to Minecraft's source code. Since Java is a compiled language, we need to decompile the code before it can be read. This turns it from Java bytecode into human-readable Java source code. However, to stop piracy, Mojang distributes Minecraft in **obfuscated** format. This means that all the classes, methods, and fields in the code have randomized names. You can see this for yourself by opening a Minecraft .jar file in a zip extractor tool-- all the files have names like ''abc.class''. And what's worse, there's no guarantee that an object will have the same name between two versions-- it could be called ''abc'' in one version, and ''abd'' in the next. This would make modding really, really hard, because without names, it's hard to tell what different variables do. To fix this, Fabric uses a set of **mapping** tools to give everything a human-readable name.((Note: While Mojang does publish official mappings for all Minecraft versions, the legality of using these mappings in mods could change in the future. Yarn mappings are libre for everyone to use and sufficient for most modding purposes, so you are discouraged from utilizing the official mappings.))+To more easily understand what is going on in Minecraft's code, when you mod with Fabric, you will also have access to Minecraft's source code. Since Java is a compiled language, we need to decompile the code before it can be read. This turns it from Java bytecode into human-readable Java source code. However, to stop reverse engineering, Mojang distributes Minecraft in **obfuscated** format. This means that all the classes, methods, and fields in the code have randomized names. You can see this for yourself by opening a Minecraft .jar file in a zip extractor tool-- all the files have names like ''abc.class''. And what's worse, there's no guarantee that an object will have the same name between two versions-- it could be called ''abc'' in one version, and ''abd'' in the next. This would make modding really, really hard, because without names, it's hard to tell what different variables do. To fix this, Fabric uses a set of **mapping** tools to give everything a human-readable name.((Note: While Mojang does publish official mappings for all Minecraft versions, the legality of using these mappings in mods could change in the future. Yarn mappings are libre for everyone to use and sufficient for most modding purposes, so you are discouraged from utilizing the official mappings.))
  
   * the **intermediary** mapper is a program that gives every single object in Minecraft's code a name like "field_10832", or "method_12991()". Critically, this program always names each object the same thing. So a method that does not change between versions will always have the same intermediary name.    * the **intermediary** mapper is a program that gives every single object in Minecraft's code a name like "field_10832", or "method_12991()". Critically, this program always names each object the same thing. So a method that does not change between versions will always have the same intermediary name. 
tutorial/primer.1666219411.txt.gz · Last modified: 2022/10/19 22:43 by miir