-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempting to become compatible with jitpack #2
- Loading branch information
Showing
4 changed files
with
102 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,108 @@ | ||
plugins { | ||
id 'fabric-loom' version '1.2-SNAPSHOT' | ||
id 'maven-publish' | ||
id 'fabric-loom' version '1.2-SNAPSHOT' | ||
id 'maven-publish' | ||
} | ||
|
||
version = project.mod_version | ||
group = project.maven_group | ||
|
||
base { | ||
archivesName = project.archives_base_name | ||
archivesName = project.archives_base_name | ||
} | ||
|
||
loom { | ||
splitEnvironmentSourceSets() | ||
|
||
mods { | ||
"mehrad-config" { | ||
sourceSet sourceSets.main | ||
sourceSet sourceSets.client | ||
} | ||
} | ||
splitEnvironmentSourceSets() | ||
|
||
mods { | ||
"mehrad-config" { | ||
sourceSet sourceSets.main | ||
sourceSet sourceSets.client | ||
} | ||
} | ||
} | ||
|
||
sourceSets { | ||
testmod { | ||
compileClasspath += main.compileClasspath | ||
compileClasspath += client.compileClasspath | ||
runtimeClasspath += main.runtimeClasspath | ||
runtimeClasspath += client.runtimeClasspath | ||
} | ||
testmod { | ||
compileClasspath += main.compileClasspath | ||
compileClasspath += client.compileClasspath | ||
runtimeClasspath += main.runtimeClasspath | ||
runtimeClasspath += client.runtimeClasspath | ||
} | ||
} | ||
|
||
loom { | ||
runs { | ||
testmod { | ||
client() | ||
name = "TestMod Client" | ||
source sourceSets.testmod | ||
} | ||
} | ||
runs { | ||
testmod { | ||
client() | ||
name = "TestMod Client" | ||
source sourceSets.testmod | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name 'ParchmentMC' | ||
url 'https://maven.parchmentmc.org' | ||
} | ||
maven { | ||
url 'https://maven.terraformersmc.com/releases' | ||
} | ||
maven { | ||
name 'ParchmentMC' | ||
url 'https://maven.parchmentmc.org' | ||
} | ||
maven { url 'https://maven.terraformersmc.com/releases' } | ||
} | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings loom.layered() { | ||
officialMojangMappings() | ||
parchment("org.parchmentmc.data:parchment-${project.parchment_version}@zip") | ||
} | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings loom.layered() { | ||
officialMojangMappings() | ||
parchment("org.parchmentmc.data:parchment-${project.parchment_version}@zip") | ||
} | ||
|
||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
|
||
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}" | ||
modCompileOnly ("com.terraformersmc:modmenu:${project.modmenu_version}") { transitive false } | ||
modLocalRuntime ("com.terraformersmc:modmenu:${project.modmenu_version}") { transitive false } | ||
|
||
testmodImplementation sourceSets.main.output | ||
testmodImplementation sourceSets.client.output | ||
testmodImplementation sourceSets.main.output | ||
testmodImplementation sourceSets.client.output | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
inputs.property "version", project.version | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
} | ||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
it.options.release = 17 | ||
it.options.release = 17 | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
withSourcesJar() | ||
|
||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
jar { | ||
from("LICENSE") { | ||
rename { "${it}_${project.archivesBaseName}"} | ||
} | ||
from("LICENSE") { | ||
rename { "${it}_${project.archivesBaseName}" } | ||
} | ||
} | ||
|
||
// configure the maven publication | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
|
||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. | ||
repositories { | ||
// Add repositories to publish to here. | ||
// Notice: This block does NOT have the same function as the block in the top level. | ||
// The repositories here will be used for publishing your artifact, not for | ||
// retrieving dependencies. | ||
} | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
|
||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. | ||
repositories { | ||
// Add repositories to publish to here. | ||
// Notice: This block does NOT have the same function as the block in the top level. | ||
// The repositories here will be used for publishing your artifact, not for | ||
// retrieving dependencies. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/client/java/ir/mehradn/mehradconfig/entrypoint/ModMenuSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package ir.mehradn.mehradconfig.entrypoint; | ||
|
||
import ir.mehradn.mehradconfig.MehradConfig; | ||
import ir.mehradn.mehradconfig.gui.ConfigScreenBuilder; | ||
import ir.mehradn.mehradconfig.gui.screen.MehradConfigScreen; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.function.Supplier; | ||
|
||
/** | ||
* This class is used for registering your configs for ModMenu. | ||
* @see #register | ||
*/ | ||
public class ModMenuSupport { | ||
static final Map<String, ConfigScreenLoader> screenBuilders = new HashMap<>(); | ||
|
||
/** | ||
* Registers a config constructor and a config screen builder to build screens for ModMenu. The screen will be created by | ||
* {@link ConfigScreenBuilder#buildAndLoad}. | ||
* | ||
* @param modId the mod id of your mod | ||
* @param configConstructor a constructor for the type of the config to load, modify and save | ||
* @param configScreenBuilder the config screen builder to build the screen with | ||
*/ | ||
public static void register(String modId, Supplier<MehradConfig> configConstructor, ConfigScreenBuilder configScreenBuilder) { | ||
screenBuilders.put(modId, new ConfigScreenLoader(configConstructor, configScreenBuilder)); | ||
} | ||
|
||
record ConfigScreenLoader(Supplier<MehradConfig> configConstructor, ConfigScreenBuilder configScreenBuilder) { | ||
MehradConfigScreen build(Screen parentScreen) { | ||
return this.configScreenBuilder.buildAndLoad(this.configConstructor, parentScreen); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters