diff --git a/build.gradle b/build.gradle index b628e58..b240eca 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ import java.nio.charset.StandardCharsets import java.time.Year plugins { - id "fabric-loom" version "0.2.0-SNAPSHOT" + id "fabric-loom" version "0.2.4-SNAPSHOT" id "com.matthewprenger.cursegradle" version "1.1.2" id "net.minecrell.licenser" version "0.2.1" id "maven-publish" @@ -10,13 +10,17 @@ plugins { sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 -group = "com.github.GlassPane" -archivesBaseName = "Fabric-Base-Mod" +group = project.maven_group +archivesBaseName = project.name version = System.getenv("TRAVIS_TAG") ?: project.mod_version println("Setting version: " + version) apply from: "https://raw.githubusercontent.com/NerdHubMC/Gradle-Scripts/master/scripts/fabric/basic_project.gradle" -apply from: "https://raw.githubusercontent.com/NerdHubMC/Gradle-Scripts/master/scripts/fabric/dependencies/development_suite.gradle" +try { + apply from: "https://raw.githubusercontent.com/NerdHubMC/Gradle-Scripts/master/scripts/fabric/dependencies/${minecraft_version}/development_suite.gradle" +} catch (MissingResourceException e) { + System.err.println(e.message) +} processResources { // this will ensure that this task is redone when there"s a change @@ -27,8 +31,9 @@ processResources { include "fabric.mod.json" // add mod metadata - expand "version": project.version /*, "changelog_url": project.changelog_url, - "curseforge_id": project.curseforge_id, "license": project.license_header*/ + expand "version": project.version , //"changelog_url": project.changelog_url, + "curseforge_id": project.curseforge_id, "license": project.license_header, + "mod_name": project.mod_name filter { String line -> line.replace("\"fabric\": \"*\"", "\"fabric\": \"[${project.fabric_version},)\"") @@ -59,30 +64,34 @@ repositories { dependencies { minecraft "com.mojang:minecraft:${minecraft_version}" mappings "net.fabricmc:yarn:${yarn_mappings}" - modCompile "net.fabricmc:fabric-loader:${loader_version}" + modImplementation "net.fabricmc:fabric-loader:${loader_version}" - modCompile "com.github.GlassPane:Mesh:${mesh_version}" + modApi "com.github.GlassPane:Mesh:${mesh_version}" //optional dependency! - modCompile "net.fabricmc:fabric:${fabric_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" } license { - header = file("code_quality/${project.license_header}_HEADER.txt") + header = rootProject.file("code_quality/${project.license_header}_HEADER.txt") + // Apply licenses only to main source set sourceSets = [project.sourceSets.main] include "**/*.java" - charset = StandardCharsets.UTF_8.name() - style { - java = "BLOCK_COMMENT" - } newLine = false // Disables the empty line between the header and package name //ignoreFailures = true //Ignore failures and only print a warning on license violations //export variables ext { year = Year.now() - projectDisplayName = project.archivesBaseName + projectDisplayName = project.name + projectOwners = rootProject.owners + if (project.license_header.contains('GPL')) { + if (!project.hasProperty("gpl_version")) { + throw new RuntimeException("GPL version needs to be specified through the 'gpl_version' property") + } + gplVersion = project.gpl_version + } } } diff --git a/code_quality/GPL_HEADER.txt b/code_quality/GPL_HEADER.txt new file mode 100644 index 0000000..e24396f --- /dev/null +++ b/code_quality/GPL_HEADER.txt @@ -0,0 +1,15 @@ +${projectDisplayName} +Copyright (C) ${year} ${projectOwners} + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version ${gplVersion} of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . \ No newline at end of file diff --git a/code_quality/LGPL_HEADER.txt b/code_quality/LGPL_HEADER.txt new file mode 100644 index 0000000..bd60220 --- /dev/null +++ b/code_quality/LGPL_HEADER.txt @@ -0,0 +1,15 @@ +${projectDisplayName} +Copyright (C) ${year} ${projectOwners} + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version ${gplVersion} of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program; If not, see . \ No newline at end of file diff --git a/code_quality/MIT_HEADER.txt b/code_quality/MIT_HEADER.txt index 56234e0..39cd31d 100644 --- a/code_quality/MIT_HEADER.txt +++ b/code_quality/MIT_HEADER.txt @@ -1,5 +1,5 @@ ${projectDisplayName} -Copyright (C) ${year} GlassPane +Copyright (C) ${year} ${projectOwners} Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/gradle.properties b/gradle.properties index 2d31eb5..6fb9eb6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,30 @@ -#General -#see https://modmuss50.me/fabric.html -minecraft_version=19w09a -yarn_mappings=19w09a.2 -loader_version=0.3.7.109 +# General +# see https://modmuss50.me/fabric.html +minecraft_version=1.14.2 +yarn_mappings=1.14.2+build.7 +loader_version=0.4.8+build.155 #Fabric api -fabric_version=0.2.3.108 +fabric_version=0.3.0+build.181 -#Publishing +# Base properties +mod_name = Fabric Base Mod mod_version = 1.0.0-SNAPSHOT -license_header = MIT -#curseforge_id = -release_type = release +owners = GlassPane +maven_group = io.github.GlassPane #Other Dependencies mesh_version = 1.0.0-SNAPSHOT +#Publishing +license_header = MIT +# FIXME set to the project's actual id +curseforge_id = xxx +curseforge_versions = 1.14; 1.14.1; 1.14.2 +release_type = release + +# 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 = -Xmx2G + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 44e7c4d..b652880 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,3 +1,4 @@ +#Sun May 12 13:31:56 CEST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip diff --git a/settings.gradle b/settings.gradle index 096af1a..8f50f2f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,4 +8,4 @@ pluginManagement { gradlePluginPortal() } } -rootProject.name = 'Fabric-Base-Mod' +rootProject.name = mod_name.replace(' ', '-') diff --git a/src/main/java/com/github/glasspane/basemod/mixin/client/package-info.java b/src/main/java/com/github/glasspane/basemod/mixin/client/package-info.java deleted file mode 100644 index 1a52b4e..0000000 --- a/src/main/java/com/github/glasspane/basemod/mixin/client/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.github.glasspane.basemod.mixin.client; \ No newline at end of file diff --git a/src/main/java/com/github/glasspane/basemod/mixin/common/package-info.java b/src/main/java/com/github/glasspane/basemod/mixin/common/package-info.java deleted file mode 100644 index d2f0bf1..0000000 --- a/src/main/java/com/github/glasspane/basemod/mixin/common/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.github.glasspane.basemod.mixin.common; \ No newline at end of file diff --git a/src/main/java/com/github/glasspane/basemod/BaseMod.java b/src/main/java/io/github/glasspane/basemod/BaseMod.java similarity index 86% rename from src/main/java/com/github/glasspane/basemod/BaseMod.java rename to src/main/java/io/github/glasspane/basemod/BaseMod.java index 21123d5..dad299b 100644 --- a/src/main/java/com/github/glasspane/basemod/BaseMod.java +++ b/src/main/java/io/github/glasspane/basemod/BaseMod.java @@ -1,4 +1,4 @@ -package com.github.glasspane.basemod; +package io.github.glasspane.basemod; import com.github.glasspane.mesh.api.annotation.CalledByReflection; import net.fabricmc.api.ModInitializer; diff --git a/src/main/java/io/github/glasspane/basemod/mixin/client/package-info.java b/src/main/java/io/github/glasspane/basemod/mixin/client/package-info.java new file mode 100644 index 0000000..2b18d80 --- /dev/null +++ b/src/main/java/io/github/glasspane/basemod/mixin/client/package-info.java @@ -0,0 +1 @@ +package io.github.glasspane.basemod.mixin.client; \ No newline at end of file diff --git a/src/main/java/io/github/glasspane/basemod/mixin/common/package-info.java b/src/main/java/io/github/glasspane/basemod/mixin/common/package-info.java new file mode 100644 index 0000000..bbc588a --- /dev/null +++ b/src/main/java/io/github/glasspane/basemod/mixin/common/package-info.java @@ -0,0 +1 @@ +package io.github.glasspane.basemod.mixin.common; \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index a89062b..b1577f7 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,18 +1,33 @@ { + "schemaVersion": 1, "id": "fabric_base_mod", - "name": "Fabric Base Mod", + "name": "${mod_name}", "description": "Basic Mod Template for Fabric Mods", "version": "${version}", - "side": "universal", - "initializers": [ - "com.github.glasspane.basemod.BaseMod" + "license": "${license}", + + "environment": "*", + "entrypoints": { + "client": [ + + ], + "main": [ + "io.github.glasspane.basemod.BaseMod" + ] + }, + "mixins": [ + { + "environment": "client", + "config": "mixins.base_mod.client.json" + }, + { + "environment": "*", + "config": "mixins.base_mod.common.json" + } ], - "requires": { + + "depends": { "fabric": "*", "mesh": "*" - }, - "mixins": { - "client": "base_mod.client.json", - "common": "base_mod.common.json" } } diff --git a/src/main/resources/base_mod.client.json b/src/main/resources/mixins.base_mod.client.json similarity index 59% rename from src/main/resources/base_mod.client.json rename to src/main/resources/mixins.base_mod.client.json index e6b4d13..1d44d2f 100644 --- a/src/main/resources/base_mod.client.json +++ b/src/main/resources/mixins.base_mod.client.json @@ -1,9 +1,9 @@ { "required": true, - "package": "com.github.glasspane.basemod.mixin.client", + "package": "io.github.glasspane.basemod.mixin.client", "compatibilityLevel": "JAVA_8", "mixins": [ - "MixinItemModels" + ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/base_mod.common.json b/src/main/resources/mixins.base_mod.common.json similarity index 53% rename from src/main/resources/base_mod.common.json rename to src/main/resources/mixins.base_mod.common.json index eb03d5d..c0c786a 100644 --- a/src/main/resources/base_mod.common.json +++ b/src/main/resources/mixins.base_mod.common.json @@ -1,10 +1,9 @@ { "required": true, - "package": "com.github.glasspane.basemod.mixin.common", + "package": "io.github.glasspane.basemod.mixin.common", "compatibilityLevel": "JAVA_8", "mixins": [ - "MixinLivingEntity", - "MixinMobEntity" + ], "injectors": { "defaultRequire": 1