Development: Difference between revisions

From GT New Horizons
Content added Content deleted
(→‎Resources: Add some OpenGL links)
(→‎Resources: Move docs.gl to the appropriate section)
Line 342: Line 342:
|''Not Minecraft specific''
|''Not Minecraft specific''
|OpenGL tutorial for beginners, Computer Graphics
|OpenGL tutorial for beginners, Computer Graphics
|-
|[https://docs.gl/ docs.gl quick reference]
|''Not Minecraft specific''
|A nice viewer for OpenGL reference documentation, choose the OpenGL 2.1 version
|}
|}


Line 400: Line 396:
|[https://www.wikipedia.org/ Wikipedia]
|[https://www.wikipedia.org/ Wikipedia]
|More than you can think of (but not everything)
|More than you can think of (but not everything)
|-
|[https://docs.gl/ docs.gl quick reference]
|A nice viewer for OpenGL reference documentation, choose the OpenGL 2.1 version
|}
|}



Revision as of 11:02, 25 December 2022

Introduction

Everyone can contribute to GTNH in one way or another. One possible way is to expand/improve the source code of the mods. To get started, you first need a vision for what you want to do. If you have no idea you can look through [issues] and try to address some. If you do have a vision and are unsure whether its good or want to hear more opinions on it you can discuss it with others in a new issue or on discord.

Getting started

If you found a mod that you want to edit, create a fork of it first, by pressing the fork-button on its GitHub page. After that you can clone your fork to a local repository and import it into your IDE and get started on development. If you are unsure how to do things, try to look up how similar things are already done.

From Scratch

  1. Create a new GitHub repository and clone it
  2. Choose and download a Forge MDK and extract the contents of the ZIP-archive into the directory, where you cloned your repository to (If you are developing for Minecraft 1.7.10, you can use SinTh0r4s' [1]-template).
  3. Edit your project details (name, version, dependencies, etc.).
  4. Execute gradlew setupDecompWorkspace eclipse / gradlew setupDecompWorkspace idea in the root directory of your project
  5. In Eclipse / IntelliJ IDEA, import your workspace as a Gradle project.
  6. Done.

From an existing Repository

  1. Clone the repository
  2. Execute gradlew setupDecompWorkspace eclipse / gradlew setupDecompWorkspace idea in the root directory of your project
  3. In Eclipse / IntelliJ IDEA, import your workspace as an existing Gradle project.
  4. If the import fails, you may have to adjust the Gradle version and/or buildscript. If you are developing for Minecraft 1.7.10, read this guide.
  5. Execute ./gradlew genIntellijRuns if you are using IntelliJ to run the project inside your IDE.
  6. Done.

Common issues

  • If even after you executed the gradlew setupDecompWorkspace command your IDE tells you that stuff is missing, try to reload gradle.
  • You need Java 8 (64 bit) for development. If you have multiple Java versions installed you may need to set the JAVA_HOME environment variable to the location of your Java 8 installation.

Git Configuration

If you would like to avoid signing commits with your real name, see here: Managing Git Identities

Tools

All applications that are grouped together can do about the same. This does not mean that you can pick any one of them, as they differ in functionality, style, performance and customizability. It is recommended you look at what they can do and try each one out, so you can decide which application you want to use for which use case.

Code Editors
Integrated Development Environments
Image Editors
Modeling
Animation
Miscellaneous

Maven/Jenkins Selection

URL Mods
https://aidancbrady.com/mekanism/download/ Mekanism, MekanismGenerators, MekanismTools
https://api.modrinth.com/maven All Modrinth mods
https://chickenbones.net/maven/ CodeChickenCore, CodeChickenLib, EnderStorage, NotEnoughItems, Translocator, WR-CBE, ...
https://ci.rs485.network/
http://downloads.gtnewhorizons.com/Mods_for_Jenkins/ Various
https://dvs1.progwml6.com/files/maven IguanaTinkerTweaks, HungerOverhaul, Mantle, Natura, TinkersConstruct, TinkersMechworks, ...
https://files.projectredwiki.com/maven MrTJPCore, ForgeRelocation, ProjectRed
https://files.vexatos.com Are We Endgame Yet?, AsieLib, BeeSpecific, BuildcraftOilTweak, CheatyComputers, Computronics, Conventional, CustomManualTab, Don't Stub Your Toe, FactumOpus, ForecatsersBackpacks, TGregworks, ...
https://gregtech.overminddl1.com/ Various
https://immibis.com/ Advanced Machines, Advanced Repulsion Systems, AutoFood, Cloud Storage, Connected Glass, Dimensional Anchors, Immibis Core, Immibis's Macroblocks, Immibis's Microblocks, Immibis's Peripherals, InfiView, InfiniTubes, Liquid XP, RedLogic, Simple Recycling, TinyCarts, TubeStuff, ...
https://jenkins.bdew.net/maven AE2Stuff, BDLib, CoFHLib, Compacter, Computercraft, Generators, Gendustry, Mekanism, Pressure, ...
https://jenkins.dries007.net/ AutoCrafter2000, BetterFoliage, CrayCrafting, D3Backend, D3Log, GooglyEyes, GreenThumb, HoloInventory, InsiderTrading, MCLink, MineSafety, MorphAdditions, Pay2Spawn, Pay2SpawnBlocks, PlaceableTools, TapeMouse, TerraFirmaCraft, TerraFirmaStuff, TFCraft-NEIplugin, TFC-Tweaks, Thermal Expansion, TorchTools, WeepingAngels, ...
https://jenkins.ironhide.de/ CraftingUtilities, Open Modular Turrets, FloodLights, ...
http://jenkins.usrv.eu:8080/ Various
http://jenkins.usrv.eu:8081/nexus/content/repositories/public/ Various
https://jitpack.io/ Any GitHub project
https://maven.blamejared.com/ MineTweaker3, CraftTweaker, ...
https://maven.cil.li/ AppliedEnergistics 2, BetterStorage, BloodMagic, BluePower, BuildCraft, Charset, CodeChickenCore, CodeChickenLib, CoFHCore, CoFHLib, ColoredLightsCore, ComputerCraft, CraftGuide, EnderCore, EnderIO, EnderStorage, Forestry, Forge Multipart, GalacticraftCore, GregTech, Immibis Multipart, InGameWiki, Inventory Tweaks, Mantle, Mekanism, MineFactory Reloaded, MrTJPCore, NotEnoughItems, NotEnoughKeys, OpenComputers, PowerAdvantage, QmunityLib, ProjectRed, Railcraft, RedLogic, RedstoneFlux API, RotaryCraft, RotateableBlocks, ThaumicEnergistics, TinkersConstruct, TinkersMechworks, TIS-3D, Waila, WR-CBE, ...
https://maven.covers1624.net/

https://nexus.covers1624.net/repository/maven-hosted/

ChickenChunks, CodeChickenCore, CodeChickenLib, EnderStorage, ForgeMultipart, NotEnoughItems, Translocators, WR-CBE
https://maven.falsepattern.com/releases LightningOverhaul, AnimFix, CrashGuard, DyamicRendering, EndlessIDs, FalsePatternLib, JarLoader, LagGoggles, SSMLegacy, Triangulator, ...
https://maven.ic2.player.to/ IndustrialCraft, Forestry, ...
https://maven.k-4u.nl/ Boilerplate, InGameWiki, K4Lib, MoarCarts, PneumaticCraft, ServerInfoProvider, Steamcraft2, ...
https://maven.latmod.com/
https://maven.mcmoddev.com

Backup: https://maven.tophatcat.dev/

Baubles, LLibrary, Thaumcraft, VeinMiner, ...
https://maven.minecraftforge.net/ Biomes O' Plenty, HelpFixer, MalisisCore, MalisisDoors, Mixin, IronChest, ...
https://maven.modmuss50.me/
https://maven.mjrlegends.com/ ExtraPlanets, ...
https://ci.tterrag.com/

https://maven.tterrag.com

Chisel, CTMLib, CustomThings, DifficultyRecipes, EnderIO, EnderCore, EnderZoo, Ex-Astris, Ex-Nihilo, RecipeTweakingCore, SuperMassiveTech, ttCore, ...
http://mc.lunatri.us/files/ Config Patcher, DynIMC, Extension Fixer, InGame Info XML, InGame Mod Configs, Laser, Level, LunatriusCore, Monster Spawner Highlighter, Profiles, Schematica, SchematicaPlugin, Stackie, Tracer
https://minecraft.curseforge.com/api/maven/ Any CurseForge file
http://minetweaker3.powerofbytes.com/download/ MineTweaker3
https://mobiusstrip.eu/maven AdminCommandsToolbox, JABBA, MobiusCore, Netty-Opis, Opis, WAILA, ...
https://mvn.falsepattern.com/releases GasStation, LightingOverhaul, MixinExtras, AnimFix, CartLoad, CrashGuard, DynamicRendering, EndlessIDs, FalsePatternLib, FalseTweaks, JarLoader, LagGogglesLegacy, SSMLegacy, Triangulator, GalactiCraft-Core, GalactiCraft-Planets, MicdoodleCore, Biome Wand, Space Core, CoroUtil, EnhancedBiomes, Tropicraft, ...
https://purpleposeidon.github.io/fz_archive/ Factorization
https://repo.spongepowered.org/maven/ Mixin, ...
https://www.cursemaven.com Any CurseForge file
https://www.mod-buildcraft.com/releases/BuildCraft/ Buildcraft, BuildCraft Compat
https://www.ryanliptak.com/maven/ AppleCore

Code Style

A full version of the GTNH Code Style is located here.

TL;DR:

  • Document your code, especially Javadoc-ing your methods and classes.
  • Keep your variables private final unless they absolutely need to be different.
  • Don't change the existing public variables because it can break the code that uses them.
  • Use thread-safe collections where possible to account for future multithreading.
  • Don't make one method do too much. Add helper methods.
  • Use the @Override annotation when overriding methods.
  • Avoid tight coupling. Aim for your code to be loosely coupled.
  • Use semantic versioning.
  • Use the .editorconfig file provided with the project or use this .editorconfig if none was provided. You can check out the original site to discover more about it (link).

Contribution Procedure

  1. Find something to contribute
  2. Fork the related projects (can skip this if you are a member of our github org)
  3. For certain old repos, buildscripts may need updating. See this guide.
  4. Push code into your fork (or on a separate branch in main repo)
  5. Open a pull request and provide a description on what it changes/adds/removes. Include pictures/graphs if necessary. If there is a related issue, link it. Ask for review from
    • DreamMasterXXL, if it's about quest and/or recipe change.
    • GTNewHorizons/developers team, if it's some java/scala/kotlin code change.
    • mitchej123, if it's NEI.
    • Original mod developer, if you are contributing to his mod and he/she is still around (e.g. glease for TC4Tweaks, SinTh0r4s for VisualProspecting, GlodBlock for GoodGenerators).
  6. Address review problems. Resolve merge conflicts (if any). Wait for final merge. DO NOT merge the PR yourself, even if approved! This is a task of GTNewHorizons/admin members.

Please do not have multiple changes/features in a single PR, make a separate PR for each. If they depend on each other, you can leave a note in the PR's description.

If you are not sure how to fork and open pull requests, read this gist by Chaser324.

Resources

Not every wiki/tutorial/article/... listed here contains information about Minecraft version 1.7.10 but some topics haven't changed much and often the general methodology is the same. The newer the version, the less comparable the inner workings of Minecraft/Forge are to 1.7.10.

You can look at the source-code of most mods included in GTNH here.

If you look for something specific, use the search-function of your browser!

You can find an extensive list of modding resources, made by the MMD-Team, here.

Tutorials / Blogs

Name Version(s) Topics (including, but often not limited to)
MMD Modding-Resources Various Blocks, Commands, Entities, Fluids, Items, Rendering, ...
Jabelar's Minecraft Forge Modding Tutorials Various Getting Started, Concepts, Registries, Entities, Blocks, Items, Armor, Weapons, Tools, Fluids, Tanks, Recipes, Ore Dictionary, Loot, Tile Entities, Networking, Events, Models, Animations, Rendering, Assets, Enchantments, GUIs, Keybindings & Mouse, Achievements / Advancements, Configs, World Generation, Creative Tabs, Particles, Sounds, Commands, IMC / Compat, ...
#knowledgebase (Minecraft Pack Development Discord) All Various bits of information on Mod(pack) Development
#resources (Blockbench Discord) All Modeling, Textures, Animation
Mixin-Cheatsheet All Cheatsheet for mixins
Mapping and Modding Tutorials on Minecraft Forum All? Various Topics
Old Forge Wiki Tutorials 1.3 - 1.7 Gettings Started, Concepts, Blocks, Items, Recipes, Events, Ore Generation, Tile Entities, Commands, Rendering, Configs, Models, Biome Dictionary, Ore Dictionary, Achievements, Sounds, GUIs, Networking, NBT, Containers, Entities, Multiblocks, Fluids, Scala, ...
Wuppy's Tutorials 1.3 - 1.8 Gettings Started, Recipes, Loot, Assets, Blocks, Items, Tools, Rendering, World Generation, Crops, Entities, Dimensions, ...
Vswe's Summer Courses 1.6.2 Java Basics, Getting Started, Items, Blocks, Tile Entities, Entities, World Gen, Sounds, Particles, Models, Textures, Animations
The Grey Ghost's Minecraft By Example [Blog|GitHub] 1.6 - 1.16 Concepts, Blocks, Items, Rendering, User Input, Packets, Entities, GUIs, Containers, Tools, Redstone, ...
EMX Tutorials 1.7 Getting Started, Items, Blocks, Recipes, Keybindings, Textures, Drops, GUIs, NBT, Models, Containers, ...
coolAlias' Forge Tutorials 1.7 Armor, Villager Trades, Inventories, Events, Rendering, ...
Vike's ASM Tutorial [Part 1|Part 2] 1.7 ASM
Bedrock Miner's Tutorials 1.7, 1.8 Getting started, Concepts, Blocks, Items, Tools, Armor, Food, Recipes, ...
TheXFactor117's Forge Modding Tutorials 1.7, 1.8 Getting Started, Items, Blocks, Armor, Tools, Ore Generation, NBT, Tile Entities, Assets, Creative Tabs, Recipes, Entities, ...
Darkhax' Tutorials 1.8 - 1.12 Custom Entity Data, Loot Tables, Events, Structure Generation, Update Checker, IMC, Jar Signing, Access Transformers, Rendering, CraftTweaker Support, Mixin
McJty's Tutorials 1.9+ Getting Started, Concepts, Configs, Blocks, Items, Tile Entities, Recipes, GUIs, Inventories, Entities, Rendering, Networking, Commands, Dimensions, WAILA Integration, ...
ShadowFacts' Tutorials 1.10 - 1.12 Getting Started, Concepts, Items, Models, Blocks, Blockstates, Assets, Crops, Creative Tabs, Recipes, Ore Dictionary, Food, Tools, Armor, World Generation, Tile Entities, Inventories, GUIs, Rendering, ...
suppergerrie2's Tutorials 1.12 - 1.15 Getting Started, Items, Blocks, Recipes, Ore Generation, Food, Creative Tabs, Tools, Slabs, Enchantments, Crops, Block States, Events, ...
Forge Community Wiki LTS, Latest Getting Started, Concepts, Blocks, Items, Tile Entities, Events, Resources, Data, Models, Networking, Potions, Particles, Sound, Events, Loot, Key Bindings, Access Transformers, ...
Java Docs Tutorials Not Minecraft specific Java
Red Blob Games Not Minecraft specific Path Finding, Graph Theory, Map Generation, Procedural Generation
0 FPS Not Minecraft specific Collision Detection, Geometry, Mathematics, Voxels, Shape Modeling, Ambient Occlusion, ...
Lazy Foo OpenGL tutorials Not Minecraft specific OpenGL tutorial for beginners, Computer Graphics

Wikis / Docs

Name Topics
CraftTweaker Docs CraftTweaker
Gradle User Manual Gradle
Minecraft Forge Event List Vanilla and Forge Events (MC 1.12+)
Fabric Wiki - Introduction to Mixins Mixins
FTB Wiki [Official|Unofficial] Information on many Mods
Git Docs Git
Data Driven Shaders by Ladysnake MC 1.7+ Post Process Shaders
Mixin Extras Wiki Mixin Extras
Mixin Wiki Mixins
Official Forge Docs [Latest|Legacy] Forge
OpenGL Wiki OpenGL
MineTweaker 3 Wiki MineTweaker 3
ForgeJavaDocs Javadocs for MC, Forge and FML
VisualVM Docs VisualVM
wiki.vg Protocols, Authentification, NBT, etc.
Wikipedia More than you can think of (but not everything)
docs.gl quick reference A nice viewer for OpenGL reference documentation, choose the OpenGL 2.1 version

Help

Using DCEVM

For better hot-reload support in intellij you can use DCEVM. Instructions for linux:

  • Unpack Trava JDK 8 DCEVM on your machine.
  • Go into the unpacked JVM. In jre/lib/amd64/server, make a copy of libjvm.so called libjvm.so.backup. After that, copy the entire server folder and name it client. This tricks the IntelliJ plugin into thinking that the DCEVM install is valid as installed by the old 2018 installer.
  • Install HotSwapAgent plugin in IntelliJ.
  • Add the DCEVM JDK as an SDK in IntelliJ, it should autodetect most stuff but I had to manually copy over the javadoc path from my other java8 JDK.
  • Set DCEVM JDK as default for the project and Gradle.
  • Set the non-DCE JDK in Build, Exec & Deployment -> Compiler -> Scala Compiler -> Scala Compile Server.
  • In Build tools -> Gradle, set both build-and-run and run tests to using IntelliJ IDEA instead of Gradle.
  • In Tools -> HotSwapAgent, enable it for all configurations, and set the agent path to dcevm8u282b08/lib/hotswap/hotswap-agent.jar in your DCEVM installation.
  • Make sure to use the Minecraft Client/Server IntelliJ configurations with the square frame icons instead of the runClient/etc. configurations with Gradle icons.
  • Debugging that config should show up loading the hot swap agent at the beginning of the logs.
  • If you have custom JVM args in the configs, make sure to remove all garbage-collection options as DCEVM works only with the default garbage collector.

Mixins

Useful Options

  • -Dmixin.debug=true # Enable Mixin Debug
  • -Dmixin.debug.verbose=true # Verbose Debug Messages
  • -Dmixin.debug.export=true # Export classes after mixins have been applied. If you include fernflower in your classpath, or copy org.jetbrains.fernflower into your mixin jar the exported classes will be decompiled
  • -Dmixin.debug.countInjections=true # Throw an error if the injection count doesn't match expectations
  • -Dlegacy.debugClassLoading=true # Class Load Debugging
  • -Dlegacy.debugClassLoadingSave=true # Dump classes to `.minecraft/CLASSLOADER_TEMP`