Skip to content

Commit f88f4b5

Browse files
committed
Port to Minecraft 1.20.2 and add support for NeoForge.
1 parent df32707 commit f88f4b5

File tree

12 files changed

+260
-22
lines changed

12 files changed

+260
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ build
2121
eclipse
2222
run
2323
*.DS_Store
24+
runs

build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ buildscript {
1313
}
1414

1515
plugins {
16-
id 'fabric-loom' version '1.2-SNAPSHOT' apply(false)
17-
id 'net.minecraftforge.gradle' version '[6.0,6.2)' apply(false)
18-
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' apply(false)
19-
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' apply(false)
20-
id 'net.darkhax.curseforgegradle' version '1.1.16' apply(false)
21-
id 'com.modrinth.minotaur' version '2.8.0' apply(false)
16+
id 'net.darkhax.curseforgegradle' version '1.1.17' apply(false)
17+
id 'com.modrinth.minotaur' version '2.8.5' apply(false)
18+
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
2219
}
2320

2421
apply from: 'gradle/property_loader.gradle'
@@ -105,6 +102,11 @@ task postDiscord() {
105102

106103
downloadSources.add("<:fabric:916233929722314763> [Fabric](${project(':fabric').findProperty('curse_file_url')})")
107104
}
105+
106+
if (project(':neoforge').hasProperty('curse_file_url')) {
107+
108+
downloadSources.add("<:neoforge:1173939148806176779> [NeoForge](${project(':neoforge').findProperty('curse_file_url')})")
109+
}
108110

109111
// Add Curseforge DL link if available.
110112
def downloadString = downloadSources.toString()

common/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'org.spongepowered.gradle.vanilla'
2+
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
33
}
44
apply from: '../gradle/property_helper.gradle'
55

common/src/main/java/net/darkhax/archaeologybanners/content/PatternProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import net.darkhax.archaeologybanners.Constants;
44
import net.darkhax.bookshelf.api.Services;
55
import net.darkhax.bookshelf.api.registry.RegistryDataProvider;
6+
import net.minecraft.core.registries.Registries;
67
import net.minecraft.resources.ResourceLocation;
78
import net.minecraft.tags.TagKey;
89
import net.minecraft.world.item.BannerPatternItem;
@@ -35,7 +36,7 @@ public void createPattern(String name, String... subvariants) {
3536

3637
if (this.isBuiltIn() || Services.PLATFORM.isModLoaded(this.getSourceId())) {
3738

38-
final TagKey<BannerPattern> patternsTag = Services.TAGS.bannerPatternTag(new ResourceLocation(Constants.MOD_ID, "pattern_item/" + this.getSourceId() + "/" + name));
39+
final TagKey<BannerPattern> patternsTag = TagKey.create(Registries.BANNER_PATTERN, new ResourceLocation(Constants.MOD_ID, "pattern_item/" + this.getSourceId() + "/" + name));
3940
registry.items.add(() -> new BannerPatternItem(patternsTag, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON)), registryName + "_banner_pattern");
4041
}
4142
}

fabric/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom'
2+
id 'fabric-loom' version '1.2-SNAPSHOT'
33
id 'net.darkhax.curseforgegradle'
44
id 'com.modrinth.minotaur'
55
id 'idea'

fabric/src/main/resources/fabric.mod.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
]
2525
},
2626
"depends": {
27-
"fabricloader": ">=0.14.21",
27+
"fabricloader": ">=0.14.24",
2828
"fabric": "*",
29-
"minecraft": "1.20.1",
29+
"minecraft": "${minecraft_version}",
3030
"java": ">=17",
31-
"bookshelf": ">=20"
31+
"bookshelf": ">=21"
3232
},
3333
"custom": {
3434
"modmenu": {

forge/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
2-
id 'net.minecraftforge.gradle'
2+
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
3+
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
34
id 'net.darkhax.curseforgegradle'
45
id 'com.modrinth.minotaur'
5-
id 'org.spongepowered.mixin'
66
}
77

88
apply from: '../gradle/patreon.gradle'
@@ -190,7 +190,6 @@ task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge)
190190
apiToken = findProperty('curse_auth')
191191

192192
def mainFile = upload(curse_project, jar)
193-
mainFile.addModLoader('NeoForge')
194193
mainFile.releaseType = 'release'
195194
mainFile.addGameVersion('Client', 'Server')
196195
mainFile.changelogType = 'markdown'

gradle.properties

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# Project
2-
version=5.1
2+
version=6.0
33
group=net.darkhax.archaeologybanners
44

55
# Common
6-
minecraft_version=1.20.1
7-
bookshelf_version=20.0.1
6+
minecraft_version=1.20.2
7+
bookshelf_version=21.0.10
88

99
# Forge
10-
forge_version=47.1.44
10+
forge_version=48.0.37
11+
12+
# NeoForge
13+
neoforge_version=20.2.47-beta
14+
neoforge_version_range=20.2,
1115

1216
# Fabric
13-
fabric_version=0.87.0+1.20.1
14-
fabric_loader_version=0.14.22
17+
fabric_version=0.90.7+1.20.2
18+
fabric_loader_version=0.14.24
1519

1620
# Mod options
1721
mod_name=ArchaeologyBanners

