Skip to content

Commit

Permalink
Add ability to disable first-person dynamic lighting.
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Dec 23, 2022
1 parent 8419490 commit c40cc0c
Show file tree
Hide file tree
Showing 23 changed files with 243 additions and 98 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/gradle_build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
name: Gradle Build

on: [push, pull_request]
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
build:
strategy:
matrix:
java: [ 17, 19 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
- uses: actions/checkout@v3
with:
java-version: 17
fetch-depth: 0
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'gradle'

- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build --parallel --stacktrace

- uses: actions/upload-artifact@v2
with:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/maven_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ on:
- '*'

jobs:
publish:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/modrinth_update.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'

- name: Build with Gradle
run: ./gradlew build modrinth curseforge --parallel --stacktrace
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}

- uses: actions/upload-artifact@v2
with:
name: Artifacts
path: ./build/libs/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# LambdAurora's ignore file
#
# v0.20
# v0.21

# JetBrains
.idea/
Expand Down Expand Up @@ -37,6 +37,8 @@ CMakeFiles/
.gradle/
## Node.JS
node_modules/
## PHP composer
vendor/

# Editors
## VSCode
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@

- Fixed dependencies declaration.

## 2.2.0

- Added option to disable self dynamic lighting.
- Updated Russian translations ([#116](https://github.com/LambdAurora/LambDynamicLights/pull/116), [#121](https://github.com/LambdAurora/LambDynamicLights/pull/121)).
- Added Ukrainian translations ([#120](https://github.com/LambdAurora/LambDynamicLights/pull/120)).

[SpruceUI]: https://github.com/LambdAurora/SpruceUI "SpruceUI page"
[pridelib]: https://github.com/Queerbric/pridelib "Pridelib page"
[Sodium]: https://modrinth.com/mod/sodium "Sodium Modrinth page"
Expand Down
113 changes: 90 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
plugins {
id 'fabric-loom' version '0.12.+'
id 'io.github.juuxel.loom-quiltflower' version '1.7.+'
id 'org.quiltmc.quilt-mappings-on-loom' version '4.0.0'
id 'fabric-loom' version '1.+'
id 'io.github.juuxel.loom-quiltflower' version '1.8.+'
id 'org.quiltmc.gradle.licenser' version '1.1.+'
id 'java-library'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.modrinth.minotaur' version '2.+'
id 'com.matthewprenger.cursegradle' version '1.4.+'
}

import com.modrinth.minotaur.dependencies.ModDependency

group = project.maven_group
version = "${project.mod_version}+${getMCVersionString()}"
version = "${project.mod_version}+${project.minecraft_version}"
archivesBaseName = project.archives_base_name

// This field defines the Java version your mod target.
Expand All @@ -31,19 +31,56 @@ String getMCVersionString() {
return version[0] + '.' + version[1]
}

String getVersionType() {
if (isMCVersionNonRelease() || version.contains("-alpha.")) {
return "alpha"
} else if (version.contains("-beta.")) {
return "beta"
} else {
return "release"
}
}

String parseReadme() {
def excludeRegex = /(?m)<!-- modrinth_exclude\.start -->(.|\n)*?<!-- modrinth_exclude\.end -->/
def linkRegex = /!\[([A-z_ ]+)]\((images\/[A-z.\/_]+)\)/

def readme = (String) file('README.md').text
readme = readme.replaceAll(excludeRegex, '')
readme = readme.replaceAll(linkRegex, '![$1](https://raw.githubusercontent.com/LambdAurora/LambDynamicLights/1.17/$2)')
readme = readme.replaceAll(linkRegex, '![$1](https://raw.githubusercontent.com/LambdAurora/LambDynamicLights/1.19/$2)')
return readme
}

String fetchChangelog() {
def changelogText = file('CHANGELOG.md').text
def regexVersion = ((String) project.mod_version).replaceAll('\\.', /\\./).replaceAll('\\+', '\\+')
def changelogRegex = ~"###? ${regexVersion}\\n\\n(( *- .+\\n)+)"
def matcher = changelogText =~ changelogRegex

if (matcher.find()) {
def changelogContent = matcher.group(1)

def changelogLines = changelogText.split('\n')
def linkRefRegex = ~'^\\[([A-z\\d _\\-/+.]+)]: '
for (int i = changelogLines.length - 1; i > 0; i--) {
def line = changelogLines[i]
if ((line =~ linkRefRegex).find())
changelogContent += '\n' + line
else break
}
return changelogContent
} else {
return null;
}
}

repositories {
mavenLocal()
mavenCentral()
maven {
name "Quilt"
url "https://maven.quiltmc.org/repository/release"
}
maven {
name 'Terraformers'
url 'https://maven.terraformersmc.com/releases/'
Expand All @@ -69,9 +106,7 @@ loom {

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings(loom.layered {
addLayer(quiltMappings.mappings("org.quiltmc:quilt-mappings:${minecraft_version}+build.${project.quilt_mappings}:v2"))
})
mappings "org.quiltmc:quilt-mappings:${minecraft_version}+build.${project.quilt_mappings}:intermediary-v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
Expand Down Expand Up @@ -143,29 +178,61 @@ modrinth {
]

// Changelog fetching
def changelogText = file('CHANGELOG.md').text
def regexVersion = ((String) project.mod_version).replaceAll('\\.', /\\./).replaceAll('\\+', '\\+')
def changelogRegex = ~"###? ${regexVersion}\\n\\n(( *- .+\\n)+)"
def matcher = changelogText =~ changelogRegex
def changelogContent = fetchChangelog()

if (matcher.find()) {
def changelogContent = matcher.group(1)

def changelogLines = changelogText.split('\n')
def linkRefRegex = ~'^\\[([A-z0-9 _\\-/+.]+)]: '
for (int i = changelogLines.length - 1; i > 0; i--) {
def line = changelogLines[i]
if ((line =~ linkRefRegex).find())
changelogContent += '\n' + line
else break
}
if (changelogContent) {
changelog = changelogContent
} else {
afterEvaluate {
tasks.modrinth.setEnabled(false)
}
}
}
tasks.modrinth.dependsOn(tasks.modrinthSyncBody)

curseforge {
if (System.getenv("CURSEFORGE_TOKEN")) {
apiKey = System.getenv("CURSEFORGE_TOKEN")
}

project {
id = project.curseforge_id
releaseType = this.getVersionType()
addGameVersion project.minecraft_version
addGameVersion "Fabric"
addGameVersion "Quilt"
addGameVersion "Java 17"
addGameVersion "Java 18"

// Changelog fetching
def changelogContent = fetchChangelog()

if (changelogContent) {
changelogType = "markdown"
changelog = "Changelog:\n\n${changelogContent}"
} else {
afterEvaluate {
uploadTask.setEnabled(false)
}
}

mainArtifact(remapJar) {
displayName = "LambDynamicLights ${project.mod_version} (${project.minecraft_version})"

relations {
requiredDependency "fabric-api"
optionalDependency "modmenu"
incompatible "optifabric"
}
}

afterEvaluate {
uploadTask.setGroup("publishing")
uploadTask.dependsOn("remapJar")
}
}
}
tasks.curseforge.setGroup("publishing")

// configure the maven publication
publishing {
Expand Down
15 changes: 8 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19
quilt_mappings=1
loader_version=0.12.12
minecraft_version=1.19.2
quilt_mappings=21
loader_version=0.14.10
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_api_version=0.55.3+1.19
fabric_api_version=0.68.0+1.19.2

# Mod Properties
mod_version = 2.1.2
mod_version = 2.2.0
maven_group = dev.lambdaurora
archives_base_name = lambdynamiclights
modrinth_id=yBW8D80W
curseforge_id=393442

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
spruceui_version=4.0.0+1.19
spruceui_version=4.1.0+1.19.2
pridelib_version=1.1.2+1.19
modmenu_version=4.0.0
modmenu_version=4.1.2
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit c40cc0c

Please sign in to comment.