Skip to content

Commit

Permalink
Port to NeoForge 1.20.4
Browse files Browse the repository at this point in the history
Signed-off-by: unilock <[email protected]>
  • Loading branch information
unilock committed Jul 8, 2024
1 parent 3e34fb3 commit 27bb532
Show file tree
Hide file tree
Showing 94 changed files with 8,105 additions and 321 deletions.
35 changes: 5 additions & 30 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
*.java text eol=lf diff=java
*.gradle text eol=lf diff=java
*.kt text eol=lf diff=kotlin
*.kts text eol=lf diff=kotlin
gradlew text eol=lf
*.bat text eol=crlf

*.md text eol=lf diff=markdown

.editorconfig text eol=lf

*.json text eol=lf
*.json5 text eol=lf
*.properties text eol=lf
*.toml text eol=lf
*.xml text eol=lf diff=html

# Modding specific
*.accesswidener text eol=lf

# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.class binary
*.dll binary
*.ear binary
*.jar binary
*.jks binary
*.png binary
*.so binary
*.war binary
# Disable autocrlf on generated files, they always generate with LF
# Add any extra files or paths here to make git stop saying they
# are changed when only line endings change.
src/generated/**/.cache/cache text eol=lf
src/generated/**/*.json text eol=lf
41 changes: 10 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,24 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defense
# against bad commits.
name: Build

name: build
on: [pull_request, push, workflow_dispatch]
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
with:
fetch-depth: 0
fetch-tags: true

- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: microsoft

- name: Setup Gradle caches
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/loom-cache
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle

- name: Make Gradle wrapper executable
run: chmod +x ./gradlew

- name: Build
run: ./gradlew build
java-version: '17'
distribution: 'temurin'

- name: Upload artifacts
uses: actions/upload-artifact@v4
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
name: Artifacts
path: build/libs/
arguments: build
46 changes: 19 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
# Gradle
.gradle/
build/
out/
classes/

# Fabric Loom
remappedSrc/
run/

# Eclipse
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# IntelliJ Idea
.idea/
*.iml
# idea
out
*.ipr
*.iws
*.iml
.idea

# Fleet
.fleet/

# Visual Studio Code
.settings/
.vscode/
bin/
.classpath
.project
# gradle
build
.gradle

# Eclipse JDT LS
workspace/
# other
eclipse
run
runs
run-data

# macOS
*.DS_Store
repo
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Nilcord

A Discord bridge for Minecraft using Fabric.
A Discord bridge for Minecraft using NeoForge.

Contains TextPlaceholderAPI remapped to Mojmaps and ported to FML; licensed [LGPL-3.0](https://github.com/Patbox/TextPlaceholderAPI/blob/1.20.3/LICENSE).
143 changes: 87 additions & 56 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,93 +1,124 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.153'
}

version = "${project.mod_version}+${project.minecraft_version}+fabric"
group = project.maven_group

base {
archivesName = project.archives_base_name
}
version = mod_version
group = mod_group_id

repositories {
maven { url 'https://maven.nucleoid.xyz/' }
maven { url 'https://repo.sleeping.town/' }
mavenCentral()
}

loom {
mods {
"nilcord" {
sourceSet("main")
}
}
base {
archivesName = mod_id
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation include("eu.pb4:placeholder-api:${project.papi_version}")
runs {
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'

implementation include("net.dv8tion:JDA:${project.jda_version}") {
exclude module: 'opus-java'
systemProperty 'forge.logging.console.level', 'debug'

modSource project.sourceSets.main
}

client {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}
implementation include("folk.sisby:kaleido-config:${project.kaleido_version}")

include("com.fasterxml.jackson.core:jackson-core:2.16.0")
include("com.fasterxml.jackson.core:jackson-databind:2.16.0")
include("com.fasterxml.jackson.core:jackson-annotations:2.16.0")
include("com.neovisionaries:nv-websocket-client:2.14")
include("com.squareup.okhttp3:okhttp:4.12.0")
include("com.squareup.okio:okio-jvm:3.9.0")
include("net.sf.trove4j:trove4j:3.0.3")
include("org.apache.commons:commons-collections4:4.4")
include("org.jetbrains.kotlin:kotlin-stdlib:1.9.23")
include("org.slf4j:slf4j-api:2.0.12") // Use 2.0 instead of 1.0
}

processResources {
inputs.property "version", project.version
server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}

gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

filesMatching("fabric.mod.json") {
expand "version": project.version
data {
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
sourceSets.main.resources { srcDir 'src/generated/resources' }

jarJar.enable()

configurations {
runtimeClasspath.extendsFrom localRuntime
}

java {
withSourcesJar()
dependencies {
implementation "net.neoforged:neoforge:${neo_version}"

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
implementation jarJar("net.dv8tion:JDA:${project.jda_version}") {
exclude module: 'opus-java'
}
implementation jarJar("folk.sisby:kaleido-config:${project.kaleido_version}")

jarJar("com.fasterxml.jackson.core:jackson-core:2.16.0")
jarJar("com.fasterxml.jackson.core:jackson-databind:2.16.0")
jarJar("com.fasterxml.jackson.core:jackson-annotations:2.16.0")
jarJar("com.neovisionaries:nv-websocket-client:2.14")
jarJar("com.squareup.okhttp3:okhttp:4.12.0")
jarJar("com.squareup.okio:okio-jvm:3.9.0")
jarJar("net.sf.trove4j:trove4j:3.0.3")
jarJar("org.apache.commons:commons-collections4:4.4")
jarJar("org.jetbrains.kotlin:kotlin-stdlib:1.9.23")
jarJar("org.slf4j:slf4j-api:2.0.12") // Use 2.0 instead of 1.0
}

jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}" }
tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range : minecraft_version_range,
neo_version : neo_version,
neo_version_range : neo_version_range,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : mod_name,
mod_license : mod_license,
mod_version : mod_version,
mod_authors : mod_authors,
mod_description : mod_description
]
inputs.properties replaceProperties

filesMatching(['META-INF/mods.toml']) {
expand replaceProperties
}
}

// Configure the maven publication
// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
create("mavenJava", MavenPublication) {
register('mavenJava', MavenPublication) {
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
maven {
url "file://${project.projectDir}/repo"
}
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
36 changes: 22 additions & 14 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true
#org.gradle.jvmargs=
org.gradle.daemon=false
org.gradle.debug=false

# Fabric Properties
# Check these on https://fabricmc.net/develop
neogradle.subsystems.parchment.minecraftVersion=1.20.4
neogradle.subsystems.parchment.mappingsVersion=2024.04.14

## Environment Properties
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.11
minecraft_version_range=[1.20.3,)
neo_version=20.4.237
neo_version_range=[20.3,)
loader_version_range=[2,)

## Mod Properties

mod_id=nilcord
mod_name=nilcord
mod_license=MIT
mod_version=2.3.0
mod_group_id=cc.unilock.nilcord
mod_authors=unilock
mod_description=A Discord bridge for Minecraft using NeoForge.

# Mod Properties
mod_version=2.3.1
maven_group=cc.unilock.nilcord
archives_base_name=nilcord
## Dependencies

# Dependencies
fabric_version=0.97.0+1.20.4
jda_version=5.0.0-beta.24
kaleido_version=0.3.1+1.3.1
papi_version=2.3.0+1.20.3
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading

0 comments on commit 27bb532

Please sign in to comment.