Skip to content

Commit d93219b

Browse files
committed
1.21, the rest of the owl
1 parent 885aef5 commit d93219b

File tree

426 files changed

+23415
-23149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

426 files changed

+23415
-23149
lines changed

.github/workflows/gradle.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
uses: actions/setup-java@v4
1212
with:
1313
distribution: 'temurin'
14-
java-version: '17'
14+
java-version: '21'
1515

1616
- name: Validate gradlew integrity
1717
uses: gradle/actions/wrapper-validation@v3
@@ -24,19 +24,23 @@ jobs:
2424
~/.gradle/wrapper
2525
./.gradle/loom-cache/remapped-mods
2626
./build/moddev
27-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle', './build.properties', './settings.gradle', '**/gradle-wrapper.properties') }}
27+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle', './gradle.properties', './settings.gradle', '**/gradle-wrapper.properties') }}
2828

2929
- name: Calculate artifact names
3030
id: calculate_artifact_names
3131
run: |
32-
MC=$(awk -F '=' '/mc_version/ { print $2; }' build.properties)
33-
BUILD=$(awk -F '=' '/build_number/ { print $2; }' build.properties)
32+
MC=$(awk -F '=' '/mc_version/ { print $2; }' gradle.properties)
33+
BUILD=$(awk -F '=' '/build_number/ { print $2; }' gradle.properties)
3434
echo "forge=build/libs/Psi-${MC}-${BUILD}.jar" >> "$GITHUB_OUTPUT"
3535
36-
- name: Build with Gradle
36+
- name: Lint files
37+
run : |
38+
./gradlew checkSyntax
39+
40+
- name: Build
3741
run: |
3842
RELEASE_MODE=${{ startsWith(github.ref, 'refs/tags/release-') && '1' || '0' }} \
39-
./gradlew pmdMain spotlessJavaCheck build
43+
./gradlew build
4044
4145
- name: PMD report
4246
uses: jwgmeligmeyling/pmd-github-action@v1

build.gradle

Lines changed: 24 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ plugins {
33
id 'eclipse'
44
id 'idea'
55
id 'maven-publish'
6+
id 'pmd'
7+
id 'com.diffplug.spotless' version '7.0.3'
68
id 'net.neoforged.gradle.userdev' version '7.0.152'
79
}
810

911
tasks.named('wrapper', Wrapper).configure {
10-
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
11-
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
12-
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
13-
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
14-
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
1512
distributionType = Wrapper.DistributionType.BIN
1613
}
1714

@@ -35,33 +32,37 @@ base {
3532
archivesName = mod_id
3633
}
3734

35+
spotless {
36+
java {
37+
target project.fileTree(dir: 'src/main/java/vazkii/psi', include: '**/*.java')
38+
eclipse().configFile 'spotless/eclipseformat.xml'
39+
removeUnusedImports()
40+
importOrderFile 'spotless/eclipse.importorder'
41+
replaceRegex 'Too much space after if', '(if|for|while|switch) +\\(', '$1('
42+
}
43+
}
44+
45+
pmd {
46+
ruleSetFiles = files("spotless/pmd-ruleset.xml")
47+
}
48+
49+
tasks.register('checkSyntax') {
50+
dependsOn spotlessJavaCheck, pmdMain
51+
}
52+
3853
// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
3954
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
4055

4156
minecraft.accessTransformers.file file('src/main/resources/META-INF/accesstransformer.cfg')
4257

