Fixed IMC, Keybinds, other bugs

This commit is contained in:
Tschipp 2023-07-06 17:11:12 +02:00
parent 0f22c9650f
commit e44ff0ea5b
2 changed files with 230 additions and 230 deletions

View File

@ -1,60 +1,60 @@
plugins { plugins {
id 'java' id 'java'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
archivesBaseName = "${mod_id}-common-${minecraft_version}" archivesBaseName = "${mod_id}-common-${minecraft_version}"
minecraft { minecraft {
version(minecraft_version) version(minecraft_version)
runs { runs {
if (project.hasProperty('common_runs_enabled') ? project.findProperty('common_runs_enabled').toBoolean() : true) { 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') { server(project.hasProperty('common_server_run_name') ? project.findProperty('common_server_run_name') : 'vanilla_server') {
workingDirectory(this.file("run")) workingDirectory(this.file("run"))
} }
client(project.hasProperty('common_client_run_name') ? project.findProperty('common_client_run_name') : 'vanilla_client') { client(project.hasProperty('common_client_run_name') ? project.findProperty('common_client_run_name') : 'vanilla_client') {
workingDirectory(this.file("run")) workingDirectory(this.file("run"))
} }
} }
} }
} }
repositories { repositories {
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
} }
dependencies { dependencies {
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5' compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
implementation("com.github.llamalad7.mixinextras:mixinextras-common:${mixinextras_version}") implementation("com.github.llamalad7.mixinextras:mixinextras-common:${mixinextras_version}")
annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-common:${mixinextras_version}") annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-common:${mixinextras_version}")
} }
processResources { processResources {
def buildProps = project.properties.clone() def buildProps = project.properties.clone()
filesMatching(['pack.mcmeta']) { filesMatching(['pack.mcmeta']) {
expand buildProps expand buildProps
} }
} }
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
groupId project.group groupId project.group
artifactId project.archivesBaseName artifactId project.archivesBaseName
version project.version version project.version
from components.java from components.java
} }
} }
repositories { repositories {
maven { maven {
url "file://" + System.getenv("local_maven") url "file://" + System.getenv("local_maven")
} }
} }
} }

View File

