update build environment

fix forge thinking the mod would be required server side
This commit is contained in:
2022-02-03 11:48:27 +01:00
parent 97a89ab403
commit 2f025fbd06
5 changed files with 32 additions and 93 deletions
+11 -60
View File
@@ -1,11 +1,10 @@
buildscript { buildscript {
repositories { repositories {
maven { url = 'https://files.minecraftforge.net/maven' } maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral() mavenCentral()
} }
dependencies { 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' apply plugin: 'net.minecraftforge.gradle'
@@ -13,38 +12,25 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
version = '1.0.2' version = '1.0.3'
group = 'de.skate702.craftingkeys' // http://maven.apache.org/guides/mini/guide-naming-conventions.html group = 'de.skate702.craftingkeys' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'craftingkeys' archivesBaseName = 'craftingkeys'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava.options.encoding = "UTF-8"
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 { 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 always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20201028-1.16.3' mappings channel: 'snapshot', version: '20201028-1.16.3'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs { runs {
client { client {
workingDirectory project.file('run') workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console // Recommended logging level for the console
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
mods { mods {
examplemod { craftingkeys {
source sourceSets.main source sourceSets.main
} }
} }
@@ -53,14 +39,11 @@ minecraft {
server { server {
workingDirectory project.file('run') workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console // Recommended logging level for the console
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
mods { mods {
examplemod { craftingkeys {
source sourceSets.main source sourceSets.main
} }
} }
@@ -69,17 +52,11 @@ minecraft {
data { data {
workingDirectory project.file('run') workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console // Recommended logging level for the console
property 'forge.logging.console.level', 'debug' 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/')
mods { mods {
examplemod { craftingkeys {
source sourceSets.main source sourceSets.main
} }
} }
@@ -91,51 +68,25 @@ minecraft {
sourceSets.main.resources { srcDir 'src/generated/resources' } sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies { dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed minecraft 'net.minecraftforge:forge:1.16.5-36.2.20'
// 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 'net.minecraftforge:forge:1.16.4-35.1.37'
// 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 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'
// 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 by the runtime..
jar { jar {
manifest { manifest {
attributes([ attributes([
"Specification-Title": "examplemod", "Specification-Title": "Crafting Keys",
"Specification-Vendor": "examplemodsareus", "Specification-Vendor": "Crafting Keys",
"Specification-Version": "1", // We are version 1 of ourselves "Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name, "Implementation-Title": project.name,
"Implementation-Version": "${version}", "Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus", "Implementation-Vendor" :"Crafting Keys",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
]) ])
} }
} }
// Example configuration to allow publishing using the maven-publish task jar.finalizedBy('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 { publishing {
publications { publications {
+1 -1
View File
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip
@@ -6,12 +6,15 @@ import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.inventory.*; import net.minecraft.client.gui.screen.inventory.*;
import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import de.skate702.craftingkeys.manager.*; import de.skate702.craftingkeys.manager.*;
import de.skate702.craftingkeys.proxies.CraftingKeysProxy; import de.skate702.craftingkeys.proxies.CraftingKeysProxy;
import de.skate702.craftingkeys.util.Logger; import de.skate702.craftingkeys.util.Logger;
import de.skate702.craftingkeys.util.Util; import de.skate702.craftingkeys.util.Util;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import org.apache.commons.lang3.tuple.Pair;
/** /**
* The Main Class of the Mod with the important onTick-Method. Some Methods are * The Main Class of the Mod with the important onTick-Method. Some Methods are
@@ -23,7 +26,6 @@ import net.minecraftforge.common.MinecraftForge;
public class CraftingKeys { public class CraftingKeys {
public static final String MODID = "craftingkeys"; public static final String MODID = "craftingkeys";
public static final String VERSION = "1.0.2";
public static final String NAME = "Crafting Keys"; public static final String NAME = "Crafting Keys";
/** /**
@@ -34,6 +36,8 @@ public class CraftingKeys {
public CraftingKeys() { public CraftingKeys() {
instance = this; instance = this;
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> "client side mod only", (remoteversionstring,networkbool) -> networkbool));
Logger.info("load(e)", "Registered Mod."); Logger.info("load(e)", "Registered Mod.");
} }
+13 -28
View File
@@ -1,40 +1,25 @@
# 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 modLoader = "javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version loaderVersion = "[36,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion = "[35,)" #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 = "All rights reserved"
# 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 [[mods]] #mandatory
# The modid of the mod
modId = "craftingkeys" #mandatory modId = "craftingkeys" #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 version = "${file.jarVersion}" #mandatory
# A display name for the mod
displayName = "Crafting Keys" #mandatory displayName = "Crafting Keys" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ displayURL = "http://craftingkeys.skate702.de" #optional
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="http://craftingkeys.skate702.de" #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 = "Based on the open-source InvTweaks-Mod. Thanks a lot!" #optional credits = "Based on the open-source InvTweaks-Mod. Thanks a lot!" #optional
# A text field displayed in the mod UI
authors = "skate702 (sebinside)" #optional authors = "skate702 (sebinside)" #optional
# The description text for the mod (multi line!) (#mandatory)
description = "Simple better crafting! Crafing Keys enables new inventory key-bindings to speed up your crafting." description = "Simple better crafting! Crafing Keys enables new inventory key-bindings to speed up your crafting."
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange = "[1.16.4,1.17)" [[dependencies.craftingkeys]] #optional
modId = "forge" #mandatory
mandatory = true #mandatory
versionRange = "[36,)" #mandatory
ordering = "NONE"
side = "CLIENT"
[[dependencies.craftingkeys]]
modId = "minecraft"
mandatory = true
versionRange = "[1.16.5,)"
ordering = "NONE" ordering = "NONE"
side = "CLIENT" side = "CLIENT"
+2 -3
View File
@@ -1,7 +1,6 @@
{ {
"pack": { "pack": {
"description": "examplemod resources", "description": "craftingkeys resources",
"pack_format": 6, "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."
} }
} }