Skip to content

Commit

Permalink
Sync with Framework
Browse files Browse the repository at this point in the history
  • Loading branch information
NotRyken committed Nov 26, 2024
1 parent 7d2050a commit cb29aba
Show file tree
Hide file tree
Showing 41 changed files with 585 additions and 181 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ on:
push:
paths: [
'**src/**',
'**/*gradle*',
LICENSE
'**/*gradle*'
]
pull_request:
paths: [
'**src/**',
'**/*gradle*',
LICENSE
'**/*gradle*'
]
workflow_dispatch:

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Synchronizes the repo's labels with labels.yml
# Synchronizes the repo's labels with a centralized labels.yml
# Requires GITHUB_TOKEN to have write permissions; if not, replace it with a custom token
name: Sync Labels

on:
push:
paths: ['.github/labels.yml', '.github/workflows/sync-labels.yml']
workflow_dispatch:

permissions:
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ run/
runs/
out/
classes/
.eclipse/

# IDEA
.idea/
Expand All @@ -22,5 +23,4 @@ classes/
.project

# Other
.env
/neoforge/.eclipse/
.env
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.5.10

- Added Russian translation (rfin0)
File renamed without changes.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ thinking of.
With this mod, wonder no more! A toast will pop up in the top right corner of your screen or just
above your hotbar (configurable), telling you what song you're about to listen to.

### License