43-
// Default run configurations.
44-
// These can be tweaked, removed, or duplicated as needed.
4558
runs {
46-
// applies to all the run configs below
4759
configureEach {
48-
// Recommended logging data for a userdev environment
49-
// The markers can be added/remove as needed separated by commas.
50-
// "SCAN": For mods scan.
51-
// "REGISTRIES": For firing of registry events.
52-
// "REGISTRYDUMP": For getting the contents of all registries.
5360
systemProperty 'forge.logging.markers', 'REGISTRIES'
54-
55-
// Recommended logging level for the console
56-
// You can set various levels here.
57-
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
5861
systemProperty 'forge.logging.console.level', 'debug'
59-
6062
modSource project.sourceSets.main
6163
}
6264

6365
client {
64-
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
6566
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
6667
}
6768

@@ -70,13 +71,6 @@ runs {
7071
programArgument '--nogui'
7172
}
7273

73-
// This run config launches GameTestServer and runs all registered gametests, then exits.
74-
// By default, the server will crash when no gametests are provided.
75-
// The gametest system is also enabled by default for other run configs under the /test command.
76-
gameTestServer {
77-
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
78-
}
79-
8074
data {
8175
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
8276
// workingDirectory project.file('run-data')
@@ -86,24 +80,12 @@ runs {
8680
}
8781
}
8882

89-
// Include resources generated by data generators.
9083
sourceSets.main.resources { srcDir 'src/generated/resources' }
91-
92-
// Sets up a dependency configuration called 'localRuntime'.
93-
// This configuration should be used instead of 'runtimeOnly' to declare
94-
// a dependency that will be present for runtime testing but that is
95-
// "optional", meaning it will not be pulled by dependents of this mod.
9684
configurations {
9785
runtimeClasspath.extendsFrom localRuntime
9886
}
9987

10088
dependencies {
101-
// Specify the version of Minecraft to use.
102-
// Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above.
103-
// The group for userdev is net.neoforged, the module name is neoforge, and the version is the same as the neoforge version.
104-
// You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader.
105-
// And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version.
106-
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
10789
implementation "net.neoforged:neoforge:${neo_version}"
10890

10991
// Example optional mod dependency with JEI
@@ -113,29 +95,11 @@ dependencies {
11395
// We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it
11496
localRuntime "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
11597

116-
compileOnly "vazkii.patchouli:Patchouli:1.21-87-NEOFORGE:api"
117-
runtimeOnly "vazkii.patchouli:Patchouli:1.21-87-NEOFORGE"
118-
119-
// Example mod dependency using a mod jar from ./libs with a flat dir repository
120-
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
121-
// The group id is ignored when searching -- in this case, it is "blank"
122-
// implementation "blank:coolmod-${mc_version}:${coolmod_version}"
123-
124-
// Example mod dependency using a file as dependency
125-
// implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
126-
127-
// Example project dependency using a sister or child project:
128-
// implementation project(":myproject")
129-
130-
// For more info:
131-
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
132-
// http://www.gradle.org/docs/current/userguide/dependency_management.html
98+
compileOnly "vazkii.patchouli:Patchouli:${patchouli_version}-NEOFORGE:api"
99+
runtimeOnly "vazkii.patchouli:Patchouli:${patchouli_version}-NEOFORGE"
133100
}
134101

135-
// This block of code expands all declared replace properties in the specified resource targets.
136-
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
137-
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
138-
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
102+
139103
tasks.withType(ProcessResources).configureEach {
140104
var replaceProperties = [
141105
minecraft_version : minecraft_version,
@@ -157,25 +121,11 @@ tasks.withType(ProcessResources).configureEach {
157121
}
158122
}
159123

160-
// Example configuration to allow publishing using the maven-publish plugin
161-
publishing {
162-
publications {
163-
register('mavenJava', MavenPublication) {
164-
from components.java
165-
}
166-
}
167-
repositories {
168-
maven {
169-
url "file://${project.projectDir}/repo"
170-
}
171-
}
172-
}
173124

174125
tasks.withType(JavaCompile).configureEach {
175-
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
126+
options.encoding = 'UTF-8'
176127
}
177128

178-
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
179129
idea {
180130
module {
181131
downloadSources = true

build.properties

Lines changed: 0 additions & 12 deletions
This file was deleted.

gradle.properties

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,23 @@ org.gradle.jvmargs=-Xmx1G
33
org.gradle.daemon=false
44
org.gradle.debug=false
55

6-
#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings
7-
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
86
neogradle.subsystems.parchment.minecraftVersion=1.21.1
97
neogradle.subsystems.parchment.mappingsVersion=2024.11.17
10-
# Environment Properties
11-
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
12-
# The Minecraft version must agree with the Neo version to get a valid artifact
138
minecraft_version=1.21.1
14-
# The Minecraft version range can use any release version of Minecraft as bounds.
15-
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
16-
# as they do not follow standard versioning conventions.
179
minecraft_version_range=[1.21.1,1.21.2)
18-
# The Neo version must agree with the Minecraft version to get a valid artifact
1910
neo_version=21.1.4
20-
# The Neo version range can use any version of Neo as bounds
2111
neo_version_range=[21.1.0,)
22-
# The loader version range can only use the major version of FML as bounds
2312
loader_version_range=[4,)
2413

14+
# Dependencies
2515
jei_version=19.9.0.120
16+
patchouli_version=1.21-87
2617

2718
## Mod Properties
28-
29-
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
30-
# Must match the String constant located in the main mod class annotated with @Mod.
3119
mod_id=psi
32-
# The human-readable display name for the mod.
3320
mod_name=Psi
34-
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
35-
mod_license=All Rights Reserved
36-
# The mod version. See https://semver.org/
21+
mod_license=Psi License
3722
mod_version=1.21.1
38-
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
39-
# This should match the base package used for the mod sources.
40-
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
41-
mod_group_id=com.example.examplemod
42-
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
43-
mod_authors=YourNameHere, OtherNameHere
44-
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
45-
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
23+
mod_group_id=vazkii.psi
24+
mod_authors=Vazkii, Wiiv, WireSegal, Kamefrede, Williewillus, Hubry, Dudblockman, TheidenHD
25+
mod_description=Psionic Spellcasting Instruments

scripts/push_tag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
def main():
77
build = Properties()
8-
with open("build.properties", "rb") as f:
8+
with open("gradle.properties", "rb") as f:
99
build.load(f, "utf-8")
1010

1111
mc_version, mcv_meta = build["mc_version"]
@@ -39,7 +39,7 @@ def main():
3939
print("Created tag")
4040

4141
build["build_number"] = str(int(build_number) + 1)
42-
with open("build.properties", "wb") as f:
42+
with open("gradle.properties", "wb") as f:
4343
build.store(f, encoding="utf-8")
4444

4545
os.system("git commit -a -m build")

src/main/java/vazkii/psi/api/ClientPsiAPI.java

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,37 @@
2121
@OnlyIn(Dist.CLIENT)
2222
public class ClientPsiAPI {
2323

24-
//public static final ResourceLocation PSI_PIECE_TEXTURE_ATLAS = ResourceLocation.fromNamespaceAndPath(MOD_ID, "spell_pieces");
25-
private static final Map<ResourceLocation, Material> simpleSpellTextures = new ConcurrentHashMap<>();
26-
27-
/**
28-
* Register the texture of a piece
29-
* <p>
30-
* On Forge, call this at any time before registry events finish (e.g. during item registration).
31-
* Note that common setup event is <em>too late</em>!
32-
* <p>
33-
* NB: Why the strange restriction? Because in 1.16.2+ forge, texture stitching, model baking, etc. go on
34-
* <em>concurrently</em> with all setup events (client, common). So by then, it is way too late to tell the game
35-
* to load these textures. Registry events are the final thing that runs serially until loading is done, so
36-
* we have to receive all registrations by then. This makes the setup events, particularly the client one,
37-
* pretty much useless for doing anything that interacts with the vanilla game. Awesome system design right there!
38-
*
39-
* @param pieceId ID of the piece whose texture to register
40-
* @param texture Path to the piece's texture, where <code>domain:foo/bar</code> translates to
41-
* <code>/assets/domain/textures/foo/bar.png</code>.
42-
* In other words, do <b>not</b> prefix with textures/ nor suffix with .png.
43-
*/
44-
@OnlyIn(Dist.CLIENT)
45-
public static void registerPieceTexture(ResourceLocation pieceId, ResourceLocation texture) {
46-
ClientPsiAPI.simpleSpellTextures.put(pieceId, new Material(TextureAtlas.LOCATION_BLOCKS, texture));
47-
}
48-
49-
public static Material getSpellPieceMaterial(ResourceLocation key) {
50-
return simpleSpellTextures.get(key);
51-
}
52-
53-
public static Collection<Material> getAllSpellPieceMaterial() {
54-
return simpleSpellTextures.values();
55-
}
24+
//public static final ResourceLocation PSI_PIECE_TEXTURE_ATLAS = ResourceLocation.fromNamespaceAndPath(MOD_ID, "spell_pieces");
25+
private static final Map<ResourceLocation, Material> simpleSpellTextures = new ConcurrentHashMap<>();
26+
27+
/**
28+
* Register the texture of a piece
29+
* <p>
30+
* On Forge, call this at any time before registry events finish (e.g. during item registration).
31+
* Note that common setup event is <em>too late</em>!
32+
* <p>
33+
* NB: Why the strange restriction? Because in 1.16.2+ forge, texture stitching, model baking, etc. go on
34+
* <em>concurrently</em> with all setup events (client, common). So by then, it is way too late to tell the game
35+
* to load these textures. Registry events are the final thing that runs serially until loading is done, so
36+
* we have to receive all registrations by then. This makes the setup events, particularly the client one,
37+
* pretty much useless for doing anything that interacts with the vanilla game. Awesome system design right there!
38+
*
39+
* @param pieceId ID of the piece whose texture to register
40+
* @param texture Path to the piece's texture, where <code>domain:foo/bar</code> translates to
41+
* <code>/assets/domain/textures/foo/bar.png</code>.
42+
* In other words, do <b>not</b> prefix with textures/ nor suffix with .png.
43+
*/
44+
@OnlyIn(Dist.CLIENT)
45+
public static void registerPieceTexture(ResourceLocation pieceId, ResourceLocation texture) {
46+
ClientPsiAPI.simpleSpellTextures.put(pieceId, new Material(TextureAtlas.LOCATION_BLOCKS, texture));
47+
}
48+
49+
public static Material getSpellPieceMaterial(ResourceLocation key) {
50+
return simpleSpellTextures.get(key);
51+
}
52+
53+
public static Collection<Material> getAllSpellPieceMaterial() {
54+
return simpleSpellTextures.values();
55+
}
5656

5757
}

0 commit comments

Comments
 (0)