neoforge/build.gradle

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
plugins {
2+
id 'net.neoforged.gradle.userdev' version '7.0.43'
3+
id 'net.darkhax.curseforgegradle'
4+
id 'com.modrinth.minotaur'
5+
}
6+
7+
apply from: '../gradle/patreon.gradle'
8+
9+
base {
10+
archivesName = "${mod_name}-NeoForge-${minecraft_version}"
11+
}
12+
13+
runs {
14+
configureEach {
15+
modSource project.sourceSets.main
16+
}
17+
client {
18+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
19+
}
20+
server {
21+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
22+
programArgument '--nogui'
23+
}
24+
25+
gameTestServer {
26+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
27+
}
28+
}
29+
30+
dependencies {
31+
implementation "net.neoforged:neoforge:${neoforge_version}"
32+
implementation "net.darkhax.bookshelf:Bookshelf-NeoForge-${project.ext.minecraft_version}:${project.ext.bookshelf_version}"
33+
compileOnly project(':common')
34+
}
35+
36+
// NeoGradle compiles the game, but we don't want to add our common code to the game's code
37+
TaskCollection.metaClass.excludingNeoTasks = { ->
38+
delegate.matching { !it.name.startsWith("neo") }
39+
}
40+
41+
tasks.withType(JavaCompile).excludingNeoTasks().configureEach {
42+
source(project(':common').sourceSets.main.allSource)
43+
}
44+
45+
tasks.withType(Javadoc).excludingNeoTasks().configureEach {
46+
source(project(':common').sourceSets.main.allJava)
47+
}
48+
49+
tasks.named("sourcesJar", Jar) {
50+
from(project(':common').sourceSets.main.allSource)
51+
}
52+
53+
tasks.withType(ProcessResources).excludingNeoTasks().configureEach {
54+
from project(':common').sourceSets.main.resources
55+
}
56+
57+
processResources {
58+
59+
from project(":common").sourceSets.main.resources
60+
61+
def buildProps = project.properties.clone()
62+
63+
// Replaces FML's magic file.jarVersion string with the correct version at
64+
// build time.
65+
buildProps.put('file', [jarVersion: project.version])
66+
67+
if (project.hasProperty('patreon')) {
68+
69+
def supporters = new ArrayList<String>()
70+
71+
for (entry in project.ext.patreon.pledges) {
72+
73+
def pledge = entry.value;
74+
75+
if (pledge.isValid()) {
76+
77+
supporters.add(pledge.getDisplayName())
78+
}
79+
}
80+
81+
buildProps.put('mod_supporters', supporters.join(', '))
82+
}
83+
84+
filesMatching('*.mixins.json') {
85+
filter(org.apache.tools.ant.filters.LineContains, negate: true, contains: ['refmap' ] )
86+
}
87+
88+
filesMatching(['META-INF/mods.toml', 'pack.mcmeta', '*.mixins.json']) {
89+
90+
expand buildProps
91+
}
92+
}
93+
94+
// -- MAVEN PUBLISHING --
95+
project.publishing {
96+
97+
publications {
98+
99+
mavenJava(MavenPublication) {
100+
101+
artifactId = base.archivesName.get()
102+
from components.java
103+
}
104+
}
105+
106+
repositories {
107+
108+
maven {
109+
110+
// Sets maven credentials if they are provided. This is generally
111+
// only used for external/remote uploads.
112+
if (project.hasProperty('mavenUsername') && project.hasProperty('mavenPassword')) {
113+
114+
credentials {
115+
116+
username findProperty('mavenUsername')
117+
password findProperty('mavenPassword')
118+
}
119+
}
120+
121+
url getDefaultString('mavenURL', 'undefined', true)
122+
}
123+
}
124+
}
125+
126+
// CurseForge Publishing
127+
task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
128+
129+
apiToken = findProperty('curse_auth')
130+
131+
def mainFile = upload(curse_project, jar)
132+
mainFile.changelogType = 'markdown'
133+
mainFile.changelog = project.ext.mod_changelog
134+
mainFile.addJavaVersion('Java 17')
135+
mainFile.releaseType = 'release'
136+
mainFile.addGameVersion('Server', 'Client')
137+
mainFile.addRequirement('bookshelf')
138+
139+
// Append Patreon Supporters
140+
def patreonInfo = project.findProperty('patreon')
141+
142+
if (patreonInfo) {
143+
mainFile.changelog += "\n\nThis project is made possible by [Patreon](${patreonInfo.campaignUrlTracked}) support from players like you. Thank you!\n\n${patreonInfo.pledgeLog}"
144+
}
145+
146+
doLast {
147+
148+
if (project.hasProperty('mod_homepage')) {
149+
150+
project.ext.curse_file_url = "${mod_homepage}/files/${mainFile.curseFileId}"
151+
}
152+
}
153+
}
154+
155+
// Modrinth
156+
modrinth {
157+
158+
def patreonInfo = project.findProperty('patreon')
159+
def changelog = project.ext.mod_changelog
160+
161+
if (patreonInfo) {
162+
changelog += "\n\nThis project is made possible by [Patreon](${patreonInfo.campaignUrlTracked}) support from players like you. Thank you!\n\n${patreonInfo.pledgeLog}"
163+
}
164+
165+
token.set(project.findProperty('modrinth_auth'))
166+
projectId.set(modrinth_project)
167+
changelog = changelog
168+
versionName.set("${mod_name}-NeoForge-${minecraft_version}-$version")
169+
versionType.set('release')
170+
uploadFile.set(tasks.jar)
171+
loaders = ["neoforge"]
172+
gameVersions = ["${minecraft_version}"]
173+
174+
dependencies {
175+
required.project('bookshelf-lib')
176+
}
177+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package net.darkhax.archaeologybanners;
2+
3+
import net.neoforged.fml.common.Mod;
4+
5+
@Mod(Constants.MOD_ID)
6+
public class ArchaeologyBannersNeoForge {
7+
8+
public ArchaeologyBannersNeoForge() {
9+
10+
Content.init();
11+
}
12+
}

0 commit comments

Comments
 (0)