From 7cf632a721a0aef2f83f84a14ed263742dbfa668 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 2 Aug 2015 00:03:47 -0400 Subject: [PATCH 01/90] Vestigal fml-ectomy. --- README.txt | 59 ++++++++++++++ build.gradle | 74 ++++++++++++++++++ .../.projects/Minecraft/.location | 0 .../org.eclipse.core.resources/.root/0.tree | Bin 0 -> 1224 bytes .../org.eclipse.core.resources.prefs | 4 + .../.settings/org.eclipse.debug.ui.prefs | 7 ++ .../org.eclipse.epp.usagedata.gathering.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 14 ++++ .../.settings/org.eclipse.ui.editors.prefs | 4 + .../.settings/org.eclipse.ui.ide.prefs | 9 +++ .../.settings/org.eclipse.ui.prefs | 3 + .../.launches/Client.launch | 13 +++ .../.launches/Server.launch | 13 +++ .../launchConfigurationHistory.xml | 25 ++++++ .../com/example/examplemod/ExampleMod.java | 20 +++++ src/main/resources/mcmod.info | 16 ++++ 16 files changed, 264 insertions(+) create mode 100644 README.txt create mode 100644 build.gradle create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch create mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch create mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml create mode 100644 src/main/java/com/example/examplemod/ExampleMod.java create mode 100644 src/main/resources/mcmod.info diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..b45931f --- /dev/null +++ b/README.txt @@ -0,0 +1,59 @@ +------------------------------------------- +Source installation information for modders +------------------------------------------- +This code follows the Minecraft Forge installation methodology. It will apply +some small patches to the vanilla MCP source code, giving you and it access +to some of the data and functions you need to build a successful mod. + +Note also that the patches are built against "unrenamed" MCP source code (aka +srgnames) - this means that you will not be able to read them directly against +normal code. + +Source pack installation information: + +Standalone source installation +============================== + +Step 1: Open your command-line and browse to the folder where you extracted the zip file. + +Step 2: Once you have a command window up in the folder that the downloaded material was placed, type: + +Windows: "gradlew setupDecompWorkspace" +Linux/Mac OS: "./gradlew setupDecompWorkspace" + +Step 3: After all that finished, you're left with a choice. +For eclipse, run "gradlew eclipse" (./gradlew eclipse if you are on Mac/Linux) + +If you preffer to use IntelliJ, steps are a little different. +1. Open IDEA, and import project. +2. Select your build.gradle file and have it import. +3. Once it's finished you must close IntelliJ and run the following command: + +"gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux) + +Step 4: The final step is to open Eclipse and switch your workspace to /eclipse/ (if you use IDEA, it should automatically start on your project) + +If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not effect your code} and then start the processs again. + +Should it still not work, +Refer to #ForgeGradle on EsperNet for more information about the gradle environment. + +Tip: +If you do not care about seeing Minecraft's source code you can replace "setupDecompWorkspace" with one of the following: +"setupDevWorkspace": Will patch, deobfusicated, and gather required assets to run minecraft, but will not generated human readable source code. +"setupCIWorkspace": Same as Dev but will not download any assets. This is useful in build servers as it is the fastest because it does the least work. + +Tip: +When using Decomp workspace, the Minecraft source code is NOT added to your workspace in a editable way. Minecraft is treated like a normal Library. Sources are there for documentation and research purposes and usually can be accessed under the 'referenced libraries' section of your IDE. + +Forge source installation +========================= +MinecraftForge ships with this code and installs it as part of the forge +installation process, no further action is required on your part. + +LexManos' Install Video +======================= +https://www.youtube.com/watch?v=8VEdtQLuLO0&feature=youtu.be + +For more details update more often refer to the Forge Forums: +http://www.minecraftforge.net/forum/index.php/topic,14048.0.html diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..1b50aeb --- /dev/null +++ b/build.gradle @@ -0,0 +1,74 @@ +buildscript { + repositories { + mavenCentral() + maven { + name = "forge" + url = "http://files.minecraftforge.net/maven" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT' + } +} + +apply plugin: '${name}' + +version = "1.0" +group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = "modid" + +minecraft { + version = "${version}" + runDir = "eclipse" + + // the mappings can be changed at any time, and must be in the following format. + // snapshot_YYYYMMDD snapshot are built nightly. + // stable_# stables are built at the discretion of the MCP team. + // Use non-default mappings at your own risk. they may not allways work. + // simply re-run your setup task after changing the mappings to update your workspace. + mappings = "${mappings}" +} + +dependencies { + // you may put jars on which you depend on in ./libs + // or you may define them like so.. + //compile "some.group:artifact:version:classifier" + //compile "some.group:artifact:version" + + // real examples + //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env + //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env + + // the 'provided' configuration is for optioanl dependencies + //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' + + // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, + // except that these dependencies get remapped to your current MCP mappings + //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' + //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' + + // for more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html + +} + +processResources +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location new file mode 100644 index 0000000..e69de29 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree new file mode 100644 index 0000000000000000000000000000000000000000..897e2b847917fda481db0de6b8020ac05499a1dd GIT binary patch literal 1224 zcmaKr&u`N(6vtnhj~pn0guM2T(OR\r\n\r\n +org.eclipse.debug.ui.user_view_bindings=\r\n\r\n\r\n\r\n\r\n\r\n +StringVariablePreferencePage=130,107,107,86, diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs new file mode 100644 index 0000000..333b991 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs @@ -0,0 +1,3 @@ +#Sun Jun 05 18:58:07 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.epp.usagedata.gathering.enabled=false diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..12ec368 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +#Sun Sep 18 16:44:39 NZST 2011 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=ignore +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=ignore +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs new file mode 100644 index 0000000..316ef6f --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs @@ -0,0 +1,4 @@ +#Sun Jun 05 18:58:05 CEST 2011 +spacesForTabs=true +eclipse.preferences.version=1 +overviewRuler_migration=migrated_3.1 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs new file mode 100644 index 0000000..ae368ab --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs @@ -0,0 +1,9 @@ +#Sun Jun 05 18:58:07 CEST 2011 +IMPORT_FILES_AND_FOLDERS_MODE=prompt +IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE=prompt +SAVE_ALL_BEFORE_BUILD=true +eclipse.preferences.version=1 +tipsAndTricks=true +platformState=1287081747687 +quickStart=false +PROBLEMS_FILTERS_MIGRATE=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs new file mode 100644 index 0000000..cbc5953 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs @@ -0,0 +1,3 @@ +#Sun Jun 05 18:50:08 CEST 2011 +eclipse.preferences.version=1 +showIntro=false diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch new file mode 100644 index 0000000..a639572 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch new file mode 100644 index 0000000..395f317 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml new file mode 100644 index 0000000..1208f60 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java new file mode 100644 index 0000000..82123bc --- /dev/null +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -0,0 +1,20 @@ +package com.example.examplemod; + +import net.minecraft.init.Blocks; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; + +@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION) +public class ExampleMod +{ + public static final String MODID = "examplemod"; + public static final String VERSION = "1.0"; + + @EventHandler + public void init(FMLInitializationEvent event) + { + // some example code + System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName()); + } +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000..f480667 --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,16 @@ +[ +{ + "modid": "examplemod", + "name": "Example Mod", + "description": "Example placeholder mod.", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "", + "updateUrl": "", + "authorList": ["ExampleDude"], + "credits": "The Forge and FML guys, for making this example", + "logoFile": "", + "screenshots": [], + "dependencies": [] +} +] From d4ed44b8e4ebcc6348f68d755f06c076112088d2 Mon Sep 17 00:00:00 2001 From: AbrarSyed Date: Sun, 9 Aug 2015 20:30:31 -0500 Subject: [PATCH 02/90] added MDK package --- build.gradle | 17 ++++++++++++----- gitignore.txt | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 gitignore.txt diff --git a/build.gradle b/build.gradle index 1b50aeb..e29d90f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,8 @@ +/* +// For those who want the bleeding edge buildscript { repositories { - mavenCentral() + jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" @@ -10,15 +12,20 @@ buildscript { classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT' } } +apply plugin: 'net.minecraftforge.gradle.forge' +*/ -apply plugin: '${name}' +// for people who want stable +plugins { + id "net.minecraftforge.gradle.forge" version "2.0.0" +} version = "1.0" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" minecraft { - version = "${version}" + version = "@VERSION@" runDir = "eclipse" // the mappings can be changed at any time, and must be in the following format. @@ -26,7 +33,7 @@ minecraft { // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not allways work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "${mappings}" + mappings = "@MAPPINGS@" } dependencies { @@ -39,7 +46,7 @@ dependencies { //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - // the 'provided' configuration is for optioanl dependencies + // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, diff --git a/gitignore.txt b/gitignore.txt new file mode 100644 index 0000000..43654d1 --- /dev/null +++ b/gitignore.txt @@ -0,0 +1,21 @@ +# eclipse +bin +*.launch +.settings +.metadata +.classpath +.project + +# idea +out +*.ipr +*.iws +*.iml +.idea + +# gradle +build +.gradle + +# other +eclipse From 97919f5a95ea1844ef7266c786fd65ad7fab8bed Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 26 Aug 2015 16:19:31 -0400 Subject: [PATCH 03/90] More cleanup of the default eclipse workspace. The project is now called "MDKExample" not "Minecraft". The project tree is now contemporary, instead of a copy from 1.5.x era MC. The launches are cleaned up, and refer to a better default "runDir" of "run" rather than "eclipse".. Updating to FG2.0.1 which will contain relevant binary fixes. --- build.gradle | 5 +++-- .../{Minecraft => MDKExample}/.location | 0 .../org.eclipse.core.resources/.root/0.tree | Bin 1224 -> 468 bytes .../.launches/Client.launch | 8 ++++---- .../.launches/Server.launch | 8 ++++---- gitignore.txt | 1 + 6 files changed, 12 insertions(+), 10 deletions(-) rename eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/{Minecraft => MDKExample}/.location (100%) diff --git a/build.gradle b/build.gradle index e29d90f..6e5a6ea 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ apply plugin: 'net.minecraftforge.gradle.forge' // for people who want stable plugins { - id "net.minecraftforge.gradle.forge" version "2.0.0" + id "net.minecraftforge.gradle.forge" version "2.0.1" } version = "1.0" @@ -26,7 +26,7 @@ archivesBaseName = "modid" minecraft { version = "@VERSION@" - runDir = "eclipse" + runDir = "run" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. @@ -34,6 +34,7 @@ minecraft { // Use non-default mappings at your own risk. they may not allways work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = "@MAPPINGS@" + // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } dependencies { diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/MDKExample/.location similarity index 100% rename from eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location rename to eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/MDKExample/.location diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree index 897e2b847917fda481db0de6b8020ac05499a1dd..c64a62aa3537107ea026c463518787dbbe4a2b58 100644 GIT binary patch literal 468 zcmZvYK@x&63`J8a3T$=diWBq@j;uVDvuj!B+R{A617I{6 zk6|-DE#~;TKRuo)ff!`0GZ%!A2vtkxjPyrT28N|CJVLzloB%|^*rw9TkHUN~dkPQ> zr@b#Pg(I3)@--TXK4uJ-qdzrPAKLamXS0DAI^$V+A(_>$OxTM6pd@!zjoO(ExR3}= JN4r+4yZ}thLN)*Z literal 1224 zcmaKr&u`N(6vtnhj~pn0guM2T(OR - + - + - + - + diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch index 395f317..c34d27a 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch @@ -1,13 +1,13 @@ - + - + - + - + diff --git a/gitignore.txt b/gitignore.txt index 43654d1..2c770e0 100644 --- a/gitignore.txt +++ b/gitignore.txt @@ -19,3 +19,4 @@ build # other eclipse +run From 5ed505dab4183e38467153af7ae59ea7df6590fd Mon Sep 17 00:00:00 2001 From: Abrar Syed Date: Tue, 27 Oct 2015 23:45:49 -0500 Subject: [PATCH 04/90] Update FG version to 2.0.2 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6e5a6ea..a4a1dbf 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ apply plugin: 'net.minecraftforge.gradle.forge' // for people who want stable plugins { - id "net.minecraftforge.gradle.forge" version "2.0.1" + id "net.minecraftforge.gradle.forge" version "2.0.2" } version = "1.0" From ad43835de4501e6e00f93ada5962c992010dbe1c Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 15:30:09 -0500 Subject: [PATCH 05/90] Fix MDK for 1.8.8 using FG2.1 snapshot --- build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index a4a1dbf..8b821c7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -/* + // For those who want the bleeding edge buildscript { repositories { @@ -9,17 +9,17 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' */ - -// for people who want stable +/* +// for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } - +*/ version = "1.0" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" From 629904b1ab2bdbd39b2dd12073dda674560f304a Mon Sep 17 00:00:00 2001 From: Anthony Anderson Date: Tue, 24 Nov 2015 20:02:50 -0500 Subject: [PATCH 06/90] Remove trailing */ in the build.gradle Signed-off-by: Anthony Anderson --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8b821c7..1c5f080 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ buildscript { } } apply plugin: 'net.minecraftforge.gradle.forge' -*/ + /* // for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot plugins { From e3a778c2d85fadf1c3569fb7c253fc3c85b21a3e Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 18 May 2016 05:11:56 -0700 Subject: [PATCH 07/90] Update mappoings snapshot to 20160518 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1c5f080..5192034 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' From a3ec97428500093dc60528f3f2e80aa69e309654 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 18 May 2016 18:06:41 -0700 Subject: [PATCH 08/90] Update example mod for new mappings. --- src/main/java/com/example/examplemod/ExampleMod.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 82123bc..f01de14 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -14,7 +14,7 @@ public class ExampleMod @EventHandler public void init(FMLInitializationEvent event) { - // some example code - System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName()); + // some example code + System.out.println("DIRT BLOCK >> "+Blocks.DIRT.getUnlocalizedName()); } } From 7c9542263b7d245623d628e3c102202cf83f18c4 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 20 Aug 2016 17:11:08 -0700 Subject: [PATCH 09/90] Update gradle wrapper to 2.14, reference MC json, and add java6 compat lines to default MDK build.gradle. --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 5192034..68a98c4 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,11 @@ version = "1.0" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" +sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly. +compileJava { + sourceCompatibility = targetCompatibility = "1.6" +} + minecraft { version = "@VERSION@" runDir = "run" From f1a961b6d052dc6f7e7e414dcb32c959de8b74ce Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 8 Oct 2016 16:26:24 -0700 Subject: [PATCH 10/90] Small Cleanup in example build.gradle. --- build.gradle | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 68a98c4..4ba27f9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,25 +1,16 @@ - -// For those who want the bleeding edge buildscript { repositories { jcenter() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } + maven { url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' +//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup. + -/* -// for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot -plugins { - id "net.minecraftforge.gradle.forge" version "2.0.2" -} -*/ version = "1.0" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" From 5c06a5ad8f0a10877b4471ce9244d2d0474bff85 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 5 Dec 2016 12:16:30 -0800 Subject: [PATCH 11/90] Added gradle.properties to MDK (#3361) The file sets the default max heap size to 3 GiB so that the decompilation doesn't fail as often. (cherry picked from commit 49ec3d1b9322ee2b7a1312059118173b0b3fe6d0) --- gradle.properties | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 gradle.properties diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e9b9fd5 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +# This is required to provide enough memory for the Minecraft decompilation process. +org.gradle.jvmargs=-Xmx3G From b3f0466b7a68b4ba3e6ef02be8eabb7b926ffd2e Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Wed, 21 Dec 2016 15:52:30 -0800 Subject: [PATCH 12/90] Update MCP mappings to snapshot_nodoc_20161220 (#3551) --- build.gradle | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 4ba27f9..c888e91 100644 --- a/build.gradle +++ b/build.gradle @@ -8,11 +8,11 @@ buildscript { } } apply plugin: 'net.minecraftforge.gradle.forge' -//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup. +//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. version = "1.0" -group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly. @@ -27,7 +27,7 @@ minecraft { // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. - // Use non-default mappings at your own risk. they may not allways work. + // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = "@MAPPINGS@" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. @@ -57,8 +57,7 @@ dependencies { } -processResources -{ +processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version @@ -71,7 +70,7 @@ processResources expand 'version':project.version, 'mcversion':project.minecraft.version } - // copy everything else, thats not the mcmod.info + // copy everything else except the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } From 9763f5666d53877b7046f256ef4943bb6295a2a9 Mon Sep 17 00:00:00 2001 From: Max Shen Date: Mon, 1 May 2017 20:52:36 -0400 Subject: [PATCH 13/90] Add pack.mcmeta to examplemod (#3813) --- src/main/resources/pack.mcmeta | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/main/resources/pack.mcmeta diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..4018267 --- /dev/null +++ b/src/main/resources/pack.mcmeta @@ -0,0 +1,7 @@ +{ + "pack": { + "description": "examplemod resources", + "pack_format": 3, + "_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)." + } +} From bf6249efe4926ce37bc407ca6b31b34717a3f24a Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 6 Jun 2017 07:04:10 +1000 Subject: [PATCH 14/90] Initial patch update to 1.12. Some things to note: Netty is screwy so currently can't join single player. @cpw Crafting has been MAJORY reworked. The current GameRegistry functions are nooped, this is IN THE WORKS. Just need to move the recipe list to a full class registry, and then re implement the in-code recipe registration. Also, it IS advised that modders move to JSON, because ideally we'll see a S->C recipe syncing system in 1.13 which would allow servers to have custom recipes. OreDictionary currently 1/2 works, need to write a better algorithm for replacing ingredients. Please be patient Rendering: A lot of functions got a new float parameter, this is similar to partial ticks, needs more research --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index c888e91..deaf2d9 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { maven { url = "http://files.minecraftforge.net/maven" } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' @@ -15,9 +15,9 @@ version = "1.0" group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" -sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly. +sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. compileJava { - sourceCompatibility = targetCompatibility = "1.6" + sourceCompatibility = targetCompatibility = '1.8' } minecraft { From 2c7e9bed3734da2cb80ec5352818129b8bdafe38 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 12 Jan 2018 23:54:29 -0800 Subject: [PATCH 15/90] Minor code and documentation cleanup. (#4664) --- README.txt | 9 ++++++--- .../java/com/example/examplemod/ExampleMod.java | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.txt b/README.txt index b45931f..82be8dc 100644 --- a/README.txt +++ b/README.txt @@ -14,6 +14,9 @@ Source pack installation information: Standalone source installation ============================== +See the Forge Documentation online for more detailed instructions: +http://mcforge.readthedocs.io/en/latest/gettingstarted/ + Step 1: Open your command-line and browse to the folder where you extracted the zip file. Step 2: Once you have a command window up in the folder that the downloaded material was placed, type: @@ -24,7 +27,7 @@ Linux/Mac OS: "./gradlew setupDecompWorkspace" Step 3: After all that finished, you're left with a choice. For eclipse, run "gradlew eclipse" (./gradlew eclipse if you are on Mac/Linux) -If you preffer to use IntelliJ, steps are a little different. +If you prefer to use IntelliJ, steps are a little different. 1. Open IDEA, and import project. 2. Select your build.gradle file and have it import. 3. Once it's finished you must close IntelliJ and run the following command: @@ -33,14 +36,14 @@ If you preffer to use IntelliJ, steps are a little different. Step 4: The final step is to open Eclipse and switch your workspace to /eclipse/ (if you use IDEA, it should automatically start on your project) -If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not effect your code} and then start the processs again. +If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again. Should it still not work, Refer to #ForgeGradle on EsperNet for more information about the gradle environment. Tip: If you do not care about seeing Minecraft's source code you can replace "setupDecompWorkspace" with one of the following: -"setupDevWorkspace": Will patch, deobfusicated, and gather required assets to run minecraft, but will not generated human readable source code. +"setupDevWorkspace": Will patch, deobfuscate, and gather required assets to run minecraft, but will not generate human readable source code. "setupCIWorkspace": Same as Dev but will not download any assets. This is useful in build servers as it is the fastest because it does the least work. Tip: diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index f01de14..42a155b 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -4,17 +4,28 @@ import net.minecraft.init.Blocks; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import org.apache.logging.log4j.Logger; -@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION) +@Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION) public class ExampleMod { public static final String MODID = "examplemod"; + public static final String NAME = "Example Mod"; public static final String VERSION = "1.0"; - + + private static Logger logger; + + @EventHandler + public void preInit(FMLPreInitializationEvent event) + { + logger = event.getModLog(); + } + @EventHandler public void init(FMLInitializationEvent event) { // some example code - System.out.println("DIRT BLOCK >> "+Blocks.DIRT.getUnlocalizedName()); + logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } } From a171cf3efeebe1087f0c68c6ff444727ccd36bdc Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 25 Sep 2018 00:29:20 -0700 Subject: [PATCH 16/90] Work on publishing tasks. Userdev/universal/mdk done. mdk needs updating once FG3 user side is finished. Installer waiting on Interaller project re-write to do install time deobf/patching. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index deaf2d9..6dead0b 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { maven { url = "http://files.minecraftforge.net/maven" } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:3.+' } } apply plugin: 'net.minecraftforge.gradle.forge' From c83b13d45c41280437866012b3ad4c793ce1220c Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 30 Sep 2018 14:29:03 -0400 Subject: [PATCH 17/90] fix up the examplemod for new FML and add a couple of extra bits. --- .../com/example/examplemod/ExampleMod.java | 51 ++++++++++++----- src/main/resources/META-INF/mods.toml | 57 +++++++++++++++++++ src/main/resources/mcmod.info | 16 ------ src/main/resources/pack.mcmeta | 4 +- 4 files changed, 97 insertions(+), 31 deletions(-) create mode 100644 src/main/resources/META-INF/mods.toml delete mode 100644 src/main/resources/mcmod.info diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 42a155b..329ecab 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,31 +1,56 @@ package com.example.examplemod; +import net.minecraft.block.Block; import net.minecraft.init.Blocks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext; +import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION) +// The value here should match an entry in the META-INF/mods.toml file +@Mod("examplemod") public class ExampleMod { - public static final String MODID = "examplemod"; - public static final String NAME = "Example Mod"; - public static final String VERSION = "1.0"; + // Directly reference a log4j logger. + private static final Logger LOGGER = LogManager.getLogger(); - private static Logger logger; + public ExampleMod() { + // Register the preInit method for modloading + FMLModLoadingContext.get().getModEventBus().addListener(this::preInit); + // Register the init method for modloading + FMLModLoadingContext.get().getModEventBus().addListener(this::init); - @EventHandler - public void preInit(FMLPreInitializationEvent event) - { - logger = event.getModLog(); + // Register ourselves for server, registry and other game events we are interested in + MinecraftForge.EVENT_BUS.register(this); } - @EventHandler - public void init(FMLInitializationEvent event) + private void preInit(final FMLPreInitializationEvent event) + { + // some preinit code + LOGGER.info("HELLO FROM PREINIT"); + } + + private void init(final FMLInitializationEvent event) { // some example code - logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); + LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); + } + + @SubscribeEvent + public void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { + // register a new block here + LOGGER.info("HELLO from Register Block"); + } + + @SubscribeEvent + public void onServerStarting(FMLServerStartingEvent event) { + // do something when the server starts + LOGGER.info("HELLO from server starting"); } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..f012d48 --- /dev/null +++ b/src/main/resources/META-INF/mods.toml @@ -0,0 +1,57 @@ +# This is an example mods.toml file. It contains the data relating to the loading mods. +# There are several mandatory fields (#mandatory), and many more that are optional (#optional). +# The overall format is standard TOML format, v0.5.0. +# Note that there are a couple of TOML lists in this file. +# Find more information on toml format here: https://github.com/toml-lang/toml +# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml +modLoader="javafml" #mandatory +# A version range to match for said mod loader - for regular FML @Mod it will be the minecraft version (without the 1.) +loaderVersion="[13,)" #mandatory +# A URL to query for updates for this mod. See the JSON update specification +updateJSONURL="http://myurl.me/" #optional +# A URL to refer people to when problems occur with this mod +issueTrackerURL="http://my.issue.tracker/" #optional +# A URL for the "homepage" for this mod, displayed in the mod UI +displayURL="http://example.com/" #optional +# A file name (in the root of the mod JAR) containing a logo for display +logoFile="examplemod.png" #optional +# A text field displayed in the mod UI +credits="Thanks for this example mod goes to Java" #optional +# A text field displayed in the mod UI +authors="Love, Cheese and small house plants" #optional +# A list of mods - how many allowed here is determined by the individual mod loader +[[mods]] #mandatory +# The modid of the mod +modId="examplemod" #mandatory +# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it +version="1.0" #mandatory + # A display name for the mod +displayName="Example Mod" #mandatory +# The description text for the mod (multi line!) (#mandatory) +description=''' +This is a long form description of the mod. You can write whatever you want here + +Have some lorem ipsum. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. +''' + +# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. +[[dependencies.examplemod]] #optional + # the modid of the dependency + modId="forge" #mandatory + # Does this dependency have to exist - if not, ordering below must be specified + mandatory=true #mandatory + # The version range of the dependency + versionRange="[14.23.2.0,)" #mandatory + # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory + ordering="NONE" + # Side this dependency is applied on - BOTH, CLIENT or SERVER + side="BOTH" +# Here's another dependency +[[dependencies.examplemod]] + modId="minecraft" + mandatory=true + versionRange="[1.13]" + ordering="NONE" + side="BOTH" \ No newline at end of file diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info deleted file mode 100644 index f480667..0000000 --- a/src/main/resources/mcmod.info +++ /dev/null @@ -1,16 +0,0 @@ -[ -{ - "modid": "examplemod", - "name": "Example Mod", - "description": "Example placeholder mod.", - "version": "${version}", - "mcversion": "${mcversion}", - "url": "", - "updateUrl": "", - "authorList": ["ExampleDude"], - "credits": "The Forge and FML guys, for making this example", - "logoFile": "", - "screenshots": [], - "dependencies": [] -} -] diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 4018267..42ab490 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,7 +1,7 @@ { "pack": { "description": "examplemod resources", - "pack_format": 3, - "_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)." + "pack_format": 4, + "_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods." } } From c9f6da92f82c932e02e1f3d7076d33dfc29ddff3 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 11 Oct 2018 18:54:05 -0700 Subject: [PATCH 18/90] MDK progress. --- build.gradle | 45 ++++++++++++++++++++++++++++++--------------- test_at.cfg | 1 + 2 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 test_at.cfg diff --git a/build.gradle b/build.gradle index 6dead0b..1b9f242 100644 --- a/build.gradle +++ b/build.gradle @@ -1,19 +1,31 @@ buildscript { repositories { + mavenLocal() + maven { url = 'http://files.minecraftforge.net/maven' } jcenter() - maven { url = "http://files.minecraftforge.net/maven" } + mavenCentral() + } + // This is only here while i'm activly developing FG, Remind me to remove when we publically release + configurations { + classpath.resolutionStrategy { + cacheDynamicVersionsFor 10, 'seconds' + cacheChangingModulesFor 0, 'seconds' + } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:3.+' + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true } } -apply plugin: 'net.minecraftforge.gradle.forge' +apply plugin: 'net.minecraftforge.gradle' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +repositories { + maven { url ='file://' + file('../repo').absolutePath } //Used by Forge development testing only, you can delete this. +} -version = "1.0" -group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = "modid" +version = '1.0' +group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = 'modid' sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. compileJava { @@ -21,24 +33,27 @@ compileJava { } minecraft { - version = "@VERSION@" - runDir = "run" - // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "@MAPPINGS@" + mappings channel: 'snapshot', version: '20180921-1.13' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + + accessTransformer = file('test_at.cfg') } dependencies { + // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed + // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. + minecraft 'net.minecraftforge:forge:1.13-15.24.0.0-1.13-pre' + // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" - + // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env @@ -59,17 +74,17 @@ dependencies { processResources { // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + inputs.property 'version', project.version + inputs.property 'mcversion', '1.13' // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version + expand 'version':project.version, 'mcversion': '1.13' } - + // copy everything else except the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' diff --git a/test_at.cfg b/test_at.cfg new file mode 100644 index 0000000..fe3639d --- /dev/null +++ b/test_at.cfg @@ -0,0 +1 @@ +public net.minecraft.block.Block field_196273_d # LOGGER \ No newline at end of file From c3e52b499c319cb64fe635966cdc65f8db0cd738 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 13 Nov 2018 16:32:55 -0800 Subject: [PATCH 19/90] Workaround for gradle issue with jar signing. --- build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1b9f242..8298de6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ buildscript { repositories { mavenLocal() - maven { url = 'http://files.minecraftforge.net/maven' } + maven { url = 'https://files.minecraftforge.net/maven' } jcenter() mavenCentral() } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'net.minecraftforge.gradle' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +apply plugin: 'eclipse' repositories { maven { url ='file://' + file('../repo').absolutePath } //Used by Forge development testing only, you can delete this. From b89d5e00a803721a456b042360d5976fc85853b6 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 14 Nov 2018 13:39:56 -0800 Subject: [PATCH 20/90] Include changelog in published artifacts. --- build.gradle | 14 +++++--------- gitignore.txt | 3 +++ test_at.cfg | 1 - 3 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 test_at.cfg diff --git a/build.gradle b/build.gradle index 8298de6..58be6a5 100644 --- a/build.gradle +++ b/build.gradle @@ -20,10 +20,6 @@ apply plugin: 'net.minecraftforge.gradle' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. apply plugin: 'eclipse' -repositories { - maven { url ='file://' + file('../repo').absolutePath } //Used by Forge development testing only, you can delete this. -} - version = '1.0' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'modid' @@ -39,16 +35,16 @@ minecraft { // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: 'snapshot', version: '20180921-1.13' + mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - accessTransformer = file('test_at.cfg') + //accessTransformer = file('my_at.cfg') } dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. - minecraft 'net.minecraftforge:forge:1.13-15.24.0.0-1.13-pre' + minecraft 'net.minecraftforge:forge:@FORGE_VERSION@' // you may put jars on which you depend on in ./libs // or you may define them like so.. @@ -76,14 +72,14 @@ dependencies { processResources { // this will ensure that this task is redone when the versions change. inputs.property 'version', project.version - inputs.property 'mcversion', '1.13' + inputs.property 'mcversion', '@MC_VERSION@' // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion - expand 'version':project.version, 'mcversion': '1.13' + expand 'version':project.version, 'mcversion': '@MC_VERSION@' } // copy everything else except the mcmod.info diff --git a/gitignore.txt b/gitignore.txt index 2c770e0..12f8644 100644 --- a/gitignore.txt +++ b/gitignore.txt @@ -20,3 +20,6 @@ build # other eclipse run + +# Files from Forge MDK +forge*changelog.txt diff --git a/test_at.cfg b/test_at.cfg deleted file mode 100644 index fe3639d..0000000 --- a/test_at.cfg +++ /dev/null @@ -1 +0,0 @@ -public net.minecraft.block.Block field_196273_d # LOGGER \ No newline at end of file From fb1b05ea040c9141707564da89dd8b0314d81054 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 14 Nov 2018 13:42:11 -0800 Subject: [PATCH 21/90] Make Forge group/name dynamic in MDK as well. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 58be6a5..ee711d2 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ minecraft { dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. - minecraft 'net.minecraftforge:forge:@FORGE_VERSION@' + minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@' // you may put jars on which you depend on in ./libs // or you may define them like so.. From 05761cb243159bc7dcf3cd39d40090993913e804 Mon Sep 17 00:00:00 2001 From: David Quintana Date: Wed, 12 Dec 2018 05:04:23 +0100 Subject: [PATCH 22/90] Create a userdev-specific main, and include it as an injected file in the userdev jar. (#5231) --- build.gradle | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index ee711d2..ce344c1 100644 --- a/build.gradle +++ b/build.gradle @@ -39,6 +39,26 @@ minecraft { // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. //accessTransformer = file('my_at.cfg') + + // default run configurations. + // these can be tweaked, removed, or duplicated as needed. + runConfig { + name= "Minecraft Client" + main= "net.minecraftforge.userdev.UserdevLauncher" + ideaModuleName = "${project.name}_main" + workingDirectory = project.file("run").canonicalPath + environment "target", "fmldevclient" + environment "assetDirectory", downloadAssets.output.absolutePath + } + + runConfig { + name= "Minecraft Server" + main= "net.minecraftforge.userdev.UserdevLauncher" + ideaModuleName = "${project.name}_main" + workingDirectory = project.file("run").canonicalPath + environment "target", "fmldevserver" + environment "assetDirectory", downloadAssets.output.absolutePath + } } dependencies { @@ -76,7 +96,7 @@ processResources { // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' + include 'META_INF/mods.toml' // replace version and mcversion expand 'version':project.version, 'mcversion': '@MC_VERSION@' @@ -84,6 +104,6 @@ processResources { // copy everything else except the mcmod.info from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' + exclude 'META_INF/mods.toml' } } From 169d4ce67b45018c31df1660db36d03edb7dd49d Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 5 Jan 2019 00:14:07 -0500 Subject: [PATCH 23/90] Update mdk with some tweaks for building --- build.gradle | 7 ++++--- src/main/resources/META-INF/mods.toml | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index ce344c1..a6e9b95 100644 --- a/build.gradle +++ b/build.gradle @@ -63,8 +63,9 @@ minecraft { dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed - // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. - minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@' + // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. + // The userdev artifact is a special name and will get all sorts of transformations applied to it. + minecraft '@FORGE_GROUP@:userdev:@FORGE_VERSION@' // you may put jars on which you depend on in ./libs // or you may define them like so.. @@ -102,7 +103,7 @@ processResources { expand 'version':project.version, 'mcversion': '@MC_VERSION@' } - // copy everything else except the mcmod.info + // copy everything else except the mods.toml from(sourceSets.main.resources.srcDirs) { exclude 'META_INF/mods.toml' } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index f012d48..90970be 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -5,8 +5,8 @@ # Find more information on toml format here: https://github.com/toml-lang/toml # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory -# A version range to match for said mod loader - for regular FML @Mod it will be the minecraft version (without the 1.) -loaderVersion="[13,)" #mandatory +# A version range to match for said mod loader - for regular FML @Mod it will be the forge version +loaderVersion="[24,)" #mandatory (24 is current forge version) # A URL to query for updates for this mod. See the JSON update specification updateJSONURL="http://myurl.me/" #optional # A URL to refer people to when problems occur with this mod @@ -43,7 +43,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[14.23.2.0,)" #mandatory + versionRange="[24,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER From b063c1c80abb79b9e4391f219fe359e8e74b50e7 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 8 Jan 2019 00:29:36 -0800 Subject: [PATCH 24/90] Update userdev and runconfigs for ForgeGradle changes. --- build.gradle | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/build.gradle b/build.gradle index a6e9b95..ee4428e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,17 +1,9 @@ buildscript { repositories { - mavenLocal() maven { url = 'https://files.minecraftforge.net/maven' } jcenter() mavenCentral() } - // This is only here while i'm activly developing FG, Remind me to remove when we publically release - configurations { - classpath.resolutionStrategy { - cacheDynamicVersionsFor 10, 'seconds' - cacheChangingModulesFor 0, 'seconds' - } - } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true } @@ -24,10 +16,7 @@ version = '1.0' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'modid' -sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. -compileJava { - sourceCompatibility = targetCompatibility = '1.8' -} +sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. minecraft { // the mappings can be changed at any time, and must be in the following format. @@ -42,22 +31,14 @@ minecraft { // default run configurations. // these can be tweaked, removed, or duplicated as needed. - runConfig { - name= "Minecraft Client" - main= "net.minecraftforge.userdev.UserdevLauncher" - ideaModuleName = "${project.name}_main" - workingDirectory = project.file("run").canonicalPath - environment "target", "fmldevclient" - environment "assetDirectory", downloadAssets.output.absolutePath - } - - runConfig { - name= "Minecraft Server" - main= "net.minecraftforge.userdev.UserdevLauncher" - ideaModuleName = "${project.name}_main" - workingDirectory = project.file("run").canonicalPath - environment "target", "fmldevserver" - environment "assetDirectory", downloadAssets.output.absolutePath + runs { + client = { + workingDirectory project.file('run').canonicalPath + source sourceSets.main + } + server = { + workingDirectory project.file('run').canonicalPath + } } } @@ -65,7 +46,7 @@ dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft '@FORGE_GROUP@:userdev:@FORGE_VERSION@' + minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@' // you may put jars on which you depend on in ./libs // or you may define them like so.. @@ -79,10 +60,8 @@ dependencies { // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, - // except that these dependencies get remapped to your current MCP mappings - //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' - //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' + // These dependencies get remapped to your current MCP mappings + //deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' // for more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html From 4666bd9e8ae9ad8999cfa55e7b3e9ff54a3bef5b Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 14 Jan 2019 22:32:43 -0500 Subject: [PATCH 25/90] Fix up event naming, move them to sensible packages and document everything a bit. --- src/main/java/com/example/examplemod/ExampleMod.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 329ecab..f0fff58 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -6,9 +6,9 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.event.FMLInitializationEvent; +import net.minecraftforge.fml.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.event.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; From b1cd7fcee0dfb8963575a6d3f4c22758679bfcd5 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 14 Jan 2019 22:42:53 -0500 Subject: [PATCH 26/90] Update MDK for new naming scheme --- .../com/example/examplemod/ExampleMod.java | 61 +++++++++++++------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index f0fff58..30056fe 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -5,14 +5,19 @@ import net.minecraft.init.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.FMLInitializationEvent; -import net.minecraftforge.fml.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.event.FMLServerStartingEvent; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; +import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; +import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.util.stream.Collectors; + // The value here should match an entry in the META-INF/mods.toml file @Mod("examplemod") public class ExampleMod @@ -21,36 +26,58 @@ public class ExampleMod private static final Logger LOGGER = LogManager.getLogger(); public ExampleMod() { - // Register the preInit method for modloading - FMLModLoadingContext.get().getModEventBus().addListener(this::preInit); - // Register the init method for modloading - FMLModLoadingContext.get().getModEventBus().addListener(this::init); + // Register the setup method for modloading + FMLModLoadingContext.get().getModEventBus().addListener(this::setup); + // Register the enqueueIMC method for modloading + FMLModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); + // Register the processIMC method for modloading + FMLModLoadingContext.get().getModEventBus().addListener(this::processIMC); + // Register the doClientStuff method for modloading + FMLModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server, registry and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } - private void preInit(final FMLPreInitializationEvent event) + private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); - } - - private void init(final FMLInitializationEvent event) - { - // some example code LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } + private void doClientStuff(final FMLClientSetupEvent event) { + // do something that can only be done on the client + LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); + } + + private void enqueueIMC(final InterModEnqueueEvent event) + { + // some example code to dispatch IMC to another mod + InterModComms.sendTo("forge", "helloworld", () -> { LOGGER.info("Hello world"); return "Hello world";}); + } + + private void processIMC(final InterModProcessEvent event) + { + // some example code to receive and process InterModComms from other mods + LOGGER.info("Got IMC", event.getIMCStream(). + map(m->m.getMessageSupplier().get()). + collect(Collectors.toList())); + } + // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } - @SubscribeEvent - public void onServerStarting(FMLServerStartingEvent event) { - // do something when the server starts - LOGGER.info("HELLO from server starting"); + // You can use EventBusSubscriber to automatically subscribe events on the contained class + @Mod.EventBusSubscriber + public static class ServerEvents { + @SubscribeEvent + public static void onServerStarting(FMLServerStartingEvent event) { + // do something when the server starts + LOGGER.info("HELLO from server starting"); + } } } From 5422d1342c0032484493a0ffa8df3773fbb0327f Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 27 Jan 2019 00:06:57 -0500 Subject: [PATCH 27/90] More logging tweaks, including some aimed at userdev. `forge.logging.markers=` will enable markers. Signed-off-by: cpw --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index ee4428e..16a2f23 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,10 @@ minecraft { // these can be tweaked, removed, or duplicated as needed. runs { client = { + // recommended logging data for a userdev environment + systemProperties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' + // recommended logging level for the console + systemProperties 'forge.logging.console.level': 'debug' workingDirectory project.file('run').canonicalPath source sourceSets.main } From e9d087b6f3e5e258853d0d5684a9439f139ed3eb Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 27 Jan 2019 10:46:39 -0500 Subject: [PATCH 28/90] Fix mdk properties - now the mdk offers default console debug logging with various useful channels for development enabled. Signed-off-by: cpw --- build.gradle | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 16a2f23..5dd003e 100644 --- a/build.gradle +++ b/build.gradle @@ -34,14 +34,19 @@ minecraft { runs { client = { // recommended logging data for a userdev environment - systemProperties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' + properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' // recommended logging level for the console - systemProperties 'forge.logging.console.level': 'debug' + properties 'forge.logging.console.level': 'debug' workingDirectory project.file('run').canonicalPath source sourceSets.main } server = { + // recommended logging data for a userdev environment + properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' + // recommended logging level for the console + properties 'forge.logging.console.level': 'debug' workingDirectory project.file('run').canonicalPath + source sourceSets.main } } } From ae176e6c1f9a6ae4115a1441ec500d72037d3817 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 27 Jan 2019 11:37:56 -0500 Subject: [PATCH 29/90] Use recommended approach to applying version data to mdk. Signed-off-by: cpw --- build.gradle | 28 +++++++++++---------------- src/main/resources/META-INF/mods.toml | 3 +-- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index 5dd003e..ee99238 100644 --- a/build.gradle +++ b/build.gradle @@ -78,21 +78,15 @@ dependencies { } -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property 'version', project.version - inputs.property 'mcversion', '@MC_VERSION@' - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'META_INF/mods.toml' - - // replace version and mcversion - expand 'version':project.version, 'mcversion': '@MC_VERSION@' +// Example for how to get properties into the manifest for reading by the runtime.. +jar { + manifest { + attributes(["Specification-Title": "examplemod", + "Specification-Vendor": "examplemodsareus", + "Specification-Version": "24.0", // We are version 1 of the modlauncher specification + "Implementation-Title": project.name, + "Implementation-Version": "${version}", + "Implementation-Vendor" :"examplemodsareus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],) } - - // copy everything else except the mods.toml - from(sourceSets.main.resources.srcDirs) { - exclude 'META_INF/mods.toml' - } -} +} \ No newline at end of file diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 90970be..3c4cc87 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -24,7 +24,7 @@ authors="Love, Cheese and small house plants" #optional # The modid of the mod modId="examplemod" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it -version="1.0" #mandatory +version="${file.jarVersion}" #mandatory # A display name for the mod displayName="Example Mod" #mandatory # The description text for the mod (multi line!) (#mandatory) @@ -35,7 +35,6 @@ Have some lorem ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. ''' - # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.examplemod]] #optional # the modid of the dependency From 2ac439f99efed6492a3d541ff6ec4f6ec3f0d17b Mon Sep 17 00:00:00 2001 From: ichttt Date: Sun, 27 Jan 2019 21:23:24 +0100 Subject: [PATCH 30/90] Reimplement update checker --- src/main/resources/META-INF/mods.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 3c4cc87..7c52e29 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -7,8 +7,6 @@ modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version loaderVersion="[24,)" #mandatory (24 is current forge version) -# A URL to query for updates for this mod. See the JSON update specification -updateJSONURL="http://myurl.me/" #optional # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A URL for the "homepage" for this mod, displayed in the mod UI @@ -27,6 +25,8 @@ modId="examplemod" #mandatory version="${file.jarVersion}" #mandatory # A display name for the mod displayName="Example Mod" #mandatory +# A URL to query for updates for this mod. See the JSON update specification +updateJSONURL="http://myurl.me/" #optional # The description text for the mod (multi line!) (#mandatory) description=''' This is a long form description of the mod. You can write whatever you want here From e4bfca53af3d23ffe0c07f090199e5952f9c3ed5 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 4 Feb 2019 18:23:58 -0800 Subject: [PATCH 31/90] Rework server launching at runtime to include needed default arguments and validate libraries exist. Move Forge config loading to manual while config system is in development. --- gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle.properties b/gradle.properties index e9b9fd5..878bf1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx3G +org.gradle.daemon=false \ No newline at end of file From f71f34708248aa36cb2947547be6884757fb577e Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 13 Feb 2019 22:13:59 -0500 Subject: [PATCH 32/90] Clean up the mod loading context objects. There is only one ThreadLocal now. **BREAKING CHANGE** FMLModLoadingContext is renamed to FMLJavaModLoadingContext. LanguageProviders can setup additional contextual data. Signed-off-by: cpw --- .../com/example/examplemod/ExampleMod.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 30056fe..88204a0 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -12,7 +12,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; -import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -27,13 +27,13 @@ public class ExampleMod public ExampleMod() { // Register the setup method for modloading - FMLModLoadingContext.get().getModEventBus().addListener(this::setup); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading - FMLModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading - FMLModLoadingContext.get().getModEventBus().addListener(this::processIMC); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading - FMLModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server, registry and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); @@ -66,18 +66,18 @@ public class ExampleMod } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent - public void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { - // register a new block here - LOGGER.info("HELLO from Register Block"); + public static void onServerStarting(FMLServerStartingEvent event) { + // do something when the server starts + LOGGER.info("HELLO from server starting"); } - // You can use EventBusSubscriber to automatically subscribe events on the contained class - @Mod.EventBusSubscriber - public static class ServerEvents { + // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD event bus + @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) + public static class RegistryEvents { @SubscribeEvent - public static void onServerStarting(FMLServerStartingEvent event) { - // do something when the server starts - LOGGER.info("HELLO from server starting"); + public void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { + // register a new block here + LOGGER.info("HELLO from Register Block"); } } } From f4f3c9bd2d3649a6668602030ce2b6629be1e8c8 Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 15 Feb 2019 21:53:52 -0500 Subject: [PATCH 33/90] Fix the MDK.. Signed-off-by: cpw --- src/main/java/com/example/examplemod/ExampleMod.java | 11 ++++++----- src/main/resources/META-INF/mods.toml | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 88204a0..d0fa6c8 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -35,7 +35,7 @@ public class ExampleMod // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); - // Register ourselves for server, registry and other game events we are interested in + // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } @@ -54,7 +54,7 @@ public class ExampleMod private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod - InterModComms.sendTo("forge", "helloworld", () -> { LOGGER.info("Hello world"); return "Hello world";}); + InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) @@ -66,16 +66,17 @@ public class ExampleMod } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent - public static void onServerStarting(FMLServerStartingEvent event) { + public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } - // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD event bus + // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD + // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent - public void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { + public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 7c52e29..7ce23d4 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[24,)" #mandatory (24 is current forge version) +loaderVersion="[25,)" #mandatory (24 is current forge version) # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A URL for the "homepage" for this mod, displayed in the mod UI @@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[24,)" #mandatory + versionRange="[25,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.13]" + versionRange="[1.13.2]" ordering="NONE" side="BOTH" \ No newline at end of file From c5f7cfe6ee22fac28c1622816bc4c49cc28777e7 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 16 Feb 2019 17:42:30 -0500 Subject: [PATCH 34/90] Fix author and other strings in the mdk mods toml file, update coremods to 0.3.+ Signed-off-by: cpw --- build.gradle | 2 +- .../java/com/example/examplemod/ExampleMod.java | 2 +- src/main/resources/META-INF/mods.toml | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index ee99238..7b221e8 100644 --- a/build.gradle +++ b/build.gradle @@ -83,7 +83,7 @@ jar { manifest { attributes(["Specification-Title": "examplemod", "Specification-Vendor": "examplemodsareus", - "Specification-Version": "24.0", // We are version 1 of the modlauncher specification + "Specification-Version": "1", // We are version 1 of ourselves "Implementation-Title": project.name, "Implementation-Version": "${version}", "Implementation-Vendor" :"examplemodsareus", diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index d0fa6c8..2f904b1 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -60,7 +60,7 @@ public class ExampleMod private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods - LOGGER.info("Got IMC", event.getIMCStream(). + LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 7ce23d4..e87f17a 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -9,14 +9,6 @@ modLoader="javafml" #mandatory loaderVersion="[25,)" #mandatory (24 is current forge version) # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional -# A URL for the "homepage" for this mod, displayed in the mod UI -displayURL="http://example.com/" #optional -# A file name (in the root of the mod JAR) containing a logo for display -logoFile="examplemod.png" #optional -# A text field displayed in the mod UI -credits="Thanks for this example mod goes to Java" #optional -# A text field displayed in the mod UI -authors="Love, Cheese and small house plants" #optional # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod @@ -27,6 +19,14 @@ version="${file.jarVersion}" #mandatory displayName="Example Mod" #mandatory # A URL to query for updates for this mod. See the JSON update specification updateJSONURL="http://myurl.me/" #optional +# A URL for the "homepage" for this mod, displayed in the mod UI +displayURL="http://example.com/" #optional +# A file name (in the root of the mod JAR) containing a logo for display +logoFile="examplemod.png" #optional +# A text field displayed in the mod UI +credits="Thanks for this example mod goes to Java" #optional +# A text field displayed in the mod UI +authors="Love, Cheese and small house plants" #optional # The description text for the mod (multi line!) (#mandatory) description=''' This is a long form description of the mod. You can write whatever you want here From 7714f8c98b19e1b18d107046f1065ba3a01553de Mon Sep 17 00:00:00 2001 From: Jack Taylor Date: Tue, 19 Feb 2019 08:39:05 +1300 Subject: [PATCH 35/90] Refactor forge and example run configs based on MinecraftForge/ForgeGradle#546 - Updated run config formats based on the refactored setup - Removed old 'runclient' and 'runserver' JavaExec tasks, replacing them by creating the run configs using the refactored setup. - Set 'assetIndex' environment variable from FG - Updated MDK for new run config setup --- build.gradle | 96 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 40 deletions(-) diff --git a/build.gradle b/build.gradle index 7b221e8..2b334b1 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } } apply plugin: 'net.minecraftforge.gradle' -//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. apply plugin: 'eclipse' version = '1.0' @@ -19,34 +19,49 @@ archivesBaseName = 'modid' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. minecraft { - // the mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD snapshot are built nightly. - // stable_# stables are built at the discretion of the MCP team. + // The mappings can be changed at any time, and must be in the following format. + // snapshot_YYYYMMDD Snapshot are built nightly. + // stable_# Stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. - // simply re-run your setup task after changing the mappings to update your workspace. + // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - //accessTransformer = file('my_at.cfg') + // accessTransformer = file('build/resources/main/META-INF/accesstransformer.cfg') - // default run configurations. - // these can be tweaked, removed, or duplicated as needed. + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. runs { - client = { - // recommended logging data for a userdev environment - properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' - // recommended logging level for the console - properties 'forge.logging.console.level': 'debug' - workingDirectory project.file('run').canonicalPath - source sourceSets.main + client { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + + mods { + examplemod { + source sourceSets.main + } + } } - server = { - // recommended logging data for a userdev environment - properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' - // recommended logging level for the console - properties 'forge.logging.console.level': 'debug' - workingDirectory project.file('run').canonicalPath - source sourceSets.main + + server { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + + mods { + examplemod { + source sourceSets.main + } + } } } } @@ -57,22 +72,21 @@ dependencies { // The userdev artifact is a special name and will get all sorts of transformations applied to it. minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@' - // you may put jars on which you depend on in ./libs - // or you may define them like so.. - //compile "some.group:artifact:version:classifier" - //compile "some.group:artifact:version" + // You may put jars on which you depend on in ./libs or you may define them like so.. + // compile "some.group:artifact:version:classifier" + // compile "some.group:artifact:version" - // real examples - //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env + // Real examples + // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env + // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' + // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. + // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // These dependencies get remapped to your current MCP mappings - //deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' + // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' - // for more info... + // For more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html @@ -81,12 +95,14 @@ dependencies { // Example for how to get properties into the manifest for reading by the runtime.. jar { manifest { - attributes(["Specification-Title": "examplemod", - "Specification-Vendor": "examplemodsareus", - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": "${version}", - "Implementation-Vendor" :"examplemodsareus", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],) + attributes([ + "Specification-Title": "examplemod", + "Specification-Vendor": "examplemodsareus", + "Specification-Version": "1", // We are version 1 of ourselves + "Implementation-Title": project.name, + "Implementation-Version": "${version}", + "Implementation-Vendor" :"examplemodsareus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) } } \ No newline at end of file From 5b4dfd11bf46b9fb9eb022cf69204fb83e4b4d51 Mon Sep 17 00:00:00 2001 From: tterrag Date: Mon, 18 Feb 2019 15:14:42 -0500 Subject: [PATCH 36/90] Remove now defunct eclipse files from MDK --- .../.projects/MDKExample/.location | 0 .../org.eclipse.core.resources/.root/0.tree | Bin 468 -> 0 bytes .../org.eclipse.core.resources.prefs | 4 --- .../.settings/org.eclipse.debug.ui.prefs | 7 ----- .../org.eclipse.epp.usagedata.gathering.prefs | 3 --- .../.settings/org.eclipse.jdt.core.prefs | 14 ---------- .../.settings/org.eclipse.ui.editors.prefs | 4 --- .../.settings/org.eclipse.ui.ide.prefs | 9 ------- .../.settings/org.eclipse.ui.prefs | 3 --- .../.launches/Client.launch | 13 --------- .../.launches/Server.launch | 13 --------- .../launchConfigurationHistory.xml | 25 ------------------ 12 files changed, 95 deletions(-) delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/MDKExample/.location delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch delete mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/MDKExample/.location b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/MDKExample/.location deleted file mode 100644 index e69de29..0000000 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree deleted file mode 100644 index c64a62aa3537107ea026c463518787dbbe4a2b58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 468 zcmZvYK@x&63`J8a3T$=diWBq@j;uVDvuj!B+R{A617I{6 zk6|-DE#~;TKRuo)ff!`0GZ%!A2vtkxjPyrT28N|CJVLzloB%|^*rw9TkHUN~dkPQ> zr@b#Pg(I3)@--TXK4uJ-qdzrPAKLamXS0DAI^$V+A(_>$OxTM6pd@!zjoO(ExR3}= JN4r+4yZ}thLN)*Z diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 466d7f9..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Sun Jun 05 18:58:07 CEST 2011 -version=1 -eclipse.preferences.version=1 -refresh.enabled=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs deleted file mode 100644 index 94c5676..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Sun Jun 05 19:03:53 CEST 2011 -eclipse.preferences.version=1 -org.eclipse.debug.ui.UseContextualLaunch=false -Console.highWaterMark=88000 -org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=\r\n\r\n -org.eclipse.debug.ui.user_view_bindings=\r\n\r\n\r\n\r\n\r\n\r\n -StringVariablePreferencePage=130,107,107,86, diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs deleted file mode 100644 index 333b991..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun Jun 05 18:58:07 CEST 2011 -eclipse.preferences.version=1 -org.eclipse.epp.usagedata.gathering.enabled=false diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 12ec368..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,14 +0,0 @@ -#Sun Sep 18 16:44:39 NZST 2011 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=ignore -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs deleted file mode 100644 index 316ef6f..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Sun Jun 05 18:58:05 CEST 2011 -spacesForTabs=true -eclipse.preferences.version=1 -overviewRuler_migration=migrated_3.1 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs deleted file mode 100644 index ae368ab..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Sun Jun 05 18:58:07 CEST 2011 -IMPORT_FILES_AND_FOLDERS_MODE=prompt -IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE=prompt -SAVE_ALL_BEFORE_BUILD=true -eclipse.preferences.version=1 -tipsAndTricks=true -platformState=1287081747687 -quickStart=false -PROBLEMS_FILTERS_MIGRATE=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs deleted file mode 100644 index cbc5953..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun Jun 05 18:50:08 CEST 2011 -eclipse.preferences.version=1 -showIntro=false diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch deleted file mode 100644 index 61b8b47..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch deleted file mode 100644 index c34d27a..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml deleted file mode 100644 index 1208f60..0000000 --- a/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - From b1cd9faf724a645b84250791a6788044c8dc8fe6 Mon Sep 17 00:00:00 2001 From: John Hannan Date: Tue, 26 Feb 2019 10:11:41 +0800 Subject: [PATCH 37/90] Update MDK Readme to describe new FG3 procedures. (#5553) --- README.txt | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/README.txt b/README.txt index 82be8dc..6904b37 100644 --- a/README.txt +++ b/README.txt @@ -19,35 +19,26 @@ http://mcforge.readthedocs.io/en/latest/gettingstarted/ Step 1: Open your command-line and browse to the folder where you extracted the zip file. -Step 2: Once you have a command window up in the folder that the downloaded material was placed, type: +Step 2: You're left with a choice. +If you prefer to use Eclipse: +1. Run the following command: "gradlew genEclipseRuns" (./gradlew genEclipseRuns if you are on Mac/Linux) +2. Open Eclipse, Import > Existing Gradle Project > Select Folder + or run "gradlew eclipse" to generate the project. +(Current Issue) +4. Open Project > Run/Debug Settings > Edit runClient and runServer > Environment +5. Edit MOD_CLASSES to show [modid]%%[Path]; 2 times rather then the generated 4. -Windows: "gradlew setupDecompWorkspace" -Linux/Mac OS: "./gradlew setupDecompWorkspace" - -Step 3: After all that finished, you're left with a choice. -For eclipse, run "gradlew eclipse" (./gradlew eclipse if you are on Mac/Linux) - -If you prefer to use IntelliJ, steps are a little different. +If you prefer to use IntelliJ: 1. Open IDEA, and import project. 2. Select your build.gradle file and have it import. -3. Once it's finished you must close IntelliJ and run the following command: - -"gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux) - -Step 4: The final step is to open Eclipse and switch your workspace to /eclipse/ (if you use IDEA, it should automatically start on your project) +3. Run the following command: "gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux) +4. Refresh the Gradle Project in IDEA if required. If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again. Should it still not work, Refer to #ForgeGradle on EsperNet for more information about the gradle environment. - -Tip: -If you do not care about seeing Minecraft's source code you can replace "setupDecompWorkspace" with one of the following: -"setupDevWorkspace": Will patch, deobfuscate, and gather required assets to run minecraft, but will not generate human readable source code. -"setupCIWorkspace": Same as Dev but will not download any assets. This is useful in build servers as it is the fastest because it does the least work. - -Tip: -When using Decomp workspace, the Minecraft source code is NOT added to your workspace in a editable way. Minecraft is treated like a normal Library. Sources are there for documentation and research purposes and usually can be accessed under the 'referenced libraries' section of your IDE. +or the Forge Project Discord discord.gg/UvedJ9m Forge source installation ========================= From 52909292acc7bdb4e2b344a2b4aaf2a48d87bfc5 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 9 Mar 2019 18:43:20 -0500 Subject: [PATCH 38/90] Add way to publish the reobf Jar with the maven-publish task. The standard way does not publish reobfuscated artifacts. Signed-off-by: cpw --- build.gradle | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/build.gradle b/build.gradle index 2b334b1..f693e19 100644 --- a/build.gradle +++ b/build.gradle @@ -11,6 +11,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. apply plugin: 'eclipse' +apply plugin: 'maven-publish' version = '1.0' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html @@ -105,4 +106,26 @@ jar { "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } +} + +// Example configuration to allow publishing using the maven-publish task +// we define a custom artifact that is sourced from the reobfJar output task +// and then declare that to be published +// Note you'll need to add a repository here +def reobfFile = file("$buildDir/reobfJar/output.jar") +def reobfArtifact = artifacts.add('default', reobfFile) { + type 'jar' + builtBy 'reobfJar' +} +publishing { + publications { + mavenJava(MavenPublication) { + artifact reobfArtifact + } + } + repositories { + maven { + url "file:///${project.projectDir}/mcmodsrepo" + } + } } \ No newline at end of file From b02f3209df59287a11bb23ed0a0fac3fcd40f75a Mon Sep 17 00:00:00 2001 From: marcus8448 <28928887+marcus8448@users.noreply.github.com> Date: Wed, 12 Jun 2019 16:49:20 -0700 Subject: [PATCH 39/90] Update Example Mod (#5781) --- src/main/java/com/example/examplemod/ExampleMod.java | 2 +- src/main/resources/META-INF/mods.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 2f904b1..a436462 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,7 +1,7 @@ package com.example.examplemod; import net.minecraft.block.Block; -import net.minecraft.init.Blocks; +import net.minecraft.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index e87f17a..8b35f0c 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[25,)" #mandatory (24 is current forge version) +loaderVersion="[26,)" #mandatory (26 is current forge version) # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A list of mods - how many allowed here is determined by the individual mod loader @@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[25,)" #mandatory + versionRange="[26,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.13.2]" + versionRange="[1.14.2]" ordering="NONE" side="BOTH" \ No newline at end of file From 35aab8b17aec901430c773812a285f2d37c9bb17 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 25 Jun 2019 18:03:51 -0700 Subject: [PATCH 40/90] Split userdev data entry point into it's own provider to fix duplicate mod issue. --- build.gradle | 18 ++++++++++++++++++ src/main/resources/META-INF/mods.toml | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index f693e19..1978015 100644 --- a/build.gradle +++ b/build.gradle @@ -64,6 +64,24 @@ minecraft { } } } + + data { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + + args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/') + + mods { + examplemod { + source sourceSets.main + } + } + } } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 8b35f0c..c1392eb 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[26,)" #mandatory + versionRange="[27,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.14.2]" + versionRange="[1.14.3]" ordering="NONE" side="BOTH" \ No newline at end of file From 32b7e456d77fe8de060db879116b08c79d5da8da Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 8 Jul 2019 17:49:52 -0700 Subject: [PATCH 41/90] Fixed EntityJoinWorldEvent not being fired when player is added to ServerWorld. #5827 Fixed wrong example path for the access transformer in the MDK build.gradle. #5891 Added getters for mouse x/y velocity and if the middle-mouse button is being held down. #5776 Modify issue template for better clarity. #5874 Fixed grindstone not using ItemStack-sensitive getMaxDamage. #5831 Added ParticleManager.registerFactory to Forge's AT. #5896 Fixed NPE in SidedInvWrapper when side was null. #5787 Moved EndermanEntity.setAttackTarget super call to allow LivingSetAttackTargetEvent the ability to override default behavior. #5778 Added field to make "Looking at" debug info maximum distance configurable #5714 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1978015..ff823f9 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ minecraft { mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - // accessTransformer = file('build/resources/main/META-INF/accesstransformer.cfg') + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. // These can be tweaked, removed, or duplicated as needed. From c8076eaf041add4fd9d7a66031605c9d89afbb42 Mon Sep 17 00:00:00 2001 From: Thomas Aunvik Date: Sat, 20 Jul 2019 18:06:06 +0200 Subject: [PATCH 42/90] Updated Example Version Range for 1.14.4 (#5950) * Updated Example Version Range for 1.14.4 * Also changed loader version and version range --- src/main/resources/META-INF/mods.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index c1392eb..ffc5085 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[26,)" #mandatory (26 is current forge version) +loaderVersion="[28,)" #mandatory (26 is current forge version) # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A list of mods - how many allowed here is determined by the individual mod loader @@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[27,)" #mandatory + versionRange="[28,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.14.3]" + versionRange="[1.14.4]" ordering="NONE" - side="BOTH" \ No newline at end of file + side="BOTH" From 81766ad1802a121e2e7900a3ddc98bc839e830ff Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 12 Sep 2019 08:52:22 -0700 Subject: [PATCH 43/90] Fix Entity.getPersistentData function name. Closes #6131 Bump spec version for first 1.14.4 RB. --- src/main/resources/META-INF/mods.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index ffc5085..23aa1e7 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[28,)" #mandatory (26 is current forge version) +loaderVersion="[28,)" #mandatory (28 is current forge version) # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A list of mods - how many allowed here is determined by the individual mod loader From 80d2e0ff5c9331e487296fd64202840563e23856 Mon Sep 17 00:00:00 2001 From: tterrag Date: Tue, 17 Dec 2019 14:30:18 -0500 Subject: [PATCH 44/90] Update to 1.15.1 --- src/main/resources/META-INF/mods.toml | 6 +++--- src/main/resources/pack.mcmeta | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 23aa1e7..a38b28b 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[28,)" #mandatory (28 is current forge version) +loaderVersion="[30,)" #mandatory (28 is current forge version) # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A list of mods - how many allowed here is determined by the individual mod loader @@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[28,)" #mandatory + versionRange="[30,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.14.4]" + versionRange="[1.15.1]" ordering="NONE" side="BOTH" diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 42ab490..700e07e 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,7 +1,7 @@ { "pack": { "description": "examplemod resources", - "pack_format": 4, - "_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods." + "pack_format": 5, + "_comment": "A pack_format of 5 requires json lang files and some texture changes from 1.15. Note: we require v5 pack meta for all mods." } } From 27b368124dfc02c7d23dbfd26debe7a162feb3e9 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 22 Jan 2020 13:11:13 -0800 Subject: [PATCH 45/90] 1.15.2 Initial Update --- src/main/resources/META-INF/mods.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index a38b28b..2f84c78 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[30,)" #mandatory (28 is current forge version) +loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A list of mods - how many allowed here is determined by the individual mod loader @@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[30,)" #mandatory + versionRange="[31,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.15.1]" + versionRange="[1.15.2]" ordering="NONE" side="BOTH" From eaeed364ba2b2a96ff23194430edbc9d1c624b91 Mon Sep 17 00:00:00 2001 From: Unnoen Date: Sat, 15 Feb 2020 07:02:00 +1100 Subject: [PATCH 46/90] Update version and support data on README. (#6429) --- build.gradle | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index ff823f9..9b0d650 100644 --- a/build.gradle +++ b/build.gradle @@ -127,18 +127,15 @@ jar { } // Example configuration to allow publishing using the maven-publish task -// we define a custom artifact that is sourced from the reobfJar output task -// and then declare that to be published -// Note you'll need to add a repository here -def reobfFile = file("$buildDir/reobfJar/output.jar") -def reobfArtifact = artifacts.add('default', reobfFile) { - type 'jar' - builtBy 'reobfJar' -} +// This is the preferred method to reobfuscate your jar file +jar.finalizedBy('reobfJar') +// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing +//publish.dependsOn('reobfJar') + publishing { publications { mavenJava(MavenPublication) { - artifact reobfArtifact + artifact jar } } repositories { From f7f7dab1dd846bd9b21d27ed222a5b29e292fec3 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jun 2020 16:57:07 -0700 Subject: [PATCH 47/90] Add --flat argument to data generators to not create data in mod specific directores. Useful For Forge's test mods mainly. Standardized data gen cache file's folder separators. Added ItemModelProvider to BlockStateProvider for cleaner datagen code. Added .gitattributes to fix datagen json's line endings correct on windows. --- gitattributes.txt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gitattributes.txt diff --git a/gitattributes.txt b/gitattributes.txt new file mode 100644 index 0000000..f811f6a --- /dev/null +++ b/gitattributes.txt @@ -0,0 +1,5 @@ +# Disable autocrlf on generated files, they always generate with LF +# Add any extra files or paths here to make git stop saying they +# are changed when only line endings change. +src/generated/**/.cache/cache text eol=lf +src/generated/**/*.json text eol=lf From f949b368b8b745c56a1a685f6f0b36f7d6d08a48 Mon Sep 17 00:00:00 2001 From: Yunus Date: Fri, 26 Jun 2020 03:42:28 +0200 Subject: [PATCH 48/90] Updated MDK mods.toml versions (#6808) --- src/main/resources/META-INF/mods.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 2f84c78..490e8bf 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[32,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A list of mods - how many allowed here is determined by the individual mod loader @@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[31,)" #mandatory + versionRange="[32,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.15.2]" + versionRange="[1.16.1]" ordering="NONE" side="BOTH" From 6e2d55542f5f3b82a287deafbdb44d2441eb6c67 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 29 Jun 2020 19:33:30 -0700 Subject: [PATCH 49/90] Re-write checkATs function and automate making Items/Blocks public. --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 9b0d650..321d61e 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,7 @@ archivesBaseName = 'modid' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. +println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { // The mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD Snapshot are built nightly. From 2c41698b3d6225bd60b9695a48ee38c50b136e57 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 27 Jul 2020 20:09:45 -0400 Subject: [PATCH 50/90] Update coremods and spi, include mandatory license field in metadata. Added at top level of mods.toml file. Signed-off-by: cpw --- src/main/resources/META-INF/mods.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 490e8bf..8d888bc 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -7,6 +7,8 @@ modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version loaderVersion="[32,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties +license="CHOOSE YOUR LICENSE" # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A list of mods - how many allowed here is determined by the individual mod loader From d03fbe5331534cf1cf6bde22a5f3faec139cb5a6 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 27 Jul 2020 21:06:48 -0400 Subject: [PATCH 51/90] Update MDK license to default to All rights reserved, and offer a link to chooseyourlicense.com as a place to research appropriate licenses. Note: the license field _is_ backwards compatible and will simply be ignored on older forge versions. Signed-off-by: cpw --- src/main/resources/META-INF/mods.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 8d888bc..f3a5af7 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -7,8 +7,9 @@ modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version loaderVersion="[32,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. -# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties -license="CHOOSE YOUR LICENSE" +# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. +# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. +license="All rights reserved" # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A list of mods - how many allowed here is determined by the individual mod loader From 0e2a3a6b1468e59d78cc490ca72de936205c2be2 Mon Sep 17 00:00:00 2001 From: Yunus Date: Thu, 13 Aug 2020 21:22:58 +0200 Subject: [PATCH 52/90] Updated MDK and README for 1.16.2 (#7243) --- src/main/resources/META-INF/mods.toml | 6 +++--- src/main/resources/pack.mcmeta | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index f3a5af7..fdad2f9 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[32,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[33,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. license="All rights reserved" @@ -45,7 +45,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[32,)" #mandatory + versionRange="[33,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -54,6 +54,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.16.1]" + versionRange="[1.16.2]" ordering="NONE" side="BOTH" diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 700e07e..c79a362 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,7 +1,7 @@ { "pack": { "description": "examplemod resources", - "pack_format": 5, - "_comment": "A pack_format of 5 requires json lang files and some texture changes from 1.15. Note: we require v5 pack meta for all mods." + "pack_format": 6, + "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." } } From 5dd948508a57246668a8fd764bec4b02efb7825a Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 10 Sep 2020 12:01:34 -0700 Subject: [PATCH 53/90] 1.16.3 Update Also included a bunch of warning cleanups. --- src/main/resources/META-INF/mods.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index fdad2f9..adf66a1 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[33,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[34,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. license="All rights reserved" @@ -45,7 +45,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[33,)" #mandatory + versionRange="[34,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -54,6 +54,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.16.2]" + versionRange="[1.16.3]" ordering="NONE" side="BOTH" From e686486665182ba1f384202247703de8001cd46c Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Thu, 8 Oct 2020 16:03:41 -0500 Subject: [PATCH 54/90] Additions to the mdk build.gradle to accommodate datagens. (#7398) --- build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 321d61e..ce1eb64 100644 --- a/build.gradle +++ b/build.gradle @@ -75,7 +75,8 @@ minecraft { // Recommended logging level for the console property 'forge.logging.console.level', 'debug' - args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/') + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. + args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { examplemod { @@ -86,6 +87,9 @@ minecraft { } } +// Include resources generated by data generators. +sourceSets.main.resources { srcDir 'src/generated/resources' } + dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. From 60f678cc08566dcd4b7cba3afb72e59c66d385a8 Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 6 Nov 2020 21:11:26 -0500 Subject: [PATCH 55/90] Update event bus version (should be 3.0.5) Tweak MDK to automatically populate recommended values for things like forge version, loader version and minecraft version. Signed-off-by: cpw --- src/main/resources/META-INF/mods.toml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index adf66a1..2c950c2 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[34,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[@FORGE_SPEC_VERSION@,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. license="All rights reserved" @@ -17,6 +17,8 @@ issueTrackerURL="http://my.issue.tracker/" #optional # The modid of the mod modId="examplemod" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it +# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata +# see the associated build.gradle script for how to populate this completely automatically during a build version="${file.jarVersion}" #mandatory # A display name for the mod displayName="Example Mod" #mandatory @@ -45,7 +47,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[34,)" #mandatory + versionRange="[@FORGE_SPEC_VERSION@,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -54,6 +56,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn [[dependencies.examplemod]] modId="minecraft" mandatory=true - versionRange="[1.16.3]" +# This version range declares a minimum of the current minecraft version up to but not including the next major version + versionRange="[@MC_VERSION@,@MC_NEXT_VERSION@)" ordering="NONE" side="BOTH" From 82bbd361bbbb045214cb26d1c1894b23b7da3c2b Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 26 Dec 2020 11:39:14 -0800 Subject: [PATCH 56/90] Quiet down errors related to modders not changing their update urls from the default. --- src/main/resources/META-INF/mods.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 2c950c2..472db36 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -11,7 +11,7 @@ loaderVersion="[@FORGE_SPEC_VERSION@,)" #mandatory This is typically bumped ever # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. license="All rights reserved" # A URL to refer people to when problems occur with this mod -issueTrackerURL="http://my.issue.tracker/" #optional +#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod @@ -22,10 +22,10 @@ modId="examplemod" #mandatory version="${file.jarVersion}" #mandatory # A display name for the mod displayName="Example Mod" #mandatory -# A URL to query for updates for this mod. See the JSON update specification -updateJSONURL="http://myurl.me/" #optional +# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ +#updateJSONURL="https://change.me.example.invalid/updates.json" #optional # A URL for the "homepage" for this mod, displayed in the mod UI -displayURL="http://example.com/" #optional +#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional # A file name (in the root of the mod JAR) containing a logo for display logoFile="examplemod.png" #optional # A text field displayed in the mod UI From e14a0a16d9a3d32ac546511e0af764c537dd8f73 Mon Sep 17 00:00:00 2001 From: FledgeShiu Date: Tue, 16 Feb 2021 08:39:02 +0800 Subject: [PATCH 57/90] Reduce default logging markers in the MDK. Modders can re-enable these for better debugging. (#7432) Modders PLEASE read your damn log, and fix the errors we point out. Spamming modpacks with stack traces is just lazy programming. --- build.gradle | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index ce1eb64..024dfa2 100644 --- a/build.gradle +++ b/build.gradle @@ -38,9 +38,15 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + // The markers can be changed as needed. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' mods { @@ -54,9 +60,15 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + // The markers can be changed as needed. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' mods { @@ -70,9 +82,15 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + // The markers can be changed as needed. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. @@ -148,4 +166,4 @@ publishing { url "file:///${project.projectDir}/mcmodsrepo" } } -} \ No newline at end of file +} From 7d7d9f3617d95a9f4c8bbe644b2b03f3483a333a Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 9 Mar 2021 13:27:46 -0800 Subject: [PATCH 58/90] Update to FG4, and Gradle 6.8. --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 024dfa2..ea1c619 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true } } apply plugin: 'net.minecraftforge.gradle' @@ -17,7 +17,7 @@ version = '1.0' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'modid' -sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. +java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8. println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { From c8bca2c697e724bb74d7a96667146751cc751f3c Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 9 Mar 2021 13:37:23 -0800 Subject: [PATCH 59/90] Regenerate patches with relative headers. This should lower conflicts in future PRs. Convert Forge to use Official mappings. Mojang released their obfuscation mappings but we have not used them up until now due to wanting to get their license to be more explicitly permissive. It is clear that their intent is to allow us to use their names for developing mods like this. See the full wording, and our interpretation here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md --- README.txt | 51 ++++++++++++++++++++++----------------------------- build.gradle | 10 ++++++++-- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/README.txt b/README.txt index 6904b37..344bca7 100644 --- a/README.txt +++ b/README.txt @@ -1,53 +1,46 @@ -------------------------------------------- + Source installation information for modders ------------------------------------------- This code follows the Minecraft Forge installation methodology. It will apply some small patches to the vanilla MCP source code, giving you and it access to some of the data and functions you need to build a successful mod. -Note also that the patches are built against "unrenamed" MCP source code (aka -srgnames) - this means that you will not be able to read them directly against +Note also that the patches are built against "un-renamed" MCP source code (aka +SRG Names) - this means that you will not be able to read them directly against normal code. -Source pack installation information: - -Standalone source installation +Setup Process: ============================== -See the Forge Documentation online for more detailed instructions: -http://mcforge.readthedocs.io/en/latest/gettingstarted/ - Step 1: Open your command-line and browse to the folder where you extracted the zip file. Step 2: You're left with a choice. If you prefer to use Eclipse: -1. Run the following command: "gradlew genEclipseRuns" (./gradlew genEclipseRuns if you are on Mac/Linux) +1. Run the following command: `gradlew genEclipseRuns` (`./gradlew genEclipseRuns` if you are on Mac/Linux) 2. Open Eclipse, Import > Existing Gradle Project > Select Folder - or run "gradlew eclipse" to generate the project. -(Current Issue) -4. Open Project > Run/Debug Settings > Edit runClient and runServer > Environment -5. Edit MOD_CLASSES to show [modid]%%[Path]; 2 times rather then the generated 4. + or run `gradlew eclipse` to generate the project. If you prefer to use IntelliJ: 1. Open IDEA, and import project. 2. Select your build.gradle file and have it import. -3. Run the following command: "gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux) +3. Run the following command: `gradlew genIntellijRuns` (`./gradlew genIntellijRuns` if you are on Mac/Linux) 4. Refresh the Gradle Project in IDEA if required. -If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again. +If at any point you are missing libraries in your IDE, or you've run into problems you can +run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything +{this does not affect your code} and then start the process again. -Should it still not work, -Refer to #ForgeGradle on EsperNet for more information about the gradle environment. -or the Forge Project Discord discord.gg/UvedJ9m +Mapping Names: +============================= +By default, the MDK is configured to use the official mapping names from Mojang for methods and fields +in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this +license, if you do not agree with it you can change your mapping names to other crowdsourced names in your +build.gradle. For the latest license text, refer to the mapping file itself, or the reference copy here: +https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md -Forge source installation +Additional Resources: ========================= -MinecraftForge ships with this code and installs it as part of the forge -installation process, no further action is required on your part. - -LexManos' Install Video -======================= -https://www.youtube.com/watch?v=8VEdtQLuLO0&feature=youtu.be - -For more details update more often refer to the Forge Forums: -http://www.minecraftforge.net/forum/index.php/topic,14048.0.html +Community Documentation: http://mcforge.readthedocs.io/en/latest/gettingstarted/ +LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0 +Forge Forum: https://forums.minecraftforge.net/ +Forge Discord: https://discord.gg/UvedJ9m \ No newline at end of file diff --git a/build.gradle b/build.gradle index ea1c619..802dc12 100644 --- a/build.gradle +++ b/build.gradle @@ -22,8 +22,14 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { // The mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD Snapshot are built nightly. - // stable_# Stables are built at the discretion of the MCP team. + // Channel: Version: + // snapshot YYYYMMDD Snapshot are built nightly. + // stable # Stables are built at the discretion of the MCP team. + // official MCVersion Official field/method names from Mojang mapping files + // + // You must be aware of the Mojang license when using the 'official' mappings. + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md + // // Use non-default mappings at your own risk. they may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@' From 2228a32446842ca5c6d0850c10d1f1466fda460b Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 15 Mar 2021 12:18:42 -0700 Subject: [PATCH 60/90] Use JGit instead of GrGit now that jcenter is going away. Update missed mapped name in MDK. --- build.gradle | 1 - src/main/java/com/example/examplemod/ExampleMod.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 802dc12..81b2ef9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,6 @@ buildscript { repositories { maven { url = 'https://files.minecraftforge.net/maven' } - jcenter() mavenCentral() } dependencies { diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index a436462..b96f36a 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -48,7 +48,7 @@ public class ExampleMod private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client - LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); + LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options); } private void enqueueIMC(final InterModEnqueueEvent event) From 2ebe71dd9cb633d6fdbbf758673f088c47f4cbdd Mon Sep 17 00:00:00 2001 From: AterAnimAvis Date: Fri, 23 Apr 2021 06:28:18 +0100 Subject: [PATCH 61/90] Update for Forge's new maven (#7723) --- build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 81b2ef9..9a1cca7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { repositories { - maven { url = 'https://files.minecraftforge.net/maven' } + maven { url = 'https://maven.minecraftforge.net' } mavenCentral() } dependencies { @@ -43,7 +43,7 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // The markers can be changed as needed. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. @@ -65,7 +65,7 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // The markers can be changed as needed. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. @@ -87,7 +87,7 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // The markers can be changed as needed. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. From 25bec28365387a58199a87329e9dafc73c2d4b6f Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Wed, 21 Jul 2021 16:21:09 -0500 Subject: [PATCH 62/90] ForgeGradle 5.1 and Gradle 7, which allows development on J16. Runtime still targets J8. (#7877) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9a1cca7..17e2f9b 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true } } apply plugin: 'net.minecraftforge.gradle' From 43918e34960b6b2c3565fc7c486b523e569f9f6b Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Sat, 17 Jul 2021 00:08:49 -0500 Subject: [PATCH 63/90] Update to 1.17 Update to Official classnames Patchwork Make the game compile and run Merge in the new HUD overlay API Merge in the new render properties API PEEL Use Gradle 7.2 snapshot to fix eclipse integration bug in 7.1, Would use 7.0 but FG needs 7.1 for some reason. New FML installer Update to 1.17.1 Co-authored-by: LexManos Co-authored-by: SizableShrimp Co-authored-by: cpw Co-authored-by: Curle Co-authored-by: Unnoen Co-authored-by: covers1624 Co-authored-by: DaemonUmbra Co-authored-by: gigaherz Signed-off-by: SizableShrimp --- build.gradle | 76 ++++++++++--------- .../com/example/examplemod/ExampleMod.java | 16 +--- 2 files changed, 44 insertions(+), 48 deletions(-) diff --git a/build.gradle b/build.gradle index 17e2f9b..2cd5253 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ buildscript { repositories { + // These repositories are only for Gradle plugins, put any other repositories in the repository block further below maven { url = 'https://maven.minecraftforge.net' } mavenCentral() } @@ -16,11 +17,12 @@ version = '1.0' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'modid' -java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8. +// Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16. +java.toolchain.languageVersion = JavaLanguageVersion.of(16) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { - // The mappings can be changed at any time, and must be in the following format. + // The mappings can be changed at any time and must be in the following format. // Channel: Version: // snapshot YYYYMMDD Snapshot are built nightly. // stable # Stables are built at the discretion of the MCP team. @@ -29,12 +31,11 @@ minecraft { // You must be aware of the Mojang license when using the 'official' mappings. // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md // - // Use non-default mappings at your own risk. they may not always work. + // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@' - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - - // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. // Default run configurations. // These can be tweaked, removed, or duplicated as needed. @@ -43,7 +44,7 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. @@ -65,7 +66,7 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. @@ -87,7 +88,7 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - // The markers can be changed as needed. + // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. @@ -113,52 +114,55 @@ minecraft { // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } +repositories { + // Put repositories for dependencies here + // ForgeGradle automatically adds the Forge maven and Maven Central for you + + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + // flatDir { + // dir 'libs' + // } +} + dependencies { - // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed - // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. + // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed + // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@' - // You may put jars on which you depend on in ./libs or you may define them like so.. - // compile "some.group:artifact:version:classifier" - // compile "some.group:artifact:version" + // Real mod deobf dependency examples - these get remapped to your current mappings + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency + // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency - // Real examples - // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // These dependencies get remapped to your current MCP mappings - // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' + // Examples using mod jars from ./libs + // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") // For more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html - } -// Example for how to get properties into the manifest for reading by the runtime.. +// Example for how to get properties into the manifest for reading at runtime. jar { manifest { attributes([ - "Specification-Title": "examplemod", - "Specification-Vendor": "examplemodsareus", - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": "${version}", - "Implementation-Vendor" :"examplemodsareus", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + "Specification-Title" : "examplemod", + "Specification-Vendor" : "examplemodsareus", + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "examplemodsareus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } -// Example configuration to allow publishing using the maven-publish task +// Example configuration to allow publishing using the maven-publish plugin // This is the preferred method to reobfuscate your jar file -jar.finalizedBy('reobfJar') +jar.finalizedBy('reobfJar') // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing -//publish.dependsOn('reobfJar') +// publish.dependsOn('reobfJar') publishing { publications { @@ -168,7 +172,7 @@ publishing { } repositories { maven { - url "file:///${project.projectDir}/mcmodsrepo" + url "file://${project.projectDir}/mcmodsrepo" } } } diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index b96f36a..b744326 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,17 +1,16 @@ package com.example.examplemod; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; -import net.minecraftforge.fml.event.server.FMLServerStartingEvent; +import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -32,8 +31,6 @@ public class ExampleMod FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); - // Register the doClientStuff method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); @@ -46,11 +43,6 @@ public class ExampleMod LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } - private void doClientStuff(final FMLClientSetupEvent event) { - // do something that can only be done on the client - LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options); - } - private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod @@ -61,7 +53,7 @@ public class ExampleMod { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). - map(m->m.getMessageSupplier().get()). + map(m->m.messageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call From 77eeae0066d2d958729b17951f01261f52f5d52a Mon Sep 17 00:00:00 2001 From: Cyborgmas Date: Mon, 23 Aug 2021 13:52:17 -0400 Subject: [PATCH 64/90] Minor resource pack related fixes (#7884) --- src/main/resources/pack.mcmeta | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index c79a362..9a20876 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,7 +1,6 @@ { "pack": { "description": "examplemod resources", - "pack_format": 6, - "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." + "pack_format": 7 } } From 159afdac3f8f8c81a94c84a1baae96573726e527 Mon Sep 17 00:00:00 2001 From: Curle Date: Fri, 26 Nov 2021 18:57:41 +0000 Subject: [PATCH 65/90] Initial port to 1.18 Co-authored-by: David Quintana Co-authored-by: SizableShrimp --- build.gradle | 4 ++-- src/main/java/com/example/examplemod/ExampleMod.java | 2 +- src/main/resources/pack.mcmeta | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 2cd5253..bdeae58 100644 --- a/build.gradle +++ b/build.gradle @@ -17,8 +17,8 @@ version = '1.0' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'modid' -// Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16. -java.toolchain.languageVersion = JavaLanguageVersion.of(16) +// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. +java.toolchain.languageVersion = JavaLanguageVersion.of(17) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index b744326..4def3a4 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -10,7 +10,7 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; -import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; +import net.minecraftforge.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 9a20876..b18e3cd 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "examplemod resources", - "pack_format": 7 + "pack_format": 8 } } From bd4304882805a2f1c3b3ec9f931a5196f6c22202 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 30 Nov 2021 16:20:48 -0800 Subject: [PATCH 66/90] Fix dedicated server install. Closes #8226 Fix example mod Fix obf issue with records. Closes #8228 Fix dependencies beingg out of sync from vanilla. Closes #8227 Disable mixin due to module incompatibility. --- src/main/java/com/example/examplemod/ExampleMod.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 4def3a4..27476be 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -10,7 +10,7 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; -import net.minecraftforge.event.server.FMLServerStartingEvent; +import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -58,7 +58,7 @@ public class ExampleMod } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent - public void onServerStarting(FMLServerStartingEvent event) { + public void onServerStarting(ServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } From 17b8c584047d34525296772e8d56dcb417f6ff60 Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Thu, 24 Feb 2022 19:06:32 -0600 Subject: [PATCH 67/90] [1.18] Integrate the gametest framework with Forge (#8225) Signed-off-by: SizableShrimp --- build.gradle | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/build.gradle b/build.gradle index bdeae58..a663f59 100644 --- a/build.gradle +++ b/build.gradle @@ -55,6 +55,9 @@ minecraft { // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'examplemod' + mods { examplemod { source sourceSets.main @@ -77,6 +80,37 @@ minecraft { // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'examplemod' + + mods { + examplemod { + source sourceSets.main + } + } + } + + // This run config launches GameTestServer and runs all registered gametests, then exits. + // By default, the server will crash when no gametests are provided. + // The gametest system is also enabled by default for other run configs under the /test command. + gameTestServer { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'examplemod' + mods { examplemod { source sourceSets.main From 7f65352e09aced40e534901c9d0e6deb6191101d Mon Sep 17 00:00:00 2001 From: sciwhiz12 Date: Wed, 2 Mar 2022 02:59:37 +0800 Subject: [PATCH 68/90] 1.18.x Omnibus (#8239) --- build.gradle | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index a663f59..b988736 100644 --- a/build.gradle +++ b/build.gradle @@ -8,10 +8,13 @@ buildscript { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true } } -apply plugin: 'net.minecraftforge.gradle' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -apply plugin: 'eclipse' -apply plugin: 'maven-publish' +plugins { + id 'eclipse' + id 'maven-publish' +} +apply plugin: 'net.minecraftforge.gradle' + version = '1.0' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html @@ -20,17 +23,19 @@ archivesBaseName = 'modid' // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) -println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) +println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { // The mappings can be changed at any time and must be in the following format. // Channel: Version: - // snapshot YYYYMMDD Snapshot are built nightly. - // stable # Stables are built at the discretion of the MCP team. - // official MCVersion Official field/method names from Mojang mapping files + // official MCVersion Official field/method names from Mojang mapping files + // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official // - // You must be aware of the Mojang license when using the 'official' mappings. + // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md // + // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge + // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started + // // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@' @@ -68,16 +73,8 @@ minecraft { server { workingDirectory project.file('run') - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. property 'forge.logging.markers', 'REGISTRIES' - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. @@ -121,16 +118,8 @@ minecraft { data { workingDirectory project.file('run') - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. property 'forge.logging.markers', 'REGISTRIES' - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. From 03379dea274fba774b828d9625d11adbf6403f0a Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Tue, 1 Mar 2022 14:59:27 -0600 Subject: [PATCH 69/90] Update to 1.18.2 Co-authored-by: sciwhiz12 Co-authored-by: Marc Hermans Co-authored-by: LexManos Co-authored-by: Curle Signed-off-by: SizableShrimp --- .../com/example/examplemod/ExampleMod.java | 31 +++++++++++-------- src/main/resources/pack.mcmeta | 2 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 27476be..421fd07 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,5 +1,6 @@ package com.example.examplemod; +import com.mojang.logging.LogUtils; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.MinecraftForge; @@ -12,8 +13,7 @@ import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.util.stream.Collectors; @@ -21,10 +21,11 @@ import java.util.stream.Collectors; @Mod("examplemod") public class ExampleMod { - // Directly reference a log4j logger. - private static final Logger LOGGER = LogManager.getLogger(); + // Directly reference a slf4j logger + private static final Logger LOGGER = LogUtils.getLogger(); - public ExampleMod() { + public ExampleMod() + { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading @@ -45,31 +46,35 @@ public class ExampleMod private void enqueueIMC(final InterModEnqueueEvent event) { - // some example code to dispatch IMC to another mod + // Some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { - // some example code to receive and process InterModComms from other mods + // Some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.messageSupplier().get()). collect(Collectors.toList())); } + // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) { - // do something when the server starts + public void onServerStarting(ServerStartingEvent event) + { + // Do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) - @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) - public static class RegistryEvents { + @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) + public static class RegistryEvents + { @SubscribeEvent - public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { - // register a new block here + public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) + { + // Register a new block here LOGGER.info("HELLO from Register Block"); } } diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index b18e3cd..f335b9f 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "examplemod resources", - "pack_format": 8 + "pack_format": 9 } } From c1b7b55c9e852ed6bee05d7028aa8b8e000c2e18 Mon Sep 17 00:00:00 2001 From: Paint_Ninja Date: Sun, 6 Mar 2022 14:53:15 +0000 Subject: [PATCH 70/90] Use UTF-8 charset for Java compilation (#8486) --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index b988736..4f1e84d 100644 --- a/build.gradle +++ b/build.gradle @@ -199,3 +199,7 @@ publishing { } } } + +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation +} From 9a3c0ec02d8001ce2f106826ec65bb254d9ab386 Mon Sep 17 00:00:00 2001 From: sciwhiz12 Date: Wed, 1 Jun 2022 01:36:44 +0800 Subject: [PATCH 71/90] Add pack-type-specific format versions in pack metadata. Fixes #8563 (#8612) --- src/main/resources/pack.mcmeta | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index f335b9f..6f2f48b 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,8 @@ { "pack": { "description": "examplemod resources", - "pack_format": 9 + "pack_format": 9, + "forge:resource_pack_format": 8, + "forge:data_pack_format": 9 } } From 54dd4e8da51f975895b6457767a71826f0942aab Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Tue, 7 Jun 2022 15:31:26 -0500 Subject: [PATCH 72/90] Forge 1.19 * Bump pack.mcmeta formats * 1.19 biome modifiers * Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable * Add docs and package-info to client extension interfaces package * Move RenderBlockOverlayEvent hooks to ForgeHooksClient * Add package-infos to client events package * Rename SoundLoadEvent to SoundEngineLoadEvent This reduces confusion from consumers which may think the name SoundLoadEvent refers to an individual sound being loaded rather than the sound engine. * Document and change SoundLoadEvent to fire on mod bus Previously, it fired on both the mod bus and the Forge bus, which is confusing for consumers. * Delete SoundSetupEvent Looking at its original implementation shows that there isn't an appropriate place in the new sound code to reinsert the event, and the place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent. * Perform some cleanup on client events - Removed nullable annotations from ClientPlayerNetworkEvent - Renamed #getPartialTicks methods to #getPartialTick, to be consistent with vanilla's naming of the partial tick - Cleanup documentation to remove line breaks, use the spelling 'cancelled' over 'canceled', and improve docs on existing and new methods. * Remove EntityEvent.CanUpdate Closes MinecraftForge/MinecraftForge#6394 * Switch to Jetbrains nullability annotations * New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent * Remove ForgeWorldPresetScreens * Remove IForgeRegistryEntry * Remove use of List in FML's CompletableFutures * Add docs to mod loading stages, stages, and phases * Gradle 7.4.2 * Use SLF4J in FMLLoader and other subprojects * Switch dynamic versions in subprojects to pinned ones * Switch ForgeRoot and MDK to FG plugin markers * Configure Forge javadoc task The task now uses a custom stylesheet with MCForge elements, and configured to combine the generation from the four FML subprojects (fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project into the javadoc output. * Update docs/md files, for 1.19 update and the move away from IRC to Discord. * Make "Potentially dangerous alternative prefix" a debug warning, not info. Co-authored-by: Curle Co-authored-by: sciwhiz12 Signed-off-by: SizableShrimp --- build.gradle | 14 +------------- settings.gradle | 6 ++++++ src/main/resources/pack.mcmeta | 4 ++-- 3 files changed, 9 insertions(+), 15 deletions(-) create mode 100644 settings.gradle diff --git a/build.gradle b/build.gradle index 4f1e84d..f2dd6cf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,8 @@ -buildscript { - repositories { - // These repositories are only for Gradle plugins, put any other repositories in the repository block further below - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - } -} -// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. plugins { id 'eclipse' id 'maven-publish' + id 'net.minecraftforge.gradle' version '5.+' } -apply plugin: 'net.minecraftforge.gradle' - version = '1.0' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..3703f36 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,6 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { url = 'https://maven.minecraftforge.net/' } + } +} \ No newline at end of file diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 6f2f48b..b643e13 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -2,7 +2,7 @@ "pack": { "description": "examplemod resources", "pack_format": 9, - "forge:resource_pack_format": 8, - "forge:data_pack_format": 9 + "forge:resource_pack_format": 9, + "forge:data_pack_format": 10 } } From 8a16ae06c9158db67bcfca03b072a0f1390bf880 Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Thu, 9 Jun 2022 13:37:52 -0500 Subject: [PATCH 73/90] Update MDK for 1.19 changes (#8675) --- README.txt | 4 +- build.gradle | 12 +-- .../com/example/examplemod/ExampleMod.java | 78 ++++++++++--------- 3 files changed, 46 insertions(+), 48 deletions(-) diff --git a/README.txt b/README.txt index 344bca7..867e97e 100644 --- a/README.txt +++ b/README.txt @@ -40,7 +40,7 @@ https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md Additional Resources: ========================= -Community Documentation: http://mcforge.readthedocs.io/en/latest/gettingstarted/ +Community Documentation: https://mcforge.readthedocs.io/en/latest/gettingstarted/ LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0 Forge Forum: https://forums.minecraftforge.net/ -Forge Discord: https://discord.gg/UvedJ9m \ No newline at end of file +Forge Discord: https://discord.gg/UvedJ9m diff --git a/build.gradle b/build.gradle index f2dd6cf..1c1b219 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'eclipse' id 'maven-publish' - id 'net.minecraftforge.gradle' version '5.+' + id 'net.minecraftforge.gradle' version '5.1.+' } version = '1.0' @@ -65,7 +65,6 @@ minecraft { property 'forge.logging.console.level', 'debug' - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', 'examplemod' mods { @@ -81,19 +80,10 @@ minecraft { gameTestServer { workingDirectory project.file('run') - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. property 'forge.logging.markers', 'REGISTRIES' - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', 'examplemod' mods { diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 421fd07..48b8fd6 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,61 +1,69 @@ package com.example.examplemod; import com.mojang.logging.LogUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.material.Material; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; import org.slf4j.Logger; -import java.util.stream.Collectors; - // The value here should match an entry in the META-INF/mods.toml file -@Mod("examplemod") +@Mod(ExampleMod.MODID) public class ExampleMod { + // Define mod id in a common place for everything to reference + public static final String MODID = "examplemod"; // Directly reference a slf4j logger private static final Logger LOGGER = LogUtils.getLogger(); + // Create a Deferred Register to hold Blocks which will all be registered under the "examplemod" namespace + public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); + // Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace + public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); + + // Creates a new Block with the id "examplemod:example_block", combining the namespace and path + public static final RegistryObject EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + // Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path + public static final RegistryObject EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS))); public ExampleMod() { - // Register the setup method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); - // Register the enqueueIMC method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); - // Register the processIMC method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); + IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); + + // Register the commonSetup method for modloading + modEventBus.addListener(this::commonSetup); + + // Register the Deferred Register to the mod event bus so blocks get registered + BLOCKS.register(modEventBus); + // Register the Deferred Register to the mod event bus so items get registered + ITEMS.register(modEventBus); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } - private void setup(final FMLCommonSetupEvent event) + private void commonSetup(final FMLCommonSetupEvent event) { - // some preinit code - LOGGER.info("HELLO FROM PREINIT"); - LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); - } - - private void enqueueIMC(final InterModEnqueueEvent event) - { - // Some example code to dispatch IMC to another mod - InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); - } - - private void processIMC(final InterModProcessEvent event) - { - // Some example code to receive and process InterModComms from other mods - LOGGER.info("Got IMC {}", event.getIMCStream(). - map(m->m.messageSupplier().get()). - collect(Collectors.toList())); + // Some common setup code + LOGGER.info("HELLO FROM COMMON SETUP"); + LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); } // You can use SubscribeEvent and let the Event Bus discover methods to call @@ -66,16 +74,16 @@ public class ExampleMod LOGGER.info("HELLO from server starting"); } - // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD - // Event bus for receiving Registry Events) - @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) - public static class RegistryEvents + // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent + @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD) + public static class ClientModEvents { @SubscribeEvent - public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) + public static void onClientSetup(FMLClientSetupEvent event) { - // Register a new block here - LOGGER.info("HELLO from Register Block"); + // Some client setup code + LOGGER.info("HELLO FROM CLIENT SETUP"); + LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); } } } From 800cd6407e8585ff0fa674847605e284e3b1ec92 Mon Sep 17 00:00:00 2001 From: cpw Date: Thu, 9 Jun 2022 16:39:00 -0400 Subject: [PATCH 74/90] displayTest option in mods.toml (#8656) * displayTest option in mods.toml * "MATCH_VERSION" (or none) is existing match version string behaviour * "IGNORE_SERVER_VERSION" accepts anything and sends special SERVERONLY string * "IGNORE_ALL_VERSION" accepts anything and sends an empty string * "NONE" allows the mod to supply their own displaytest using the IExtensionPoint mechanism. * Update display test with feedback and added the mods.toml discussion in mdk. --- src/main/resources/META-INF/mods.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 472db36..43ca177 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -32,6 +32,14 @@ logoFile="examplemod.png" #optional credits="Thanks for this example mod goes to Java" #optional # A text field displayed in the mod UI authors="Love, Cheese and small house plants" #optional +# Display Test controls the display for your mod in the server connection screen +# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. +# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. +# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. +# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. +# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. +#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) + # The description text for the mod (multi line!) (#mandatory) description=''' This is a long form description of the mod. You can write whatever you want here From f66aa6f7276f94f1dda09058971f6cab860e7f78 Mon Sep 17 00:00:00 2001 From: Nexus-Dino <86781290+Nexus-Dino@users.noreply.github.com> Date: Fri, 21 Oct 2022 21:22:57 +0100 Subject: [PATCH 75/90] Fix ClientModEvents example not subscribing to client-sided events (#9097) --- src/main/java/com/example/examplemod/ExampleMod.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 48b8fd6..d19f293 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -9,6 +9,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.Material; +import net.minecraftforge.api.distmarker.Dist import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -75,7 +76,7 @@ public class ExampleMod } // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent - @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD) + @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public static class ClientModEvents { @SubscribeEvent From dce91156092d972859ac430b5f68233e524ea0b0 Mon Sep 17 00:00:00 2001 From: Nexus-Dino <86781290+Nexus-Dino@users.noreply.github.com> Date: Tue, 8 Nov 2022 20:16:49 +0000 Subject: [PATCH 76/90] Add missing semi-colon near the Dist import statement in example mod. --- src/main/java/com/example/examplemod/ExampleMod.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index d19f293..803db87 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -9,7 +9,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.Material; -import net.minecraftforge.api.distmarker.Dist +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; From d2f2e9451193cff9298af470301b99214cfac6ce Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Tue, 22 Nov 2022 13:32:47 -0600 Subject: [PATCH 77/90] Forge 1.19.3 Created a CreativeModeTabEvent to register creative mode tabs and populate entries per tab Moved datapack registries to DataPackRegistryEvent.NewRegistry event instead of tying them to ForgeRegistry Made it easier for mods to datagen datapack builtin entries with DatapackBuiltinEntriesProvider Provided access to lookupProvider for datagen Updated dependencies to match versions used by vanilla and update JarJar to 0.3.18 Added a test mod for the new CreativeModeTabEvent Throws better error message for Forge registries in tag datagen Deleted ForgeRegistryTagsProvider Updated ClientChatReceivedEvent and ServerChatEvent for Mojang changes Added patches for both sign related methods in ModelLayers Changed RegisterShadersEvent to use ResourceProvider Migrated old Mojang math types to JOML Co-authored-by: Marc Hermans Co-authored-by: LexManos Co-authored-by: sciwhiz12 Co-authored-by: coehlrich --- build.gradle | 2 -- .../java/com/example/examplemod/ExampleMod.java | 14 ++++++++------ src/main/resources/pack.mcmeta | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 1c1b219..2f1f2bd 100644 --- a/build.gradle +++ b/build.gradle @@ -132,8 +132,6 @@ dependencies { minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@' // Real mod deobf dependency examples - these get remapped to your current mappings - // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency - // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency // Examples using mod jars from ./libs diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 803db87..e4013ff 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -3,7 +3,7 @@ package com.example.examplemod; import com.mojang.logging.LogUtils; import net.minecraft.client.Minecraft; import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -11,15 +11,13 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.Material; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; -import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; -import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; @@ -42,7 +40,7 @@ public class ExampleMod // Creates a new Block with the id "examplemod:example_block", combining the namespace and path public static final RegistryObject EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); // Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS))); + public static final RegistryObject EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties())); public ExampleMod() { @@ -58,6 +56,10 @@ public class ExampleMod // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); + + // Register the item to a creative tab + modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS, + EXAMPLE_BLOCK_ITEM.get())); } private void commonSetup(final FMLCommonSetupEvent event) diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index b643e13..aa7bb5d 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,8 +1,8 @@ { "pack": { "description": "examplemod resources", - "pack_format": 9, - "forge:resource_pack_format": 9, + "pack_format": 12, + "forge:resource_pack_format": 12, "forge:data_pack_format": 10 } } From 8adb648b8d07de30c9666aa0dc77879bbf21b945 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 10 Dec 2022 15:03:23 -0800 Subject: [PATCH 78/90] Redesign CreativeTab collection event to be a lot more straight forward. (#9198) --- src/main/java/com/example/examplemod/ExampleMod.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index e4013ff..44199e6 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -58,8 +58,7 @@ public class ExampleMod MinecraftForge.EVENT_BUS.register(this); // Register the item to a creative tab - modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS, - EXAMPLE_BLOCK_ITEM.get())); + modEventBus.addListener(this::addCreative); } private void commonSetup(final FMLCommonSetupEvent event) @@ -69,6 +68,12 @@ public class ExampleMod LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); } + private void addCreative(CreativeModeTabEvent.BuildContents event) + { + if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + event.accept(EXAMPLE_BLOCK_ITEM); + } + // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(ServerStartingEvent event) From b54d88379c70d857e78122ead4ef40f825ee3977 Mon Sep 17 00:00:00 2001 From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com> Date: Mon, 26 Dec 2022 22:19:44 +0100 Subject: [PATCH 79/90] Update link for Parchment "Getting Started" (#9243) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2f1f2bd..6a75535 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ minecraft { // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md // // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge - // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started + // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started // // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. From 10fd88714d4fd8e5278443cf177658a2c8943351 Mon Sep 17 00:00:00 2001 From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com> Date: Fri, 30 Dec 2022 20:11:43 +0100 Subject: [PATCH 80/90] Fix broken link for update checker docs in mdk (#9271) --- src/main/resources/META-INF/mods.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 43ca177..dfdb038 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -22,7 +22,7 @@ modId="examplemod" #mandatory version="${file.jarVersion}" #mandatory # A display name for the mod displayName="Example Mod" #mandatory -# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ +# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/ #updateJSONURL="https://change.me.example.invalid/updates.json" #optional # A URL for the "homepage" for this mod, displayed in the mod UI #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional From 92f7a8ac577ba77c51fef7e5af671e66ee0735e3 Mon Sep 17 00:00:00 2001 From: noeppi_noeppi <63002502+noeppi-noeppi@users.noreply.github.com> Date: Fri, 24 Mar 2023 21:17:22 +0100 Subject: [PATCH 81/90] Update pack versions (#9414) --- src/main/resources/pack.mcmeta | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index aa7bb5d..71656b3 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,8 +1,8 @@ { "pack": { "description": "examplemod resources", - "pack_format": 12, - "forge:resource_pack_format": 12, - "forge:data_pack_format": 10 + "pack_format": 13, + "forge:client_resources_pack_format": 13, + "forge:server_data_pack_format": 12 } } From 821c23e9ba437e821813759d301beeecb7d24eaf Mon Sep 17 00:00:00 2001 From: ChampionAsh5357 Date: Tue, 28 Mar 2023 16:33:59 -0400 Subject: [PATCH 82/90] Update and Regenerate Datapacks (#9419) Add generation for pack.mcmeta --- src/main/resources/pack.mcmeta | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 src/main/resources/pack.mcmeta diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta deleted file mode 100644 index 71656b3..0000000 --- a/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,8 +0,0 @@ -{ - "pack": { - "description": "examplemod resources", - "pack_format": 13, - "forge:client_resources_pack_format": 13, - "forge:server_data_pack_format": 12 - } -} From 773c579dab4a64bc30053cb84c9d1d943b337e19 Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Sat, 1 Apr 2023 20:45:29 -0500 Subject: [PATCH 83/90] Forge 1.20 - Creative mode tabs are now a registry; the `BuildContents` event was renamed to `BuildCreativeModeTabContentsEvent` and moved it to its own class - The pack format is now 15 for both resource packs and data packs - `ScreenUtils` was deprecated in favor of a `GuiGraphics` extension - Forge and the MDK were updated to Gradle 8 and FG6 - The Forge common config file was removed (it only contained the deprecated old fields for resource caching, which was removed in 1.19.3) - Registry dummy entries were removed - `RemappingVertexPipeline` was fixed to forward the `endVertex()` call - Forge tool tags were removed in favor of vanilla ones Co-authored-by: ChampionAsh5357 Co-authored-by: coehlrich Co-authored-by: Dennis C <11262040+XFactHD@users.noreply.github.com> Co-authored-by: Matyrobbrt --- build.gradle | 109 +++++++++++++----- gradle.properties | 57 ++++++++- settings.gradle | 9 +- .../com/example/examplemod/ExampleMod.java | 30 ++++- src/main/resources/META-INF/mods.toml | 46 ++++---- 5 files changed, 192 insertions(+), 59 deletions(-) diff --git a/build.gradle b/build.gradle index 6a75535..6da6a06 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,16 @@ plugins { id 'eclipse' + id 'idea' id 'maven-publish' - id 'net.minecraftforge.gradle' version '5.1.+' + id 'net.minecraftforge.gradle' version '[6.0,6.2)' } -version = '1.0' -group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = 'modid' +version = mod_version +group = mod_group_id + +base { + archivesName = mod_id +} // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) @@ -26,9 +30,33 @@ minecraft { // // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@' + mappings channel: mapping_channel, version: mapping_version - // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. + // When true, this property will have all Eclipse run configurations run the "prepareX" task for the given run configuration before launching the game. + // In most cases, it is not necessary to enable. + // enableEclipsePrepareRuns = true + + // When true, this property will have all IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. + // In most cases, it is not necessary to enable. + // enableIdeaPrepareRuns = true + + // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game. + // It is REQUIRED to be set to true for this template to function. + // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html + copyIdeResources = true + + // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations. + // The folder name can be set on a run configuration using the "folderName" property. + // By default, the folder name of a run configuration is the name of the Gradle project containing it. + // generateRunFolders = true + + // This property enables access transformers for use in development. + // They will be applied to the Minecraft artifact. + // The access transformer file can be anywhere in the project. + // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge. + // This default location is a best practice to automatically put the file in the right place in the final jar. + // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information. + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. // These can be tweaked, removed, or duplicated as needed. @@ -49,10 +77,10 @@ minecraft { property 'forge.logging.console.level', 'debug' // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', 'examplemod' + property 'forge.enabledGameTestNamespaces', mod_id mods { - examplemod { + "${mod_id}" { source sourceSets.main } } @@ -65,10 +93,10 @@ minecraft { property 'forge.logging.console.level', 'debug' - property 'forge.enabledGameTestNamespaces', 'examplemod' + property 'forge.enabledGameTestNamespaces', mod_id mods { - examplemod { + "${mod_id}" { source sourceSets.main } } @@ -84,10 +112,10 @@ minecraft { property 'forge.logging.console.level', 'debug' - property 'forge.enabledGameTestNamespaces', 'examplemod' + property 'forge.enabledGameTestNamespaces', mod_id mods { - examplemod { + "${mod_id}" { source sourceSets.main } } @@ -101,10 +129,10 @@ minecraft { property 'forge.logging.console.level', 'debug' // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { - examplemod { + "${mod_id}" { source sourceSets.main } } @@ -119,39 +147,68 @@ repositories { // Put repositories for dependencies here // ForgeGradle automatically adds the Forge maven and Maven Central for you - // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver // flatDir { // dir 'libs' // } } dependencies { - // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed - // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. - // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@' + // Specify the version of Minecraft to use. + // Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact. + // The "userdev" classifier will be requested and setup by ForgeGradle. + // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], + // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. + minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - // Real mod deobf dependency examples - these get remapped to your current mappings - // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency + // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings + // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}") + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}") + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") - // Examples using mod jars from ./libs + // Example mod dependency using a mod jar from ./libs with a flat dir repository + // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar + // The group id is ignored when searching -- in this case, it is "blank" // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") - // For more info... + // For more info: // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } +// This block of code expands all declared replace properties in the specified resource targets. +// A missing property will result in an error. Properties are expanded using ${} Groovy notation. +// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. +// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html +def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta'] +def replaceProperties = [ + minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, + forge_version: forge_version, forge_version_range: forge_version_range, + loader_version_range: loader_version_range, + mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, + mod_authors: mod_authors, mod_description: mod_description +] +processResources { + inputs.properties replaceProperties + replaceProperties.put 'project', project + + filesMatching(resourceTargets) { + expand replaceProperties + } +} + // Example for how to get properties into the manifest for reading at runtime. jar { manifest { attributes([ - "Specification-Title" : "examplemod", - "Specification-Vendor" : "examplemodsareus", + "Specification-Title" : mod_id, + "Specification-Vendor" : mod_authors, "Specification-Version" : "1", // We are version 1 of ourselves "Implementation-Title" : project.name, "Implementation-Version" : project.jar.archiveVersion, - "Implementation-Vendor" : "examplemodsareus", + "Implementation-Vendor" : mod_authors, "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } diff --git a/gradle.properties b/gradle.properties index 878bf1f..f774ba3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,59 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false \ No newline at end of file +org.gradle.daemon=false + + +## Environment Properties + +# The Minecraft version must agree with the Forge version to get a valid artifact +minecraft_version=@MC_VERSION@ +# The Minecraft version range can use any release version of Minecraft as bounds. +# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly +# as they do not follow standard versioning conventions. +minecraft_version_range=[@MC_VERSION@,@MC_NEXT_VERSION@) +# The Forge version must agree with the Minecraft version to get a valid artifact +forge_version=@FORGE_VERSION@ +# The Forge version range can use any version of Forge as bounds or match the loader version range +forge_version_range=[@FORGE_SPEC_VERSION@,) +# The loader version range can only use the major version of Forge/FML as bounds +loader_version_range=[@FORGE_SPEC_VERSION@,) +# The mapping channel to use for mappings. +# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. +# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. +# +# | Channel | Version | | +# |-----------|----------------------|--------------------------------------------------------------------------------| +# | official | MCVersion | Official field/method names from Mojang mapping files | +# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official | +# +# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. +# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md +# +# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge. +# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started +mapping_channel=@MAPPING_CHANNEL@ +# The mapping version to query from the mapping channel. +# This must match the format required by the mapping channel. +mapping_version=@MAPPING_VERSION@ + + +## Mod Properties + +# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} +# Must match the String constant located in the main mod class annotated with @Mod. +mod_id=examplemod +# The human-readable display name for the mod. +mod_name=Example Mod +# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. +mod_license=All Rights Reserved +# The mod version. See https://semver.org/ +mod_version=1.0.0 +# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. +# This should match the base package used for the mod sources. +# See https://maven.apache.org/guides/mini/guide-naming-conventions.html +mod_group_id=com.example.examplemod +# The authors of the mod. This is a simple text string that is used for display purposes in the mod list. +mod_authors=YourNameHere, OtherNameHere +# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. +mod_description=Example mod description.\nNewline characters can be used and will be replaced properly. \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 3703f36..291d399 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,13 @@ pluginManagement { repositories { gradlePluginPortal() - maven { url = 'https://maven.minecraftforge.net/' } + maven { + name = 'MinecraftForge' + url = 'https://maven.minecraftforge.net/' + } } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' } \ No newline at end of file diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index 44199e6..d345370 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -2,16 +2,19 @@ package com.example.examplemod; import com.mojang.logging.LogUtils; import net.minecraft.client.Minecraft; +import net.minecraft.core.registries.Registries; +import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -36,12 +39,26 @@ public class ExampleMod public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); // Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); + // Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "examplemod" namespace + public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID); // Creates a new Block with the id "examplemod:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + public static final RegistryObject EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); // Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path public static final RegistryObject EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties())); + // Creates a new food item with the id "examplemod:example_id", nutrition 1 and saturation 2 + public static final RegistryObject EXAMPLE_ITEM = ITEMS.register("example_item", () -> new Item(new Item.Properties().food(new FoodProperties.Builder() + .alwaysEat().nutrition(1).saturationMod(2f).build()))); + + // Creates a creative tab with the id "examplemod:example_tab" for the example item, that is placed after the combat tab + public static final RegistryObject EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder() + .withTabsBefore(CreativeModeTabs.COMBAT) + .icon(() -> EXAMPLE_ITEM.get().getDefaultInstance()) + .displayItems((parameters, output) -> { + output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event + }).build()); + public ExampleMod() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); @@ -53,6 +70,8 @@ public class ExampleMod BLOCKS.register(modEventBus); // Register the Deferred Register to the mod event bus so items get registered ITEMS.register(modEventBus); + // Register the Deferred Register to the mod event bus so tabs get registered + CREATIVE_MODE_TABS.register(modEventBus); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); @@ -68,9 +87,10 @@ public class ExampleMod LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + // Add the example block item to the building blocks tab + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(EXAMPLE_BLOCK_ITEM); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index dfdb038..3f5f56d 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,32 +6,30 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[@FORGE_SPEC_VERSION@,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. -license="All rights reserved" +license="${mod_license}" # A URL to refer people to when problems occur with this mod #issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod -modId="examplemod" #mandatory -# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it -# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata -# see the associated build.gradle script for how to populate this completely automatically during a build -version="${file.jarVersion}" #mandatory - # A display name for the mod -displayName="Example Mod" #mandatory +modId="${mod_id}" #mandatory +# The version number of the mod +version="${mod_version}" #mandatory +# A display name for the mod +displayName="${mod_name}" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/ #updateJSONURL="https://change.me.example.invalid/updates.json" #optional # A URL for the "homepage" for this mod, displayed in the mod UI #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional # A file name (in the root of the mod JAR) containing a logo for display -logoFile="examplemod.png" #optional +#logoFile="examplemod.png" #optional # A text field displayed in the mod UI -credits="Thanks for this example mod goes to Java" #optional +#credits="" #optional # A text field displayed in the mod UI -authors="Love, Cheese and small house plants" #optional +authors="${mod_authors}" #optional # Display Test controls the display for your mod in the server connection screen # MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. # IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. @@ -41,30 +39,26 @@ authors="Love, Cheese and small house plants" #optional #displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) # The description text for the mod (multi line!) (#mandatory) -description=''' -This is a long form description of the mod. You can write whatever you want here - -Have some lorem ipsum. - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. -''' +description='''${mod_description}''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies.examplemod]] #optional +[[dependencies.${mod_id}]] #optional # the modid of the dependency modId="forge" #mandatory # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[@FORGE_SPEC_VERSION@,)" #mandatory - # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory + versionRange="${forge_version_range}" #mandatory + # An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory + # BEFORE - This mod is loaded BEFORE the dependency + # AFTER - This mod is loaded AFTER the dependency ordering="NONE" - # Side this dependency is applied on - BOTH, CLIENT or SERVER + # Side this dependency is applied on - BOTH, CLIENT, or SERVER side="BOTH" # Here's another dependency -[[dependencies.examplemod]] +[[dependencies.${mod_id}]] modId="minecraft" mandatory=true -# This version range declares a minimum of the current minecraft version up to but not including the next major version - versionRange="[@MC_VERSION@,@MC_NEXT_VERSION@)" + # This version range declares a minimum of the current minecraft version up to but not including the next major version + versionRange="${minecraft_version_range}" ordering="NONE" side="BOTH" From 9b6e4991b6ccf8bd15d3106083c83854765db234 Mon Sep 17 00:00:00 2001 From: Paint_Ninja Date: Tue, 27 Jun 2023 12:56:42 +0100 Subject: [PATCH 84/90] Lazily configure MDK tasks, improve IDE support (#9592) --- build.gradle | 53 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 6da6a06..0995112 100644 --- a/build.gradle +++ b/build.gradle @@ -182,47 +182,48 @@ dependencies { // A missing property will result in an error. Properties are expanded using ${} Groovy notation. // When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta'] -def replaceProperties = [ - minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, - forge_version: forge_version, forge_version_range: forge_version_range, - loader_version_range: loader_version_range, - mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, - mod_authors: mod_authors, mod_description: mod_description -] -processResources { +tasks.named('processResources', ProcessResources).configure { + var replaceProperties = [ + minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, + forge_version: forge_version, forge_version_range: forge_version_range, + loader_version_range: loader_version_range, + mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, + mod_authors: mod_authors, mod_description: mod_description, + ] inputs.properties replaceProperties - replaceProperties.put 'project', project - filesMatching(resourceTargets) { - expand replaceProperties + filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { + expand replaceProperties + [project: project] } } // Example for how to get properties into the manifest for reading at runtime. -jar { +tasks.named('jar', Jar).configure { manifest { attributes([ - "Specification-Title" : mod_id, - "Specification-Vendor" : mod_authors, - "Specification-Version" : "1", // We are version 1 of ourselves - "Implementation-Title" : project.name, - "Implementation-Version" : project.jar.archiveVersion, - "Implementation-Vendor" : mod_authors, - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + 'Specification-Title' : mod_id, + 'Specification-Vendor' : mod_authors, + 'Specification-Version' : '1', // We are version 1 of ourselves + 'Implementation-Title' : project.name, + 'Implementation-Version' : project.jar.archiveVersion, + 'Implementation-Vendor' : mod_authors, + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } + + // This is the preferred method to reobfuscate your jar file + finalizedBy 'reobfJar' } -// Example configuration to allow publishing using the maven-publish plugin -// This is the preferred method to reobfuscate your jar file -jar.finalizedBy('reobfJar') -// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing -// publish.dependsOn('reobfJar') +// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing: +// tasks.named('publish').configure { +// dependsOn 'reobfJar' +// } +// Example configuration to allow publishing using the maven-publish plugin publishing { publications { - mavenJava(MavenPublication) { + register('mavenJava', MavenPublication) { artifact jar } } From 3ea735a9018bf94f77f3b82bdd368c6cd1d0c607 Mon Sep 17 00:00:00 2001 From: Paint_Ninja Date: Tue, 27 Jun 2023 12:56:58 +0100 Subject: [PATCH 85/90] Reduce verbosity of prepareRuns doc in MDK (#9593) --- build.gradle | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 0995112..c3b2c93 100644 --- a/build.gradle +++ b/build.gradle @@ -32,12 +32,9 @@ minecraft { // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: mapping_channel, version: mapping_version - // When true, this property will have all Eclipse run configurations run the "prepareX" task for the given run configuration before launching the game. + // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. // In most cases, it is not necessary to enable. // enableEclipsePrepareRuns = true - - // When true, this property will have all IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. - // In most cases, it is not necessary to enable. // enableIdeaPrepareRuns = true // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game. From 7e52cbf56aad127bd5e543cda9138041c00bcd04 Mon Sep 17 00:00:00 2001 From: Paint_Ninja Date: Tue, 27 Jun 2023 12:57:08 +0100 Subject: [PATCH 86/90] Demonstrate configureEach in run configs (#9594) --- build.gradle | 49 ++++++++++--------------------------------------- 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/build.gradle b/build.gradle index c3b2c93..5fa3a32 100644 --- a/build.gradle +++ b/build.gradle @@ -58,7 +58,8 @@ minecraft { // Default run configurations. // These can be tweaked, removed, or duplicated as needed. runs { - client { + // applies to all the run configs below + configureEach { workingDirectory project.file('run') // Recommended logging data for a userdev environment @@ -73,9 +74,6 @@ minecraft { // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', mod_id - mods { "${mod_id}" { source sourceSets.main @@ -83,56 +81,29 @@ minecraft { } } - server { - workingDirectory project.file('run') - - property 'forge.logging.markers', 'REGISTRIES' - - property 'forge.logging.console.level', 'debug' - + client { + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id + } - mods { - "${mod_id}" { - source sourceSets.main - } - } + server { + property 'forge.enabledGameTestNamespaces', mod_id + args '--nogui' } // This run config launches GameTestServer and runs all registered gametests, then exits. // By default, the server will crash when no gametests are provided. // The gametest system is also enabled by default for other run configs under the /test command. gameTestServer { - workingDirectory project.file('run') - - property 'forge.logging.markers', 'REGISTRIES' - - property 'forge.logging.console.level', 'debug' - property 'forge.enabledGameTestNamespaces', mod_id - - mods { - "${mod_id}" { - source sourceSets.main - } - } } data { - workingDirectory project.file('run') - - property 'forge.logging.markers', 'REGISTRIES' - - property 'forge.logging.console.level', 'debug' + // example of overriding the workingDirectory set in configureEach above + workingDirectory project.file('run-data') // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - - mods { - "${mod_id}" { - source sourceSets.main - } - } } } } From 6d6d2a37322c9918b30e0d114e8dff2d8fb111a5 Mon Sep 17 00:00:00 2001 From: Paint_Ninja Date: Tue, 27 Jun 2023 12:57:20 +0100 Subject: [PATCH 87/90] Add example usage for configs to the MDK (#9596) Demonstrates proper usage of different config value types, validation, transformation/parsing, load/reload handling and direct field access. --- .../java/com/example/examplemod/Config.java | 64 +++++++++++++++++++ .../com/example/examplemod/ExampleMod.java | 13 +++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/example/examplemod/Config.java diff --git a/src/main/java/com/example/examplemod/Config.java b/src/main/java/com/example/examplemod/Config.java new file mode 100644 index 0000000..0ac7934 --- /dev/null +++ b/src/main/java/com/example/examplemod/Config.java @@ -0,0 +1,64 @@ +package com.example.examplemod; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.config.ModConfigEvent; +import net.minecraftforge.registries.ForgeRegistries; + +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +// An example config class. This is not required, but it's a good idea to have one to keep your config organized. +// Demonstrates how to use Forge's config APIs +@Mod.EventBusSubscriber(modid = ExampleMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) +public class Config +{ + private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); + + private static final ForgeConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER + .comment("Whether to log the dirt block on common setup") + .define("logDirtBlock", true); + + private static final ForgeConfigSpec.IntValue MAGIC_NUMBER = BUILDER + .comment("A magic number") + .defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE); + + public static final ForgeConfigSpec.ConfigValue MAGIC_NUMBER_INTRODUCTION = BUILDER + .comment("What you want the introduction message to be for the magic number") + .define("magicNumberIntroduction", "The magic number is... "); + + // a list of strings that are treated as resource locations for items + private static final ForgeConfigSpec.ConfigValue> ITEM_STRINGS = BUILDER + .comment("A list of items to log on common setup.") + .defineListAllowEmpty(Collections.singletonList("items"), () -> List.of("minecraft:iron_ingot"), Config::validateItemName); + + static final ForgeConfigSpec SPEC = BUILDER.build(); + + public static boolean logDirtBlock; + public static int magicNumber; + public static String magicNumberIntroduction; + public static Set items; + + private static boolean validateItemName(final Object obj) + { + return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(new ResourceLocation(itemName)); + } + + @SubscribeEvent + static void onLoad(final ModConfigEvent event) + { + logDirtBlock = LOG_DIRT_BLOCK.get(); + magicNumber = MAGIC_NUMBER.get(); + magicNumberIntroduction = MAGIC_NUMBER_INTRODUCTION.get(); + + // convert the list of strings into a set of items + items = ITEM_STRINGS.get().stream() + .map(itemName -> ForgeRegistries.ITEMS.getValue(new ResourceLocation(itemName))) + .collect(Collectors.toSet()); + } +} diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index d345370..990fd63 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -18,7 +18,9 @@ import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -78,13 +80,22 @@ public class ExampleMod // Register the item to a creative tab modEventBus.addListener(this::addCreative); + + // Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us + ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); } private void commonSetup(final FMLCommonSetupEvent event) { // Some common setup code LOGGER.info("HELLO FROM COMMON SETUP"); - LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); + + if (Config.logDirtBlock) + LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); + + LOGGER.info(Config.magicNumberIntroduction + Config.magicNumber); + + Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString())); } // Add the example block item to the building blocks tab From e6da5218b5abef213fc38ea87e9b8bd691a9a771 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 28 Jun 2023 22:27:59 -0400 Subject: [PATCH 88/90] Try and be a bit nicer about handling bad [feature] definitions (#9606) * Try and be a bit nicer about handling bad [feature] definitions - they're single square bracket defined and require strings for feature bound values. * Some more tweaks to the feature system to output useful and well formatted error messages when bounds fail. Requires SPI 7.0.1 and the language string "fml.modloading.feature.missing" has changed. * Use immutable lists where possible and generally tidy things a bit --- src/main/resources/META-INF/mods.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 3f5f56d..95e8668 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -62,3 +62,9 @@ description='''${mod_description}''' versionRange="${minecraft_version_range}" ordering="NONE" side="BOTH" + +# Features are specific properties of the game environment, that you may want to declare you require. This example declares +# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't +# stop your mod loading on the server for example. +#[features.${mod_id}] +#openGLVersion="[3.2,)" \ No newline at end of file From 53b67cc1b381f188b4eb6132605a4d136d7dfd88 Mon Sep 17 00:00:00 2001 From: Thomas Kain Date: Mon, 3 Jul 2023 20:28:37 -0400 Subject: [PATCH 89/90] Make overloads consistent for defineListAllowEmpty in ForgeConfigSpec.Builder (#9604) --- src/main/java/com/example/examplemod/Config.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/example/examplemod/Config.java b/src/main/java/com/example/examplemod/Config.java index 0ac7934..4601345 100644 --- a/src/main/java/com/example/examplemod/Config.java +++ b/src/main/java/com/example/examplemod/Config.java @@ -35,7 +35,7 @@ public class Config // a list of strings that are treated as resource locations for items private static final ForgeConfigSpec.ConfigValue> ITEM_STRINGS = BUILDER .comment("A list of items to log on common setup.") - .defineListAllowEmpty(Collections.singletonList("items"), () -> List.of("minecraft:iron_ingot"), Config::validateItemName); + .defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName); static final ForgeConfigSpec SPEC = BUILDER.build(); From 5302c74d241e468f2f56e88c2105e75c76337b70 Mon Sep 17 00:00:00 2001 From: Marc Hermans Date: Sun, 9 Jul 2023 19:12:25 +0200 Subject: [PATCH 90/90] Update to NeoForged --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 291d399..d6db1d7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,7 +3,7 @@ pluginManagement { gradlePluginPortal() maven { name = 'MinecraftForge' - url = 'https://maven.minecraftforge.net/' + url = 'https://maven.neoforged.net/releases' } } }