[MIT](https://mit-license.org/)

### Contact

[![GitHub Issues](https://img.shields.io/github/issues/Scotsguy/now-playing?logo=github&label=Issues)](https://github.com/Scotsguy/now-playing/issues)

[![License](https://img.shields.io/github/license/scotsguy/now-playing?label=License&logo=github&logoColor=white)](https://github.com/scotsguy/now-playing/blob/HEAD/LICENSE.txt)
65 changes: 55 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,31 @@ plugins {
id("net.darkhax.curseforgegradle") version("${curseforgegradle_version}")
id("com.github.breadmoirai.github-release") version("${githubrelease_version}")
id("org.ajoberstar.grgit.service") version("${grgitservice_version}")
id("org.cadixdev.licenser") version("${licenser_version}")
}

subprojects {
version = mod_version
group = mod_group

// Publishing
if (name != "common") {

if (name == "common") {
// License headers
apply(plugin: "org.cadixdev.licenser")
String licenseDir = "src/main/resources/assets/${mod_id}/license/"
license {
// This can be done in multiloader-common.gradle but only if the
// "matching" method is not used (throws a pile of weird errors).
// Also, NeoForge's update of the plugin can't handle matching at all.
include("**/*.java") // Java files only
header = project.file(licenseDir + "HEADER.txt")
properties {
project_name = mod_name
owner_name = mod_owner
year = java.time.LocalDate.now().getYear().toString()
}
}
} else {
// Publishing
apply(plugin: "com.modrinth.minotaur")
apply(plugin: "net.darkhax.curseforgegradle")
apply(plugin: "com.github.breadmoirai.github-release")
Expand All @@ -24,8 +41,8 @@ subprojects {
projectId = modrinth_id
versionNumber = mod_version
versionType = release_type
versionName = "v${mod_version}-${capsLoader(name)}-${minecraft_version}"
changelog = rootProject.file("changelog.md").text
versionName = "v${mod_version}-${capsLoader(name)}"
changelog = versionChangelog()
uploadFile = name == "fabric" ? remapJar : jar
loaders = project.property("release_mod_loaders_${name}").split(",") as List
gameVersions = project.property("release_game_versions_${name}").split(",") as List
Expand Down Expand Up @@ -60,10 +77,10 @@ subprojects {
String module = project.name

def file = upload(curseforge_id, module == "fabric" ? remapJar : jar)
file.displayName = "v${mod_version}-${capsLoader(module)}-${minecraft_version}"
file.displayName = "v${mod_version}-${capsLoader(module)}"
file.releaseType = release_type
file.changelog = rootProject.file("changelog.md").text
file.changelogType = 'markdown'
file.changelog = versionChangelog()
file.changelogType = "markdown"
project.property("release_mod_loaders_${module}").split(",").each { String id ->
file.addModLoader(id)
}
Expand Down Expand Up @@ -96,8 +113,18 @@ subprojects {
repo = github_repo
tagName = "v${mod_version}"
prerelease = release_type == "alpha" || release_type == "beta"
releaseName = "v${mod_version} for ${minecraft_version}"
body = rootProject.file("changelog.md").text
releaseName = "v${mod_version}"

String changelog = "\n\n## Changelog\n\n" + versionChangelog()
String versions = "## MC versions\n\n"
if (project.hasProperty("release_game_versions_fabric"))
versions = String.format("%s - Fabric: %s\n", versions,
project.property("release_game_versions_fabric"))
if (project.hasProperty("release_game_versions_neoforge"))
versions = String.format("%s - NeoForge: %s\n", versions,
project.property("release_game_versions_neoforge"))
body = versions + changelog

targetCommitish = grgitService.service.get().grgit.branch.current().name
overwrite = false
allowUploadToExisting = true
Expand All @@ -109,6 +136,24 @@ subprojects {
}
}

String versionChangelog() {
List<String> lines = rootProject.file("CHANGELOG.md").readLines()
StringBuilder builder = new StringBuilder()
for (int i = 4; i < lines.size(); i++) {
String line = lines.get(i)
if (line.isBlank()) {
// pass
} else if (line.startsWith("## ")) {
break
}
else {
if (!builder.isEmpty()) builder.append("\n")
builder.append(line)
}
}
return builder.toString()
}

static String capsLoader(String loader) {
switch(loader) {
case "fabric": return "Fabric"
Expand Down
37 changes: 18 additions & 19 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

base {
archivesName = "${mod_id}-${project.name}-${minecraft_version}"
archivesName = "${mod_id}-${project.name}"
}

java {
Expand All @@ -19,32 +19,32 @@ repositories {
exclusiveContent {
forRepository {
maven {
name = 'Sponge'
url = 'https://repo.spongepowered.org/repository/maven-public'
name = "Sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
}
}
filter { includeGroupAndSubgroups('org.spongepowered') }
filter { includeGroupAndSubgroups("org.spongepowered") }
}
exclusiveContent {
forRepositories(
maven {
name = 'ParchmentMC'
url = 'https://maven.parchmentmc.org/'
},
maven {
name = "NeoForge"
url = 'https://maven.neoforged.net/releases'
}
maven {
name = "ParchmentMC"
url = "https://maven.parchmentmc.org"
},
maven {
name = "NeoForge"
url = "https://maven.neoforged.net/releases"
}
)
filter { includeGroup('org.parchmentmc.data') }
filter { includeGroup("org.parchmentmc.data") }
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
maven {
name = "Shedaniel"
url = "https://maven.shedaniel.me/"
url = "https://maven.shedaniel.me"
}
}

Expand All @@ -62,13 +62,13 @@ repositories {
}

sourcesJar {
from(rootProject.file("LICENSE")) {
from(rootProject.file("LICENSE.txt")) {
rename { "${it}_${mod_name}" }
}
}

jar {
from(rootProject.file("LICENSE")) {
from(rootProject.file("LICENSE.txt")) {
rename { "${it}_${mod_name}" }
}

Expand Down Expand Up @@ -104,7 +104,6 @@ processResources {
"mod_authors_string": mod_authors.replace(",", ", "),
"mod_contributors_string": mod_contributors.replace(",", ", "),
"mod_license": mod_license,
"mod_environment": mod_environment,
// Links
"homepage_url": homepage_url,
"sources_url": sources_url,
Expand All @@ -126,9 +125,9 @@ processResources {
// Dependencies
"clothconfig_versions_fabric_list": asJsonList(clothconfig_versions_fabric),
"clothconfig_versions_neoforge": clothconfig_versions_neoforge,
"modmenu_versions_fabric_list": asJsonList(modmenu_versions),
"modmenu_versions_fabric_list": asJsonList(modmenu_versions_fabric),
]
filesMatching(["pack.mcmeta", "*.mod.json", "META-INF/*mods.toml", "*.mixins.json"]) {
filesMatching(["pack.mcmeta", "*.mod.json", "META-INF/*mods.toml", "*.mixins.json", "assets/"+mod_id+"/lang/*.json"]) {
expand expandProps
}
inputs.properties(expandProps)
Expand Down
1 change: 0 additions & 1 deletion changelog.md

This file was deleted.

9 changes: 4 additions & 5 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ plugins {

dependencies {
compileOnly("org.spongepowered:mixin:${mixin_version}")
compileOnly("io.github.llamalad7:mixinextras-common:${mixinextras_version}")
annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}")

// Mod dependencies use NeoForge version to avoid remapping complications
implementation("me.shedaniel.cloth:cloth-config-neoforge:${clothconfig_version}")
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}"))

// Cloth Config API
api("me.shedaniel.cloth:cloth-config-neoforge:${clothconfig_version}")
}

neoForge {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
* Copyright (c) 2022-2024 AppleTheGolden
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
* OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.github.scotsguy.nowplaying;

import com.github.scotsguy.nowplaying.config.Config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
* Copyright (c) 2022-2024 AppleTheGolden
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
* OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.github.scotsguy.nowplaying.command;

import com.github.scotsguy.nowplaying.NowPlaying;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
* Copyright (c) 2022-2024 AppleTheGolden
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
* OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.github.scotsguy.nowplaying.config;

import com.github.scotsguy.nowplaying.NowPlaying;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
* Copyright (c) 2022-2024 AppleTheGolden
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
* OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.github.scotsguy.nowplaying.gui.screen;

import com.github.scotsguy.nowplaying.config.Config;
Expand All @@ -8,7 +30,7 @@

import static com.github.scotsguy.nowplaying.util.Localization.localized;

public class ClothConfigScreenProvider {
public class ClothScreenProvider {
/**
* Builds and returns a Cloth Config options screen.
* @param parent the current screen.
Expand Down
Loading

0 comments on commit cb29aba

Please sign in to comment.