Try to fix Forge

This commit is contained in:
Ran
2023-04-30 14:15:04 +06:00
parent ef02856b45
commit 5caf11789f
6 changed files with 78 additions and 153 deletions
+14 -2
View File
@@ -12,6 +12,10 @@ plugins {
// Provides mc libraries to core
// id "org.spongepowered.gradle.vanilla" version '0.2.1-SNAPSHOT' apply false
// Loom (provides stuff to add mod loaders to minecraft)
id "dev.architectury.loom" version "1.1.+" apply false
id "fabric-loom" version "1.1.+" apply false
}
/**
@@ -103,6 +107,13 @@ subprojects { p ->
apply plugin: "application"
// apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries
// Apply loader plugins
if (p == project(":forge")) {
apply plugin: "dev.architectury.loom"
} else if (p == project(":fabric")) {
apply plugin: "fabric-loom"
}
// Set the manifold version (may not be required tough)
manifold {
@@ -124,6 +135,7 @@ subprojects { p ->
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common
forgeRuntimeLibrary.extendsFrom common
if (findProject(":fabricLike") && p != project(":fabricLike")) {
// Shadow fabricLike
@@ -222,8 +234,8 @@ subprojects { p ->
// Add common
if (isMinecraftSubProject && p != project(":common")) {
// Common
common(project(path: ":common")) { transitive false }
shadowCommon(project(path: ":common")) { transitive false }
common(project(":common")) { transitive false }
shadowCommon(project(":common")) { transitive false }
// FabricLike
if (findProject(":fabricLike") && p != project(":fabricLike")) {
+4 -21
View File
@@ -1,7 +1,3 @@
plugins {
id "fabric-loom" version "1.1-SNAPSHOT"
}
loom {
accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.lod.accesswidener")
@@ -23,8 +19,9 @@ loom {
}
remapJar {
// Set the input jar for the task, also valid for remapSourcesJar
inputFile = project(":fabric").file("build/libs/DistantHorizons-fabric-${rootProject.versionStr}-all.jar")
inputFile = shadowJar.archiveFile
dependsOn shadowJar
classifier null
}
configurations {
@@ -145,18 +142,4 @@ sourcesJar {
// withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
// skip()
// }
//}
publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.mod_name + "-" + project.name
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.
}
}
//}
+53 -100
View File
@@ -1,87 +1,4 @@
buildscript {
repositories {
maven { url = "https://maven.minecraftforge.net" }
maven { url = "https://maven.parchmentmc.org" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
mavenCentral()
}
dependencies {
// classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "5.1.61", changing: true
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "5.1.67", changing: true
classpath "org.parchmentmc:librarian:1.+"
classpath "org.spongepowered:mixingradle:0.7-SNAPSHOT"
}
}
apply plugin: "net.minecraftforge.gradle"
apply plugin: "org.parchmentmc.librarian.forgegradle"
apply plugin: "org.spongepowered.mixin"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
mixin {
add sourceSets.main, "DistantHorizons.refmap.json" // TODO: Create an accessWidener to refmap
config "DistantHorizons.mixins.json"
}
minecraft {
// mappings channel: "official", version: minecraft_version // Vanilla mappings
mappings channel: "parchment", version: "${parchment_version}-${minecraft_version}" // Parchment mappings
accessTransformer = project(":forge").file("src/main/resources/META-INF/accesstransformer.cfg") // FIXME: Find a libary to use fabric's accessWidener instead of forge's own accesstransformer format
runs {
client {
workingDirectory project.file("run")
ideaModule "${rootProject.name}.${project.name}.main"
taskName "runClient"
args "-mixins.config=DistantHorizons.mixins.json"
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modClientRun {
source sourceSets.main
source project(":common").sourceSets.main
source project(":core").sourceSets.main
source project(":api").sourceSets.main
}
}
}
// TODO: Do this once client works
// server {
// workingDirectory project.file("run")
// ideaModule "${rootProject.name}.${project.name}.main"
// taskName "runServer"
// args "-mixins.config=DistantHorizons.mixins.json"
// }
data {
workingDirectory project.file("run")
ideaModule "${rootProject.name}.${project.name}.main"
args '--mod', "lod", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
taskName 'Data'
args "-mixins.config=DistantHorizons.mixins.json" // To add more mixins, you can just add a comma for another arg
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modClientRun {
source sourceSets.main
source project(":common").sourceSets.main
source project(":core").sourceSets.main
source project(":api").sourceSets.main
}
}
}
}
}
// TODO: Check if the next 7 lines are necessary
//sourceSets.main.resources.srcDir "src/generated/resources"
//minecraft.runs.all {
// lazyToken('minecraft_classpath') {
// configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
// configurations.runtimeLibrary.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
// }
//}
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
//loom {
@@ -92,17 +9,38 @@ minecraft {
// }
//}
loom {
accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.lod.accesswidener")
//loom {
// accessWidenerPath = project(":common").loom.accessWidenerPath
//
// forge {
// convertAccessWideners = true
// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
// }
//}
forge {
convertAccessWideners = true
mixinConfigs("DistantHorizons.mixins.json")
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
}
// "runs" isn't required, but when we do need it then it can be useful
runs {
client {
client()
setConfigName("Forge Client")
ideConfigGenerated(true)
runDir("run")
vmArg("-XX:-OmitStackTraceInFastThrow")
}
server {
server()
setConfigName("Forge Server")
ideConfigGenerated(true)
runDir("run")
}
}
}
remapJar {
inputFile = shadowJar.archiveFile
dependsOn shadowJar
classifier null
}
def addMod(path, enabled) {
if (enabled == "2")
@@ -111,8 +49,16 @@ def addMod(path, enabled) {
dependencies { modCompileOnly(path) }
}
dependencies {
// Forge loader
minecraft "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.layered() {
// Mojmap mappings
officialMojangMappings()
// Parchment mappings (it adds parameter mappings & javadoc)
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip")
}
// Forge
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${project.forge_version}"
// Architectury API
// if (minecraft_version == "1.16.5") {
@@ -132,17 +78,24 @@ dependencies {
// }
}
processResources {
task deleteResources(type: Delete) {
delete file("build/resources/main")
}
tasks.register('copyAllResources') {
dependsOn(copyCoreResources)
dependsOn(copyCommonLoaderResources)
dependsOn(deleteDuplicatedCommonLoaderResources)
}
//remapJar {
// input.set shadowJar.archiveFile
// dependsOn shadowJar
// classifier null
//}
processResources {
dependsOn(tasks.named('copyAllResources'))
}
tasks.named('runClient') {
dependsOn(tasks.named('copyAllResources'))
finalizedBy(deleteResources)
}
sourcesJar {
+1
View File
@@ -0,0 +1 @@
loom.platform=forge
@@ -1,28 +0,0 @@
public net.minecraft.world.level.lighting.LevelLightEngine f_75802_
public net.minecraft.world.level.lighting.LevelLightEngine f_75803_
public net.minecraft.client.renderer.LevelRenderer$RenderChunkInfo
public net.minecraft.client.renderer.LevelRenderer$RenderChunkInfo f_109839_
public net.minecraft.world.level.biome.Biome f_47438_
public net.minecraft.world.level.biome.Biome f_47442_
public net.minecraft.client.renderer.texture.TextureAtlasSprite$AnimatedTexture
public net.minecraft.client.renderer.texture.TextureAtlasSprite$AnimatedTexture m_174764_(I)I
public net.minecraft.client.renderer.texture.TextureAtlasSprite$AnimatedTexture m_174759_(I)I
public net.minecraft.world.level.levelgen.Heightmap m_64245_(III)V
public net.minecraft.world.level.storage.DimensionDataStorage f_78146_
public net.minecraft.client.renderer.LevelRenderer f_194307_
public-f com.mojang.math.Matrix4f
public net.minecraft.client.renderer.texture.TextureAtlasSprite f_118342_
public net.minecraft.client.renderer.texture.TextureAtlasSprite f_174723_
public net.minecraft.client.renderer.texture.TextureAtlasSprite f_174725_
public net.minecraft.client.renderer.texture.TextureAtlasSprite f_174724_
public net.minecraft.client.renderer.LevelRenderer$RenderChunkStorage
public net.minecraft.client.renderer.GameRenderer m_109141_(Lnet/minecraft/client/Camera;FZ)D
public-f net.minecraft.util.ThreadingDetector f_199409_
public net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator m_188662_(Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;II)Lnet/minecraft/world/level/chunk/ChunkAccess;
public com.mojang.blaze3d.vertex.VertexBuffer f_166859_
public com.mojang.blaze3d.vertex.VertexBuffer f_166863_
public net.minecraft.server.level.ChunkMap f_140135_
public net.minecraft.server.level.ChunkMap m_140427_(Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/nbt/CompoundTag;
public net.minecraft.client.renderer.LightTexture f_109870_
public net.minecraft.client.renderer.LightTexture f_109871_
public net.minecraft.world.level.lighting.LayerLightEngine m_75660_(JLnet/minecraft/world/level/chunk/DataLayer;Z)V
+6 -2
View File
@@ -8,6 +8,10 @@ pluginManagement {
name "Forge"
url "https://maven.minecraftforge.net/"
}
maven {
name "Architectury (Better Forge because regular Forge hates us)"
url "https://maven.architectury.dev/"
}
maven {
name "Quilt"
url "https://maven.quiltmc.org/repository/release"
@@ -75,14 +79,14 @@ project(":api").projectDir = file('coreSubProjects/api')
// Minecraft dependent sub-projects
include("common")
// Enables or disables the subprojects depending on whats in the version.properties
if (gradle.builds_for.contains("forge"))
include("forge")
//if (gradle.builds_for.contains("fabric") || gradle.builds_for.contains("quilt"))
// include("fabricLike")
if (gradle.builds_for.contains("fabric"))
include("fabric")
if (gradle.builds_for.contains("quilt"))
include("quilt") // Just put this here for once we need it ;)
//if (gradle.builds_for.contains("forge"))
// include("forge") // FIXME: Find some time to fix forge
rootProject.name = "DistantHorizons"