forked from CaffeineMC/sodium
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/1.21/0.6-multiloader' into dev
# Conflicts: # build.gradle.kts # common/src/main/java/net/caffeinemc/mods/sodium/client/render/immediate/CloudRenderer.java # common/src/main/java/net/caffeinemc/mods/sodium/client/render/vertex/VertexFormatDescriptionImpl.java # common/src/main/java/net/caffeinemc/mods/sodium/mixin/core/render/immediate/consumer/EntityOutlineGeneratorMixin.java # common/src/main/java/net/caffeinemc/mods/sodium/mixin/core/render/world/LevelRendererMixin.java # common/src/main/java/net/caffeinemc/mods/sodium/mixin/features/gui/screen/LevelLoadingScreenMixin.java # common/src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/immediate/buffer_builder/sorting/MeshDataMixin.java # common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/MessageBox.java # fabric/src/main/java/net/caffeinemc/mods/sodium/fabric/texture/SpriteFinderCache.java # src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/buffers/ChunkVertexConsumer.java # src/main/java/net/caffeinemc/mods/sodium/mixin/core/render/immediate/consumer/BufferBuilderMixin.java # src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/entity/ModelPartMixin.java # src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/entity/cull/EntityRendererMixin.java # src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/particle/SingleQuadParticleMixin.java # src/main/resources/fabric.mod.json
- Loading branch information
Showing
587 changed files
with
6,919 additions
and
1,306 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
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ bin/ | |
# fabric | ||
|
||
run/ | ||
|
||
neoforge/runs | ||
# macOS | ||
|
||
.DS_Store | ||
|
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
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,145 +1,75 @@ | ||
object Constants { | ||
// https://fabricmc.net/develop/ | ||
const val MINECRAFT_VERSION: String = "1.21" | ||
const val FABRIC_LOADER_VERSION: String = "0.16.0" | ||
const val FABRIC_API_VERSION: String = "0.100.7+1.21" | ||
|
||
// https://semver.org/ | ||
const val MOD_VERSION: String = "0.6.0" | ||
} | ||
|
||
plugins { | ||
// Unlike most projects, we choose to pin the specific version of Loom. | ||
// This prevents a lot of issues where the build script can fail randomly because the Fabric Maven server | ||
// is not reachable for some reason, and it makes builds much more reproducible. Observation also shows that it | ||
// really helps to improve startup times on slow connections. | ||
id("fabric-loom") version "1.7.2" | ||
id("java") | ||
id("fabric-loom") version ("1.7.3") apply (false) | ||
} | ||
|
||
base { | ||
archivesName = "sodium-fabric" | ||
val MINECRAFT_VERSION by extra { "1.21" } | ||
val NEOFORGE_VERSION by extra { "21.0.147" } | ||
val FABRIC_LOADER_VERSION by extra { "0.16.0" } | ||
val FABRIC_API_VERSION by extra { "0.100.4+1.21" } | ||
|
||
group = "net.caffeinemc.mods" | ||
version = createVersionString() | ||
} | ||
// This value can be set to null to disable Parchment. | ||
val PARCHMENT_VERSION by extra { "2024.07.28" } | ||
|
||
loom { | ||
mixin { | ||
defaultRefmapName = "sodium.refmap.json" | ||
} | ||
// https://semver.org/ | ||
val MOD_VERSION by extra { "0.6.0" } | ||
|
||
accessWidenerPath = file("src/main/resources/sodium.accesswidener") | ||
allprojects { | ||
apply(plugin = "java") | ||
apply(plugin = "maven-publish") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
targetCompatibility = JavaVersion.VERSION_21 | ||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
sourceSets { | ||
val main = getByName("main") | ||
val api = create("api") | ||
val desktop = create("desktop") | ||
subprojects { | ||
apply(plugin = "maven-publish") | ||
|
||
api.apply { | ||
java { | ||
compileClasspath += main.compileClasspath | ||
} | ||
} | ||
java.toolchain.languageVersion = JavaLanguageVersion.of(21) | ||
|
||
desktop.apply { | ||
java { | ||
srcDir("src/desktop/java") | ||
} | ||
} | ||
|
||
main.apply { | ||
java { | ||
compileClasspath += api.output | ||
runtimeClasspath += api.output | ||
} | ||
} | ||
} | ||
fun createVersionString(): String { | ||
val builder = StringBuilder() | ||
|
||
dependencies { | ||
minecraft(group = "com.mojang", name = "minecraft", version = Constants.MINECRAFT_VERSION) | ||
mappings(loom.officialMojangMappings()) | ||
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = Constants.FABRIC_LOADER_VERSION) | ||
include(implementation(group = "com.lodborg", name = "interval-tree", version = "1.0.0")) | ||
|
||
fun addEmbeddedFabricModule(name: String) { | ||
val module = fabricApi.module(name, Constants.FABRIC_API_VERSION) | ||
modImplementation(module) | ||
include(module) | ||
} | ||
|
||
// Fabric API modules | ||
addEmbeddedFabricModule("fabric-api-base") | ||
addEmbeddedFabricModule("fabric-block-view-api-v2") | ||
addEmbeddedFabricModule("fabric-renderer-api-v1") | ||
addEmbeddedFabricModule("fabric-rendering-data-attachment-v1") | ||
addEmbeddedFabricModule("fabric-rendering-fluids-v1") | ||
addEmbeddedFabricModule("fabric-resource-loader-v0") | ||
} | ||
val isReleaseBuild = project.hasProperty("build.release") | ||
val buildId = System.getenv("GITHUB_RUN_NUMBER") | ||
|
||
tasks { | ||
getByName<JavaCompile>("compileDesktopJava") { | ||
sourceCompatibility = JavaVersion.VERSION_1_8.toString() | ||
targetCompatibility = JavaVersion.VERSION_1_8.toString() | ||
} | ||
|
||
jar { | ||
from("${rootProject.projectDir}/LICENSE.md") | ||
if (isReleaseBuild) { | ||
builder.append(MOD_VERSION) | ||
} else { | ||
builder.append(MOD_VERSION.substringBefore('-')) | ||
builder.append("-snapshot") | ||
} | ||
|
||
val api = sourceSets.getByName("api") | ||
from(api.output.classesDirs) | ||
from(api.output.resourcesDir) | ||
builder.append("+mc").append(MINECRAFT_VERSION) | ||
|
||
val desktop = sourceSets.getByName("desktop") | ||
from(desktop.output.classesDirs) | ||
from(desktop.output.resourcesDir) | ||
if (!isReleaseBuild) { | ||
if (buildId != null) { | ||
builder.append("-build.${buildId}") | ||
} else { | ||
builder.append("-local") | ||
} | ||
} | ||
|
||
manifest.attributes["Main-Class"] = "net.caffeinemc.mods.sodium.desktop.LaunchWarn" | ||
return builder.toString() | ||
} | ||
|
||
processResources { | ||
inputs.property("version", project.version) | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand(mapOf("version" to project.version)) | ||
tasks.processResources { | ||
filesMatching("META-INF/neoforge.mods.toml") { | ||
expand(mapOf("version" to createVersionString())) | ||
} | ||
} | ||
} | ||
|
||
// ensure that the encoding is set to UTF-8, no matter what the system default is | ||
// this fixes some edge cases with special characters not displaying correctly | ||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html | ||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
fun createVersionString(): String { | ||
val builder = StringBuilder() | ||
|
||
val isReleaseBuild = project.hasProperty("build.release") | ||
val buildId = System.getenv("GITHUB_RUN_NUMBER") | ||
version = createVersionString() | ||
group = "net.caffeinemc.mods" | ||
|
||
if (isReleaseBuild) { | ||
builder.append(Constants.MOD_VERSION) | ||
} else { | ||
builder.append(Constants.MOD_VERSION.substringBefore('-')) | ||
builder.append("-snapshot") | ||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
options.release.set(21) | ||
} | ||
|
||
builder.append("+mc").append(Constants.MINECRAFT_VERSION) | ||
|
||
if (!isReleaseBuild) { | ||
if (buildId != null) { | ||
builder.append("-build.${buildId}") | ||
} else { | ||
builder.append("-local") | ||
} | ||
tasks.withType<GenerateModuleMetadata>().configureEach { | ||
enabled = false | ||
} | ||
|
||
return builder.toString() | ||
} |
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,119 @@ | ||
plugins { | ||
id("java") | ||
id("idea") | ||
id("fabric-loom") version ("1.7.3") | ||
} | ||
|
||
repositories { | ||
maven("https://maven.parchmentmc.org/") | ||
} | ||
|
||
val MINECRAFT_VERSION: String by rootProject.extra | ||
val PARCHMENT_VERSION: String? by rootProject.extra | ||
val FABRIC_LOADER_VERSION: String by rootProject.extra | ||
val FABRIC_API_VERSION: String by rootProject.extra | ||
|
||
dependencies { | ||
minecraft(group = "com.mojang", name = "minecraft", version = MINECRAFT_VERSION) | ||
mappings(loom.layered() { | ||
officialMojangMappings() | ||
if (PARCHMENT_VERSION != null) { | ||
parchment("org.parchmentmc.data:parchment-${MINECRAFT_VERSION}:${PARCHMENT_VERSION}@zip") | ||
} | ||
}) | ||
compileOnly("io.github.llamalad7:mixinextras-common:0.3.5") | ||
annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5") | ||
compileOnly("net.fabricmc:sponge-mixin:0.13.2+mixin.0.8.5") | ||
|
||
fun addDependentFabricModule(name: String) { | ||
val module = fabricApi.module(name, FABRIC_API_VERSION) | ||
modCompileOnly(module) | ||
} | ||
|
||
addDependentFabricModule("fabric-api-base") | ||
addDependentFabricModule("fabric-block-view-api-v2") | ||
addDependentFabricModule("fabric-renderer-api-v1") | ||
addDependentFabricModule("fabric-rendering-data-attachment-v1") | ||
|
||
modCompileOnly("net.fabricmc.fabric-api:fabric-renderer-api-v1:3.2.9+1172e897d7") | ||
implementation(group = "com.lodborg", name = "interval-tree", version = "1.0.0") | ||
} | ||
|
||
sourceSets { | ||
val main = getByName("main") | ||
val api = create("api") | ||
val workarounds = create("workarounds") | ||
val desktop = create("desktop") | ||
|
||
api.apply { | ||
java { | ||
compileClasspath += main.compileClasspath | ||
} | ||
} | ||
|
||
workarounds.apply { | ||
java { | ||
compileClasspath += main.compileClasspath | ||
} | ||
} | ||
|
||
desktop.apply { | ||
java { | ||
srcDir("src/desktop/java") | ||
} | ||
} | ||
|
||
main.apply { | ||
java { | ||
compileClasspath += api.output | ||
compileClasspath += workarounds.output | ||
runtimeClasspath += api.output | ||
} | ||
} | ||
} | ||
|
||
loom { | ||
mixin { | ||
defaultRefmapName = "sodium.refmap.json" | ||
} | ||
|
||
accessWidenerPath = file("src/main/resources/sodium.accesswidener") | ||
|
||
mods { | ||
val main by creating { // to match the default mod generated for Forge | ||
sourceSet("api") | ||
sourceSet("desktop") | ||
sourceSet("main") | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
getByName<JavaCompile>("compileDesktopJava") { | ||
sourceCompatibility = JavaVersion.VERSION_1_8.toString() | ||
targetCompatibility = JavaVersion.VERSION_1_8.toString() | ||
} | ||
|
||
jar { | ||
from(rootDir.resolve("LICENSE.md")) | ||
|
||
val api = sourceSets.getByName("api") | ||
from(api.output.classesDirs) | ||
from(api.output.resourcesDir) | ||
|
||
val workarounds = sourceSets.getByName("workarounds") | ||
from(workarounds.output.classesDirs) | ||
from(workarounds.output.resourcesDir) | ||
|
||
val desktop = sourceSets.getByName("desktop") | ||
from(desktop.output.classesDirs) | ||
from(desktop.output.resourcesDir) | ||
|
||
manifest.attributes["Main-Class"] = "net.caffeinemc.mods.sodium.desktop.LaunchWarn" | ||
} | ||
} | ||
|
||
// This trick hides common tasks in the IDEA list. | ||
tasks.configureEach { | ||
group = null | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.