@ -1,171 +1,171 @@
buildscript { buildscript {
repositories { repositories {
maven { url = 'https://maven.minecraftforge.net' } maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
maven { url = 'https://maven.parchmentmc.org' } maven { url = 'https://maven.parchmentmc.org' }
mavenCentral() mavenCentral()
gradlePluginPortal() gradlePluginPortal()
} }
dependencies { dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
classpath 'org.parchmentmc:librarian:1.+' classpath 'org.parchmentmc:librarian:1.+'
classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2' classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
} }
} }
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle' apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'org.spongepowered.mixin' apply plugin: 'org.spongepowered.mixin'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'org.parchmentmc.librarian.forgegradle' apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.github.johnrengelman.shadow'
apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle' apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle'
if (project.hasProperty('secretFile')) { if (project.hasProperty('secretFile')) {
loadSecrets(new File((String) findProperty('secretFile'))) loadSecrets(new File((String) findProperty('secretFile')))
} }
if (System.getenv('BUILD_NUMBER') != null) { if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER') version += "." + System.getenv('BUILD_NUMBER')
} }
jarJar.enable() jarJar.enable()
archivesBaseName = "${mod_id}-forge-${minecraft_version}" archivesBaseName = "${mod_id}-forge-${minecraft_version}"
mixin { mixin {
add sourceSets.main, "${mod_id}.refmap.json" add sourceSets.main, "${mod_id}.refmap.json"
config "${mod_id}.mixins.json" config "${mod_id}.mixins.json"
config "${mod_id}.forge.mixins.json" config "${mod_id}.forge.mixins.json"
} }
minecraft { minecraft {
mappings channel: 'parchment', version: "${parchment_mappings}" mappings channel: 'parchment', version: "${parchment_mappings}"
if (project.hasProperty('forge_ats_enabled') && project.findProperty('forge_ats_enabled').toBoolean()) { if (project.hasProperty('forge_ats_enabled') && project.findProperty('forge_ats_enabled').toBoolean()) {
// This location is hardcoded in Forge and can not be changed. // This location is hardcoded in Forge and can not be changed.
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123 // https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
project.logger.debug('Forge Access Transformers are enabled for this project.') project.logger.debug('Forge Access Transformers are enabled for this project.')
} }
runs { runs {
client { client {
workingDirectory project.file('run') workingDirectory project.file('run')
ideaModule "${rootProject.name}.${project.name}.main" ideaModule "${rootProject.name}.${project.name}.main"
taskName 'Client' taskName 'Client'
property 'mixin.env.remapRefMap', 'true' property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}.forge.mixins.json" args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}.forge.mixins.json"
mods { mods {
modClientRun { modClientRun {
source sourceSets.main source sourceSets.main
source project(":Common").sourceSets.main source project(":Common").sourceSets.main
} }
} }
} }
server { server {
workingDirectory project.file('run') workingDirectory project.file('run')
ideaModule "${rootProject.name}.${project.name}.main" ideaModule "${rootProject.name}.${project.name}.main"
taskName 'Server' taskName 'Server'
property 'mixin.env.remapRefMap', 'true' property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}.forge.mixins.json" args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}.forge.mixins.json"
mods { mods {
modServerRun { modServerRun {
source sourceSets.main source sourceSets.main
source project(":Common").sourceSets.main source project(":Common").sourceSets.main
} }
} }
} }
data { data {
workingDirectory project.file('run') workingDirectory project.file('run')
ideaModule "${rootProject.name}.${project.name}.main" ideaModule "${rootProject.name}.${project.name}.main"
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
taskName 'Data' taskName 'Data'
property 'mixin.env.remapRefMap', 'true' property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}.forge.mixins.json" args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}.forge.mixins.json"
mods { mods {
modDataRun { modDataRun {
source sourceSets.main source sourceSets.main
source project(":Common").sourceSets.main source project(":Common").sourceSets.main
} }
} }
} }
} }
} }
sourceSets.main.resources.srcDir 'src/generated/resources' sourceSets.main.resources.srcDir 'src/generated/resources'
repositories { repositories {
maven { maven {
url 'https://maven.blamejared.com' url 'https://maven.blamejared.com'
} }
flatDir { flatDir {
dirs 'libs' dirs 'libs'
} }
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
} }
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
compileOnly project(":Common") compileOnly project(":Common")
implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-common:${mixinextras_version}")) implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-common:${mixinextras_version}"))
implementation(jarJar("com.github.llamalad7.mixinextras:mixinextras-forge:${mixinextras_version}")) { implementation(jarJar("com.github.llamalad7.mixinextras:mixinextras-forge:${mixinextras_version}")) {
jarJar.ranged(it, "[${mixinextras_version},)") jarJar.ranged(it, "[${mixinextras_version},)")
} }
//implementation fg.deobf("net.darkhax.gamestages:GameStages-Forge-1.19.2:11.0.2") //implementation fg.deobf("net.darkhax.gamestages:GameStages-Forge-1.19.2:11.0.2")
//implementation fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-1.19.3:17.0.2") //implementation fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-1.19.3:17.0.2")
annotationProcessor 'org.spongepowered:mixin:0.8.4-SNAPSHOT:processor' annotationProcessor 'org.spongepowered:mixin:0.8.4-SNAPSHOT:processor'
fileTree("libs").matching { fileTree("libs").matching {
include "*.jar" include "*.jar"
}.each { }.each {
String filename = it.getName(); String filename = it.getName();
filename = filename.substring(0, filename.length() - 4); filename = filename.substring(0, filename.length() - 4);
int lastDash = filename.lastIndexOf("-"); int lastDash = filename.lastIndexOf("-");
filename = filename.substring(0, lastDash) + ":" + filename.substring(lastDash+1, filename.length()); filename = filename.substring(0, lastDash) + ":" + filename.substring(lastDash+1, filename.length());
implementation fg.deobf("blank:${filename}") implementation fg.deobf("blank:${filename}")
} }
} }
reobf { reobf {
jarJar {} jarJar {}
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
source(project(":Common").sourceSets.main.allSource) source(project(":Common").sourceSets.main.allSource)
} }
processResources { processResources {
from project(":Common").sourceSets.main.resources from project(":Common").sourceSets.main.resources
filesMatching('*.mixins.json') { filesMatching('*.mixins.json') {
expand "refmap_target": "${mod_id}." expand "refmap_target": "${mod_id}."
} }
} }
jar.finalizedBy('reobfJar') jar.finalizedBy('reobfJar')
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
groupId project.group groupId project.group
artifactId project.archivesBaseName artifactId project.archivesBaseName
version project.version version project.version
artifact jar artifact jar
} }
} }
repositories { repositories {
maven { maven {
url "file://" + System.getenv("local_maven") url "file://" + System.getenv("local_maven")
} }
} }
} }