Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Gradle boilerplate #82

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mod/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "0.11.0-SNAPSHOT" apply false
id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false
}

architectury {
Expand All @@ -16,6 +16,11 @@ subprojects {
loom {
silentMojangMappingsLicense()
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.officialMojangMappings()
}
}

allprojects {
Expand Down
6 changes: 1 addition & 5 deletions mod/common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ dependencies {
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"

minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.officialMojangMappings()



// https://modrinth.com/mod/voxelmap-updated/version/1.18.2-1.11.2 (1.11.2 fabric)
Expand All @@ -22,8 +19,7 @@ dependencies {
}

architectury {
injectInjectables = false
common()
common(rootProject.enabled_platforms.split(","))
}

tasks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public MapSyncMod() {
*/
public abstract String getVersion();

protected abstract boolean isDevMode();

public abstract void registerKeyBinding(KeyMapping mapping);

public void init() {
Expand Down
9 changes: 3 additions & 6 deletions mod/fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
id "com.github.johnrengelman.shadow" version "7.1.2"
}

architectury {
Expand All @@ -22,9 +22,6 @@ dependencies {
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }

minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.officialMojangMappings()



// https://modrinth.com/mod/voxelmap-updated/version/1.18.2-1.11.2 (1.11.2 fabric)
Expand Down Expand Up @@ -84,13 +81,13 @@ publishing {
}
}

task cleanJar(type: Delete) {
tasks.register('cleanJar', Delete) {
delete fileTree('../dist') {
include "*-fabric.jar"
}
}

task copyJar(type: Copy) {
tasks.register('copyJar', Copy) {
from remapJar
into '../dist'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.KeyMapping;

public class FabricMapSyncMod extends MapSyncMod implements ClientModInitializer {
Expand All @@ -24,6 +25,11 @@ public String getVersion() {
return VERSION + "+fabric";
}

@Override
protected boolean isDevMode() {
return FabricLoader.getInstance().isDevelopmentEnvironment();
}

@Override
public void registerKeyBinding(KeyMapping mapping) {
KeyBindingHelper.registerKeyBinding(mapping);
Expand Down
11 changes: 4 additions & 7 deletions mod/forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
id "com.github.johnrengelman.shadow" version "7.1.2"
}

architectury {
Expand All @@ -22,14 +22,11 @@ configurations {
}

dependencies {
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
forge "net.minecraftforge:forge:${rootProject.forge_version}"

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }

minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.officialMojangMappings()



// https://modrinth.com/mod/journeymap/version/1.18.2-5.9.7-forge (5.9.7 forge)
Expand Down Expand Up @@ -89,13 +86,13 @@ publishing {
}
}

task cleanJar(type: Delete) {
tasks.register('cleanJar', Delete) {
delete fileTree('../dist') {
include "*-forge.jar"
}
}

task copyJar(type: Copy) {
tasks.register('copyJar', Copy) {
from remapJar
into '../dist'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLLoader;

@Mod("mapsync")
public class ForgeMapSyncMod extends MapSyncMod {
Expand All @@ -22,6 +23,11 @@ public String getVersion() {
return VERSION + "+forge";
}

@Override
protected boolean isDevMode() {
return !FMLLoader.isProduction();
}

public void clientSetup(FMLClientSetupEvent event) {
init();
}
Expand Down
10 changes: 5 additions & 5 deletions mod/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
org.gradle.jvmargs=-Xmx2048M

maven_group=gjum.minecraft.mapsync
archives_base_name=map-sync

maven_group=gjum.minecraft.mapsync
mod_version=2.0.1-1.18.2

minecraft_version=1.18.2
enabled_platforms=fabric,forge

# https://fabricmc.net/versions.html
fabric_loader_version=0.13.3
fabric_api_version=0.51.1+1.18.2
fabric_loader_version=0.14.9
fabric_api_version=0.58.0+1.18.2
Gjum marked this conversation as resolved.
Show resolved Hide resolved

forge_version=40.1.19
forge_version=1.18.2-40.1.73