diff --git a/Common/build.gradle b/Common/build.gradle index b41a286..a40cf38 100644 --- a/Common/build.gradle +++ b/Common/build.gradle @@ -1,22 +1,21 @@ plugins { - id("java") - id("org.spongepowered.gradle.vanilla") version "0.2" + id('java') + id('org.spongepowered.gradle.vanilla') version '0.2.1-SNAPSHOT' } -archivesBaseName = mod_name -version = "common-${minecraft_version}-${mod_version}" -group = mod_group +archivesBaseName = "${mod_name}-common-${minecraft_version}" repositories { mavenCentral() } minecraft { - version(minecraft_version) // or: latestRelease() or latestSnapshot() - runs { - server() - client() + version(minecraft_version) + runs { + if (project.hasProperty('common_runs_enabled') ? project.findProperty('common_runs_enabled').toBoolean() : true) { + + server(project.hasProperty('common_server_run_name') ? project.findProperty('common_server_run_name') : 'vanilla_server') {} + client(project.hasProperty('common_client_run_name') ? project.findProperty('common_client_run_name') : 'vanilla_client') {} + } } -} -dependencies { -} +} \ No newline at end of file diff --git a/Common/src/main/java/com/blamejared/stuff/Constants.java b/Common/src/main/java/com/blamejared/stuff/Constants.java new file mode 100644 index 0000000..4090578 --- /dev/null +++ b/Common/src/main/java/com/blamejared/stuff/Constants.java @@ -0,0 +1,11 @@ +package com.blamejared.stuff; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class Constants { + + public static final String MOD_ID = "multiloader"; + public static final String MOD_NAME = "MultiLoader"; + public static final Logger LOG = LogManager.getLogger(MOD_NAME); +} diff --git a/Common/src/main/resources/pack.mcmeta b/Common/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..f6c7916 --- /dev/null +++ b/Common/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "${mod_name}", + "pack_format": 6, + } +} \ No newline at end of file diff --git a/Fabric/build.gradle b/Fabric/build.gradle index 03d6b59..2374c76 100644 --- a/Fabric/build.gradle +++ b/Fabric/build.gradle @@ -4,12 +4,7 @@ plugins { id 'idea' } -sourceCompatibility = JavaVersion.VERSION_16 -targetCompatibility = JavaVersion.VERSION_16 - -archivesBaseName = mod_name -version = "fabric-${minecraft_version}-${mod_version}" -group = mod_group +archivesBaseName = "${mod_name}-fabric-${minecraft_version}" repositories { } diff --git a/Forge/build.gradle b/Forge/build.gradle index bd7fc0a..93aa82a 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -12,11 +12,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -archivesBaseName = mod_name -version = "forge-${minecraft_version}-${mod_version}" -group = mod_group - -java.toolchain.languageVersion = JavaLanguageVersion.of(16) +archivesBaseName = "${mod_name}-forge-${minecraft_version}" minecraft { mappings channel: 'official', version: minecraft_version @@ -94,7 +90,6 @@ jar { } } - jar.finalizedBy('reobfJar') publishing { diff --git a/Forge/src/main/java/com/example/examplemod/ExampleMod.java b/Forge/src/main/java/com/example/examplemod/ExampleMod.java index 21418c1..8d3cd7d 100644 --- a/Forge/src/main/java/com/example/examplemod/ExampleMod.java +++ b/Forge/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,23 +1,25 @@ package com.example.examplemod; -import net.minecraft.world.level.block.*; +import java.util.stream.Collectors; + +import com.blamejared.stuff.Constants; + +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.*; +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.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; -import org.apache.logging.log4j.*; -import java.util.stream.Collectors; - -@Mod("examplemod") +@Mod(Constants.MOD_ID) public class ExampleMod { - private static final Logger LOGGER = LogManager.getLogger(); - public ExampleMod() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); @@ -29,22 +31,22 @@ public class ExampleMod { private void setup(final FMLCommonSetupEvent event) { - LOGGER.info("HELLO FROM PREINIT"); - LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); + Constants.LOG.info("HELLO FROM PREINIT"); + Constants.LOG.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); CommonClass.init(); } private void enqueueIMC(final InterModEnqueueEvent event) { InterModComms.sendTo("examplemod", "helloworld", () -> { - LOGGER.info("Hello world from the MDK"); + Constants.LOG.info("Hello world from the MDK"); return "Hello world"; }); } private void processIMC(final InterModProcessEvent event) { - LOGGER.info("Got IMC {}", event.getIMCStream() + Constants.LOG.info("Got IMC {}", event.getIMCStream() .map(m -> m.messageSupplier().get()) .collect(Collectors.toList())); } @@ -52,7 +54,7 @@ public class ExampleMod { @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { - LOGGER.info("HELLO from server starting"); + Constants.LOG.info("HELLO from server starting"); } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) @@ -61,7 +63,7 @@ public class ExampleMod { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { // register a new block here - LOGGER.info("HELLO from Register Block"); + Constants.LOG.info("HELLO from Register Block"); } } diff --git a/Forge/src/main/resources/META-INF/mods.toml b/Forge/src/main/resources/META-INF/mods.toml index 1b3f5eb..0c620ed 100644 --- a/Forge/src/main/resources/META-INF/mods.toml +++ b/Forge/src/main/resources/META-INF/mods.toml @@ -15,7 +15,7 @@ license="All rights reserved" # 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 +modId="multiloader" #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 @@ -27,7 +27,7 @@ displayName="Example Mod" #mandatory # 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="multiloader.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 @@ -41,7 +41,7 @@ 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 +[[dependencies.multiloader]] #optional # the modid of the dependency modId="forge" #mandatory # Does this dependency have to exist - if not, ordering below must be specified @@ -53,7 +53,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn # Side this dependency is applied on - BOTH, CLIENT or SERVER side="BOTH" # Here's another dependency -[[dependencies.examplemod]] +[[dependencies.multiloader]] modId="minecraft" mandatory=true # This version range declares a minimum of the current minecraft version up to but not including the next major version diff --git a/Forge/src/main/resources/pack.mcmeta b/Forge/src/main/resources/pack.mcmeta deleted file mode 100644 index c79a362..0000000 --- a/Forge/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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." - } -} diff --git a/build.gradle b/build.gradle index e69de29..53bd109 100644 --- a/build.gradle +++ b/build.gradle @@ -0,0 +1,25 @@ +subprojects { + + apply plugin: 'java' + + java.toolchain.languageVersion = JavaLanguageVersion.of(16) + java.withSourcesJar() + java.withJavadocJar() + + jar { + manifest { + attributes([ + 'Specification-Title' : mod_name, + 'Specification-Vendor' : mod_author, + 'Specification-Version' : project.jar.archiveVersion, + 'Implementation-Title' : project.name, + 'Implementation-Version' : project.jar.archiveVersion, + 'Implementation-Vendor' : mod_author, + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + 'Timestampe' : System.currentTimeMillis(), + 'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", + 'Build-On-Minecraft' : minecraft_version + ]) + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 709b189..b6b301a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,7 @@ +# Project +version=1.0.0 +group=com.blamejared.multiloader + # Common minecraft_version=1.17.1 @@ -10,8 +14,6 @@ fabric_version=0.40.1+1.17 fabric_loader_version=0.11.7 # Mod options -mod_group=com.blamejared.multiloader -mod_version=1.0.0 mod_name=MultiLoader mod_author=Jared mod_id=multiloader diff --git a/settings.gradle b/settings.gradle index 7a53df1..174e944 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,14 @@ pluginManagement { repositories { + gradlePluginPortal() maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' } - gradlePluginPortal() + maven { + name = 'Sponge Snapshots' + url = 'https://repo.spongepowered.org/repository/maven-public/' + } } }