Skip to content

Commit 7e19b98

Browse files
ThatMG393IMS212jellysquid3douiraMeeniMc
authored
idek bro (#10)
* Correctly handle colorization on NeoForge * Combine the vertex position attributes (CaffeineMC#2753) This improves terrain rendering performance significantly on Intel Xe-LP graphics under Linux. * Add option for Fullscreen Resolution (CaffeineMC#2642) The resolution controls would not fit in the allocated space, so the rendering of slider controls was changed to enable rendering the slider bar and the value text on separate lines. Co-authored-by: MeeniMc <[email protected]> * Only enable Fullscreen Resolution option on Windows Additionally, adjust the rendering of the controls to be less confusing when disabled, and provide an explanation as to what the option does. * Use consistent vertex ordering in entity rendering Some core shaders were relying on the model part faces being written out in a specific order. We still don't support core shaders, but the fix here is trivial enough. Fixes CaffeineMC#2745 * Add check for NeoForge per-quad AO flag * Disable mod entrypoint on Forge when running on servers (CaffeineMC#2773) * Fix excessively large allocations in chunk meshing The requested capacity was being multiplied by the vertex stride more than once, which resulted in far too much memory being allocated. Closes CaffeineMC#2792 * Fix some issues with Uint32 representation This increases the maximum size of vertex and index buffers to 4 billion elements, since the Uint32 types stored in memory are now safely represented with Int64. For vertex buffers, this increases their maximum size to 80 GiB, and index buffers have a maximum size of 16 GiB, whereas both were limited to 2 GiB prior. * Fix cull bitmask ordering in entity rendering Closes CaffeineMC#2788 * Add support for Maven Local publishing * Fix incorrect warning message when D3DKMT is not supported * Add Flawless Frames handler for NeoForge * Add angle-based section visibility path occlusion (CaffeineMC#2811) This eliminates 8-13% of the rendered sections at higher render distances on average in testing, and correspondingly reduces graph search time by a similar amount. * Disable material downgrading on Intel Gen8 and older Fixes CaffeineMC#2830 * Delay normal face calculation to use This potentially fixes some cases of CaffeineMC#2835. * Skip particle rendering optimizations for incompatible mods Fixes CaffeineMC#2827 * Update project URLs in source and documentation We're no longer a Fabric-exclusive mod, so let's get rid of the suffix. * Add third-party license notice for Fabric API * Optimizations for some block models (CaffeineMC#2508) Co-authored-by: muzikbike <[email protected]> * Fix sorting failures on rotated cuboids (CaffeineMC#2812) Use the accurate vertex positions for unaligned and aligned (but rotated) quads. * Rework the Gradle build scripts for multi-loader * Shared logic is moved into a build plugin where possible * Build time is significantly improved when the Gradle daemon is warmed * Mixins are remapped in-place now, eliminating the need for refmaps at runtime. This also gets rid of some warning messages at startup. * Module relationships are now correctly represented in IDEA for other source sets (fixes a lot of code analysis features) * Split Java source and resources into different configurations * Run configurations are now consistent between NeoForge/Fabric * The common project is no longer remapped unnecessarily * Updated Gradle and build plugins * Restore versioning schema to build script * Make organization of platform mixin packages consistent Fixes CaffeineMC#2688 * Exclude README documentation from processed resources These files are only meant to be in the source distribution, and Minecraft doesn't like them. * Don't try to load a refmap from the mixin plugin * Enumerate additional PCI classes in the graphics adapter probe Some integrated GPUs, such as RDNA3.5, appear to use the PCI_CLASS_DISPLAY_OTHER class. * Remove KDE and GNOME specific backends for browsing URLs The bugs with xdg-open have been resolved upstream and most Linux distributions are shipping the patches. Also, make sure we get a successful exit code from the XDG implementation. * Remove Minecraft from classpath of the pre-launch source set This will help to avoid class-load issues and makes the code more hygienic. * Update to Minecraft 1.21.3 * Ensure tooltips are constrained to the screen (CaffeineMC#2845) * Update authors and contributors list * Remove leftover popPose * Trust existing fog color * Block the Overwolf Overlay due to graphical corruption The overlay does not correctly restore the texture unit state in OpenGL, which causes problems when Minecraft thinks a texture has already been bound to a slot. Since disabling the OpenGL state cache globally is not an acceptable solution (it would severely hurt performance) and their software doesn't give us any method to detect the problematic version, we block all versions. gep_minecraft.dll is the payload they actually inject, which has no version information or description. Fixes CaffeineMC#2862 * Avoid static memory allocation in EntityRenderer Just allocate on the stack, since it's a small amount of memory (<1 KiB) and avoids needing complex finalizers. * Fix y-offset calculation for back face culling in cloud rendering (CaffeineMC#2864) * Fix memory leak and double free in CloudRenderer * Improve color mixing functions The existing functions did not implement rounding correctly (often leading to off-by-one errors). Additionally, the improved variants are both slightly faster and easier to understand. * Fixup documentation in ColorMixer * Unify color mixing/swizzling utilities The Fabric integration code was re-implementing a lot of the utilities that already exist in Sodium unnecessarily. Also, improve the documentation so that ABGR and RGBA are not used interchangeably. * Add optimized function for bi-linear interpolation This reduces the number of ALU ops significantly and creates a common utility function in the project. * Reduce time complexity for box blurs Measuring the time spent per box blur in biome blending, the following results were observed. Radius Before After % Improvement 7 blocks 9100ns 3700ns 59% 3 blocks 5400ns 3200ns 41% 1 blocks 3700ns 2600ns 29% * Revert detection of Overwolf Overlay They claim this has since been fixed. We will re-examine in the future if we see additional reports. This reverts commit e7ea6f7. * Bump version to 0.6.0-beta.5 * Bump version to 0.6.0-final * Update render code for chunk status map Fixes CaffeineMC#2881 * Rollup of fixes and improvements for cloud rendering Some changes were made to cloud rendering in newer versions that needed to be replicated in Sodium. - The alpha cutoff for clouds was changed to (a < 10). - Texture loading can now gracefully fail, and it is expected that rendering is skipped when this happens. - The movement/positioning of clouds was slightly changed. - The render pass system now needs to be told about render target usages (fixes CaffeineMC#2883). This commit also improves mesh building time by around 35% on a fast processor (AMD Ryzen HX AI 370) through various micro-optimizations. * Fix culling behavior between transparent and opaque blocks Minecraft 1.21.2 changed some of the rules, and this was causing the faces of transparent blocks to be rendered even when they were hidden by full opaque blocks. Fixes CaffeineMC#2850 * Fix precision issues in cloud rendering at far distances * Use alternative workaround for NVIDIA drivers The NVIDIA driver enables a driver feature called "Threaded Optimizations" when it finds Minecraft, which causes severe performance issues and sometimes even crashes. Newer versions of the driver seem to use a slightly different heuristic which our workaround doesn't address. So, instead, use an alternative method that enables GL_DEBUG_OUTPUT_SYNCHRONOUS. This seems to reliably disable the functionality *even if* the user has configured it otherwise in their driver settings. Additionally, on Windows, we now always indicate to the driver that Minecraft is running, so that users with hybrid graphics don't see regressed performance. * Sort render lists for regions and sections after traversal (CaffeineMC#2780) Render sections and regions are sorted after the graph traversal is performed. This decouples their ordering from the graph, which isn't entirely correct for draw call sorting. Fixes CaffeineMC#2266 * Add support for new NeoForge fluid overlay API * Ensure depth test is configured when rendering clouds The state of the depth test prior to cloud rendering is undefined. After rendering, it is expected to be disabled again. * Fix rounding error in ColorMixer#mix Rounding of the values now happens after the 16-bit intermediaries are added together. This affected some animated textures, causing them to exhibit flickering behavior. * Add additional optimized block models This covers the following additional blocks: - Cauldrons - Brewing Stands - Bells Co-authored-by: JellySquid <[email protected]> * Avoid marking the section graph as dirty if state didn't change (CaffeineMC#2886) Avoids rebuilding the render lists and doing a graph search more often than necessary by checking if the section actually changed in a way that's relevant to the graph search. For worlds that update their blocks frequently (every tick or every redstone tick) this avoids half the graph searches. Some graph searches are still necessary to schedule rebuild tasks, but when the task results come back, this doesn't do another graph search unless the section's visibility data or build state changed in a way that needs the render list to be updated. * Use larger bounding box for nearby sections in frustum check (CaffeineMC#2879) This fixes some problems where very large block entities in nearby sections may be incorrectly culled. But it does not comprehensively fix the problem for all other sections, since that would require visiting the 27-neighborhood of every section, which is too slow. * Bump version to 0.6.1 * Bump dependency versions * Update mod manifest * Ensure ItemRenderContext.isDefaultTranslucent is initialized * Update compatible mods listing * Update mod manifest to restrict Minecraft versions * Update to Minecraft 1.21.4 * Update NeoForge manifest for Minecraft 1.21.4 * Fix glyph effect orientation * Fix hidden surface elimination in fluid rendering for waterlogged blocks (CaffeineMC#2907) * Fix detection for specific Intel OpenGL ICDs The OpenGL ICD name now includes the file extension, which the regex expressions were not matching. * Avoid showing the incompatible driver error in some cases For systems with hybrid graphics, it may be the case that an incompatible graphics driver is installed, but that it isn't used for the OpenGL context. We can avoid showing errors in this situation by checking the vendor string of the context immediately after creation. This is not the most robust check, but in practice, a single system should not have multiple graphics drivers installed from the same vendor, so checking the string should be relatively safe. * Fix lambda mappings * Bump version and dependency requirements * Use correct coordinates for sorting chunk sections (CaffeineMC#2924) Fix section and region sorting by using the correct section coordinate instead of the integer part of the camera transform, which is incorrect near the origin. Closes CaffeineMC#2918 * Update README.md * Update textures for Leaves variants * Added "Pale Oak Leaves" for Minecraft 1.21.4. * Reduced the file size of all block textures. * Clean up BitArray class * Use link.caffeinemc.net domain for some URLs * Use ShellExecuteW from message box callbacks This fixes a regression caused by 26f4263. The underlying problem is that accessing Java's AWT *after* LWJGL3 has initialized is not possible. Minecraft has a utility class which uses rundll32 internally, but we cannot access that due to classloader restrictions on NeoForge. That leaves us with having to implement the call ourselves, and simply using Shell32 directly (like we do for other Windows APIs) seems easiest. * Do not bake ambient lighting into cached per-face light data Fixes CaffeineMC#2806 * Switch to Parchment mappings 2024.12.07 * Bump version and dependencies * Do not cache ambient brightness at initialization The world may not be assigned to the renderer at initialization, which is the case for non-terrain rendering (i.e. block entities.) Likely, there is no performance benefit to caching this data in the first place, so the easiest solution is to just remove the code. * Bump version to 0.6.5 * Fix transforms not being run on fast path * Bump version to 0.6.6 * Rename model texture references to match Vanilla (CaffeineMC#2958) Custom models which extended these base models would not properly have their textures applied, as the texture references were accidentally changed. * Do not apply optimizations to sprites with special tickers * Aggressively optimize entity rendering This is anywhere from 10 to 15% faster depending on what entities are being rendered. Most of the improvements come from more efficiently laying out the cuboid data and coalescing neighboring 32-bit values into 64-bit words. Furthermore, vertex positions are calculated by extracting vectors from the pose matrix and adding them to the origin vertex, which avoids many matrix multiplications. Co-authored-by: MoePus <[email protected]> * Avoid quaternion transforms in particle rendering The billboard geometry can be computed using the camera's left and up vectors, saving some cycles. When rendering thousands of billboard particles, this was ~10% faster than baseline in my observation. Co-authored-by: MoePus <[email protected]> * Add shader source line annotations (CaffeineMC#2691) --------- Co-authored-by: IMS212 <[email protected]> Co-authored-by: JellySquid <[email protected]> Co-authored-by: douira <[email protected]> Co-authored-by: MeeniMc <[email protected]> Co-authored-by: JellySquid <[email protected]> Co-authored-by: IThundxr <[email protected]> Co-authored-by: muzikbike <[email protected]> Co-authored-by: MoePus <[email protected]>
1 parent b758900 commit 7e19b98

File tree

275 files changed

+7916
-3179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

275 files changed

+7916
-3179
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ body:
1717
- **Have you ensured that all of your mods (including Sodium) are up-to-date?** The latest version of Sodium
1818
can always be found [on Modrinth](https://modrinth.com/mod/sodium).
1919
20-
- **Have you read the [list of known driver incompatibilities](https://github.com/CaffeineMC/sodium-fabric/wiki/Driver-Compatibility)?** Most problems
20+
- **Have you read the [list of known driver incompatibilities](https://github.com/CaffeineMC/sodium/wiki/Driver-Compatibility)?** Most problems
2121
(including "poor performance") are caused by out-of-date or incompatible graphics drivers.
2222
23-
- **Have you used the [search tool](https://github.com/CaffeineMC/sodium-fabric/issues) to check whether your issue
23+
- **Have you used the [search tool](https://github.com/CaffeineMC/sodium/issues) to check whether your issue
2424
has already been reported?** If it has been, then consider adding more information to the existing issue instead.
2525
2626
- **Have you determined the minimum set of instructions to reproduce the issue?** If your problem only occurs

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ contact_links:
33
- name: For help with other issues, join our Discord community
44
url: https://caffeinemc.net/discord
55
about: This is the best option for getting help with mod installation, performance issues, and any other support inquiries
6-
# Copied from https://github.com/CaffeineMC/sodium-fabric#community
6+
# Copied from https://github.com/CaffeineMC/sodium#community

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ body:
1717
- type: markdown
1818
attributes:
1919
value: >-
20-
Make sure you have used the [search tool](https://github.com/CaffeineMC/sodium-fabric/issues) to see if a similar
20+
Make sure you have used the [search tool](https://github.com/CaffeineMC/sodium/issues) to see if a similar
2121
request already exists. If we have previously closed a feature request, then please do not create another request.
2222
- type: textarea
2323
id: description

.github/workflows/build-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
uses: actions/upload-artifact@v4
3939
with:
4040
name: sodium-artifacts-${{ steps.ref.outputs.branch }}
41-
path: build/libs/*.jar
41+
path: build/mods/*.jar

.github/workflows/build-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
uses: actions/upload-artifact@v4
2929
with:
3030
name: sodium-artifacts-${{ steps.ref.outputs.branch }}
31-
path: build/libs/*.jar
31+
path: build/mods/*.jar

.github/workflows/build-release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,5 @@ jobs:
2828
- name: Upload assets to GitHub
2929
uses: AButler/[email protected]
3030
with:
31-
# Filter built files to disregard -sources and -dev, and leave only the minecraft-compatible jars.
32-
files: 'build/libs/*[0-9].jar;LICENSE'
31+
files: 'build/mods/*.jar'
3332
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
uses: actions/upload-artifact@v4
3737
with:
3838
name: sodium-artifacts-${{ steps.ref.outputs.branch }}
39-
path: build/libs/*.jar
39+
path: build/mods/*.jar

README.md

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,53 @@
55
Sodium is a powerful rendering engine and optimization mod for the Minecraft client which improves frame rates and reduces
66
micro-stutter, while fixing many graphical issues in Minecraft.
77

8-
### 📥 Installation
8+
**This mod is the result of thousands of hours of development, and is made possible thanks to players like you.** If you
9+
would like to show a token of your appreciation for my work, and help support the development of Sodium in the process,
10+
then consider [buying me a coffee](https://caffeinemc.net/donate).
911

10-
The latest version of Sodium can be downloaded from our official [Modrinth](https://modrinth.com/mod/sodium) and
11-
[CurseForge](https://www.curseforge.com/minecraft/mc-mods/sodium) pages.
12+
<a href="https://caffeinemc.net/donate"><img src="https://storage.ko-fi.com/cdn/kofi2.png?v=3" width="180"/></a>
13+
14+
---
15+
16+
### 📥 Downloads
17+
18+
#### Stable builds
19+
20+
The latest stable release of Sodium can be downloaded from our official [Modrinth](https://modrinth.com/mod/sodium) and
21+
[CurseForge](https://www.curseforge.com/minecraft/mc-mods/sodium) pages.
22+
23+
#### Nightly builds (for developers)
24+
25+
We also provide bleeding-edge builds ("nightlies") which are useful for testing the very latest changes before they're
26+
packaged into a release. These builds are only provided for other mod developers and users with expert skills, and do
27+
not come with any support or warranty. It is often the case they have issues and lack compatibility with other mods.
28+
29+
The latest nightly build for each current branch of development can be downloaded below.
30+
31+
- Minecraft 1.21.4 (latest): [Download nightly](https://nightly.link/CaffeineMC/sodium/workflows/build-commit/dev/sodium-artifacts-dev.zip) or [View all builds](https://github.com/CaffeineMC/sodium/actions/workflows/build-commit.yml?query=branch%3Adev)
32+
- Minecraft 1.21.3: [Download nightly](https://nightly.link/CaffeineMC/sodium/workflows/build-commit/1.21.3%2Fstable/sodium-artifacts-1.21.3-stable.zip) or [View all builds](https://github.com/CaffeineMC/sodium/actions/workflows/build-commit.yml?query=branch%3A1.21.3%2Fstable)
33+
- Minecraft 1.21.1: [Download nightly](https://nightly.link/CaffeineMC/sodium/workflows/build-commit/1.21.1%2Fstable/sodium-artifacts-1.21.1-stable.zip) or [View all builds](https://github.com/CaffeineMC/sodium/actions/workflows/build-commit.yml?query=branch%3A1.21.1%2Fstable)
34+
35+
### 🖥️ Installation
1236

1337
Since the release of Sodium 0.6.0, both the _Fabric_ and _NeoForge_ mod loaders are supported. We generally recommend
1438
that new users prefer to use the _Fabric_ mod loader, since it is more lightweight and stable (for the time being.)
1539

16-
For more information about downloading and installing the mod, please refer to our [Installation Guide](https://github.com/CaffeineMC/sodium-fabric/wiki/Installation).
40+
For more information about downloading and installing the mod, please refer to our [Installation Guide](https://github.com/CaffeineMC/sodium/wiki/Installation).
1741

18-
### 🐛 Reporting Issues
42+
### 🙇 Getting Help
1943

20-
You can report bugs and crashes by opening an issue on our [issue tracker](https://github.com/CaffeineMC/sodium-fabric/issues).
21-
Before opening a new issue, use the search tool to make sure that your issue has not already been reported and ensure
22-
that you have completely filled out the issue template. Issues that are duplicates or do not contain the necessary
23-
information to triage and debug may be closed.
44+
For technical support (including help with mod installation problems and game crashes), please use our
45+
[official Discord server](https://caffeinemc.net/discord).
46+
47+
### 📬 Reporting Issues
48+
49+
If you do not need technical support and would like to report an issue (bug, crash, etc.) or otherwise request changes
50+
(for mod compatibility, new features, etc.), then we encourage you to open an issue on the
51+
[project issue tracker](https://github.com/CaffeineMC/sodium/issues).
2452

2553
Please note that while the issue tracker is open to feature requests, development is primarily focused on
26-
improving hardware compatibility, performance, and finishing any unimplemented features necessary for parity with
54+
improving compatibility, performance, and finishing any unimplemented features necessary for parity with
2755
the vanilla renderer.
2856

2957
### 💬 Join the Community
@@ -36,45 +64,40 @@ We have an [official Discord community](https://caffeinemc.net/discord) for all
3664

3765
## ✅ Hardware Compatibility
3866

39-
We only provide support for graphics cards which have up-to-date drivers for OpenGL 4.6. Most graphics cards which have
40-
been released since year 2010 are supported, such as the...
67+
We only provide official support for graphics cards which have up-to-date drivers that are compatible with OpenGL 4.5
68+
or newer. Most graphics cards released in the past 12 years will meet these requirements, including the following:
4169

4270
- AMD Radeon HD 7000 Series (GCN 1) or newer
4371
- NVIDIA GeForce 400 Series (Fermi) or newer
4472
- Intel HD Graphics 500 Series (Skylake) or newer
4573

46-
In some cases, older graphics cards may also work (so long as they have up-to-date drivers which have support for
47-
OpenGL 3.3), but they are not officially supported, and may not be compatible with future versions of Sodium.
74+
Nearly all graphics cards that are already compatible with Minecraft (which requires OpenGL 3.3) should also work
75+
with Sodium. But our team cannot ensure compatibility or provide support for older graphics cards, and they may
76+
not work with future versions of Sodium.
4877

4978
#### OpenGL Compatibility Layers
5079

5180
Devices which need to use OpenGL translation layers (such as GL4ES, ANGLE, etc) are not supported and will very likely
5281
not work with Sodium. These translation layers do not implement required functionality and they suffer from underlying
5382
driver bugs which cannot be worked around.
5483

55-
## 🛠️ Developer Guide
56-
57-
### Building from sources
84+
## 🛠️ Building from sources
5885

59-
Sodium uses a typical Gradle project structure and can be compiled by simply running the default `build` task. The build
60-
artifacts (typical mod binaries, and their sources) can be found in the `build/libs` directory.
86+
Sodium uses the [Gradle build tool](https://gradle.org/) and can be built with the `gradle build` command. The build
87+
artifacts (production binaries and their source bundles) can be found in the `build/mods` directory.
6188

62-
#### Requirements
89+
The [Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:using_wrapper) is provided for ease of use and will automatically download and install the
90+
appropriate version of Gradle for the project build. To use the Gradle wrapper, substitute `gradle` in build commands
91+
with `./gradlew.bat` (Windows) or `./gradlew` (macOS and Linux).
6392

64-
We recommend using a package manager (such as [SDKMAN](https://sdkman.io/)) to manage toolchain dependencies and keep
65-
them up to date. For many Linux distributions, these dependencies will be standard packages in your software
66-
repositories.
93+
### Build Requirements
6794

6895
- OpenJDK 21
69-
- We recommend using the [Eclipse Temurin](https://adoptium.net/) distribution, as it's known to be high quality
70-
and to work without issues.
71-
- Gradle 8.6.x (optional)
72-
- The [Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:using_wrapper) is provided
73-
in this repository can be used instead of installing a suitable version of Gradle yourself. However, if you are
74-
building many projects, you may prefer to install it yourself through a suitable package manager as to save disk
75-
space and to avoid many different Gradle daemons sitting around in memory.
96+
- We recommend using the [Eclipse Temurin](https://adoptium.net/) distribution as it's regularly tested by our developers and known
97+
to be of high quality.
98+
- Gradle 8.10.x
7699
- Typically, newer versions of Gradle will work without issues, but the build script is only tested against the
77-
version specified by the wrapper script.
100+
version used by the [wrapper script](/gradle/wrapper/gradle-wrapper.properties).
78101

79102
## 📜 License
80103

build.gradle.kts

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +0,0 @@
1-
plugins {
2-
id("java")
3-
id("fabric-loom") version ("1.7.3") apply (false)
4-
}
5-
6-
val MINECRAFT_VERSION by extra { "1.21.1" }
7-
val NEOFORGE_VERSION by extra { "21.1.46" }
8-
val FABRIC_LOADER_VERSION by extra { "0.16.4" }
9-
val FABRIC_API_VERSION by extra { "0.103.0+1.21.1" }
10-
11-
// This value can be set to null to disable Parchment.
12-
// TODO: Re-add Parchment
13-
val PARCHMENT_VERSION by extra { null }
14-
15-
// https://semver.org/
16-
val MOD_VERSION by extra { "0.6.0-beta.2" }
17-
18-
allprojects {
19-
apply(plugin = "java")
20-
apply(plugin = "maven-publish")
21-
}
22-
23-
tasks.withType<JavaCompile> {
24-
options.encoding = "UTF-8"
25-
}
26-
27-
tasks.jar {
28-
enabled = false
29-
}
30-
31-
subprojects {
32-
apply(plugin = "maven-publish")
33-
34-
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
35-
36-
37-
fun createVersionString(): String {
38-
val builder = StringBuilder()
39-
40-
val isReleaseBuild = project.hasProperty("build.release")
41-
val buildId = System.getenv("GITHUB_RUN_NUMBER")
42-
43-
if (isReleaseBuild) {
44-
builder.append(MOD_VERSION)
45-
} else {
46-
builder.append(MOD_VERSION.substringBefore('-'))
47-
builder.append("-snapshot")
48-
}
49-
50-
builder.append("+mc").append(MINECRAFT_VERSION)
51-
52-
if (!isReleaseBuild) {
53-
if (buildId != null) {
54-
builder.append("-build.${buildId}")
55-
} else {
56-
builder.append("-local")
57-
}
58-
}
59-
60-
return builder.toString()
61-
}
62-
63-
tasks.processResources {
64-
filesMatching("META-INF/neoforge.mods.toml") {
65-
expand(mapOf("version" to createVersionString()))
66-
}
67-
}
68-
69-
version = createVersionString()
70-
group = "net.caffeinemc.mods"
71-
72-
tasks.withType<JavaCompile> {
73-
options.encoding = "UTF-8"
74-
options.release.set(21)
75-
}
76-
77-
tasks.withType<GenerateModuleMetadata>().configureEach {
78-
enabled = false
79-
}
80-
}

buildSrc/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
gradlePluginPortal()
8+
}

0 commit comments

Comments
 (0)