Skip to content

Commit

Permalink
Port to Minecraft 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIllusiveC4 committed Dec 19, 2023
1 parent bda5804 commit fd9e2ba
Show file tree
Hide file tree
Showing 70 changed files with 1,508 additions and 327 deletions.
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* text eol=lf
*.bat text eol=crlf
*.patch text eol=lf
*.java text eol=lf
*.gradle text eol=crlf
*.png binary
*.gif binary
*.exe binary
*.dll binary
*.jar binary
*.lzma binary
*.zip binary
*.pyd binary
*.cfg text eol=lf
*.jks binary
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ body:
label: Minecraft Version
description: What version of Minecraft are you running? (Unlisted versions are unsupported)
options:
- 1.19.0
- 1.20.4
- 1.20.1
- 1.19.2
- 1.18.2
- 1.16.5
validations:
required: true
- type: textarea
Expand Down
6 changes: 3 additions & 3 deletions forge/.gitignore → .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ out
*.ipr
*.iws
*.iml
.idea
logs
.idea/*
!.idea/scopes

# gradle
build
.gradle
/classes

# other
eclipse
run
runs
3 changes: 3 additions & 0 deletions .idea/scopes/Fabric_sources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/scopes/Forge_sources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions forge/CHANGELOG.md → CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
Prior to version 3.1.0, this project used [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/).

## [5.0.0+1.20.4] - 2023.12.19
### Changed
- Updated to Minecraft 1.20.4

## [4.0.0+1.20.2] - 2023.10.19
### Changed
- Updated to Minecraft 1.20.2
Expand Down
6 changes: 3 additions & 3 deletions forge/CHANGELOG_LATEST.md → CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
Prior to version 3.1.0, this project used [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/).

This is a copy of the changelog for the most recent version. For the full version history, go [here](https://github.com/TheIllusiveC4/Caelus/blob/1.20.2/docs/CHANGELOG.md).
This is a copy of the changelog for the most recent version. For the full version history, go [here](https://github.com/TheIllusiveC4/Caelus/blob/1.20.4/docs/CHANGELOG.md).

## [4.0.0+1.20.2] - 2023.10.19
## [5.0.0+1.20.4] - 2023.12.19
### Changed
- Updated to Minecraft 1.20.2
- Updated to Minecraft 1.20.4
2 changes: 1 addition & 1 deletion docs/COPYING → COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
File renamed without changes.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2019-2021 C4
Copyright (C) 2019-2023 C4

Caelus is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
Expand Down
File renamed without changes.
222 changes: 222 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
import javax.net.ssl.HttpsURLConnection
import java.nio.charset.StandardCharsets

plugins {
// Required for NeoGradle
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
}

subprojects {
apply plugin: 'java'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.withSourcesJar()
java.withJavadocJar()

jar {
from(rootProject.file("LICENSE"))
from(rootProject.file("COPYING"))
from(rootProject.file("COPYING.LESSER"))
from(rootProject.file("README.md"))
from(rootProject.file("CHANGELOG.md"))
manifest {
attributes([
'Specification-Title' : mod_name,
'Specification-Vendor' : mod_author,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_author,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Timestamp' : System.currentTimeMillis(),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : minecraft_version
])
}
}

sourcesJar {
from(rootProject.file("LICENSE"))
from(rootProject.file("COPYING"))
from(rootProject.file("COPYING.LESSER"))
from(rootProject.file("README.md"))
from(rootProject.file("CHANGELOG.md"))
}

repositories {
mavenCentral()
maven {
name = 'Sponge / Mixin'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
name = 'BlameJared Maven (JEI / CraftTweaker / Bookshelf)'
url = 'https://maven.blamejared.com'
}
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.getRelease().set(17)
}

processResources {
def expandProps = [
"version" : version,
"group" : project.group, //Else we target the task's group.
"minecraft_version" : minecraft_version,
"forge_version" : forge_version,
"forge_loader_version_range" : forge_loader_version_range,
"forge_version_range" : forge_version_range,
"minecraft_version_range" : minecraft_version_range,
"minecraft_version_range_alt" : minecraft_version_range_alt,
"mod_name" : mod_name,
"mod_author" : mod_author,
"mod_id" : mod_id,
"license" : license,
"issues_url" : issues_url,
"sources_url" : sources_url,
"description" : project.description,
"neoforge_version" : neoforge_version,
"neoforge_loader_version_range": neoforge_loader_version_range
]

filesMatching(['pack.mcmeta', 'META-INF/mods.toml', '*.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
}

// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}

tasks.withType(Jar).all {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}

def publishDiscord() {
try {
def cfLinks = new StringJoiner('\\n')

if (project(':forge').hasProperty('curse_link')) {
cfLinks.add("[Forge](${project(':forge').findProperty('curse_link')})")
}

if (project(':neoforge').hasProperty('curse_link')) {
cfLinks.add("[NeoForge](${project(':neoforge').findProperty('curse_link')})")
}
def modrinthLinks = new StringJoiner('\\n')

if (project(':forge').hasProperty('modrinth_link')) {
modrinthLinks.add("[Forge](${project(':forge').findProperty('modrinth_link')})")
}

if (project(':neoforge').hasProperty('curse_link')) {
modrinthLinks.add("[NeoForge](${project(':neoforge').findProperty('modrinth_link')})")
}
println(cfLinks)
println(modrinthLinks)
def changelog = file("CHANGELOG_LATEST.md").getText()
changelog = changelog.substring(changelog.indexOf("##"))
changelog = changelog.replaceAll("\n", "\\\\n")

if (changelog.length() >= 1024) {
changelog = changelog.substring(0, changelog.length() - 100)
changelog = changelog + "...[(See more)](${changelog_link})"
}
println(changelog)
int color = 65392

if (release_type == "beta") {
color = 16763904
} else if (release_type == "alpha") {
color = 16724273
}
final String message = """
{
"embeds": [
{
"title": "${mod_name} ${version}",
"color": ${color},
"fields": [
{
"name": "Minecraft Versions",
"value": "${release_versions.replaceAll(",", ", ")}"
},
{
"name": "CurseForge",
"value": "${cfLinks}",
"inline": true
},
{
"name": "Modrinth",
"value": "${modrinthLinks}",
"inline": true
},
{
"name": "Changelog",
"value": "${changelog}"
}
],
"thumbnail": {
"url": "${discord_thumbnail}"
}
}
]
}
"""
println(message)
final URL url = new URL("${discordWebhook}")
final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection()
connection.addRequestProperty("Content-Type", "application/json; charset=UTF-8")
connection.addRequestProperty("User-Agent", "${mod_name} Gradle Upload")
connection.setDoOutput(true)
connection.setRequestMethod("POST")
connection.connect()

try (OutputStream out = connection.getOutputStream()) {
out.write(message.getBytes(StandardCharsets.UTF_8))
}
connection.getInputStream().close()
connection.disconnect()
} catch (IOException e) {
e.printStackTrace()
}
}

def ordered(String... dependencyPaths) {
def dependencies = dependencyPaths.collect { tasks.getByPath(it) }
for (int i = 0; i < dependencies.size() - 1; i++) {
dependencies[i + 1].mustRunAfter(dependencies[i])
}
return dependencies
}

tasks.register('publishForge') {
dependsOn ordered(':forge:modrinth', 'forge:publishCurseForge')

doLast {
publishDiscord()
}
}

tasks.register('publishNeoForge') {
dependsOn ordered(':neoforge:modrinth', 'neoforge:publishCurseForge')

doLast {
publishDiscord()
}
}

tasks.register('publishForgeNeoForge') {
dependsOn ordered(':forge:modrinth', 'forge:publishCurseForge', ':neoforge:modrinth', 'neoforge:publishCurseForge')

doLast {
publishDiscord()
}
}
54 changes: 54 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
plugins {
id 'idea'
id 'java'
id 'maven-publish'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
}
base {
archivesName = "${mod_id}-common"
}
minecraft {
version(minecraft_version)
if(file("src/main/resources/${mod_id}.accesswidener").exists()){
accessWideners(file("src/main/resources/${mod_id}.accesswidener"))
}
}

dependencies {
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
}

task apiJar(type: Jar) {
archiveClassifier.set('api')
include 'top/theillusivec4/caelus/api/**/*'
from sourceSets.main.allSource
from sourceSets.main.output
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId base.archivesName.get()
artifact jar
artifact sourcesJar
artifact apiJar
}
}
repositories {

if (project.hasProperty('urlMaven')) {

if (project.hasProperty('userMaven') && project.hasProperty('passMaven')) {

maven {
url urlMaven
credentials {
username userMaven
password passMaven
}
}
}
}
}
}
Loading

0 comments on commit fd9e2ba

Please sign in to comment.