Skip to content

Commit 0c28265

Browse files
feat: port to 1.21.6
1 parent 7d4755b commit 0c28265

75 files changed

Lines changed: 2581 additions & 1999 deletions

File tree

Some content is hidden

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

CHANGELOG.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
## [21.5.1]
1+
## [21.6.0]
22

3-
### Fixed
3+
### Changed
44

5-
- Rendering issue causing water and other effects to mutate vertex colours (Thanks to [@cargocats](https://github.com/cargocats) [#303](https://github.com/AdvancedXRay/XRay-Mod/pull/303))
5+
- Ported to `1.21.6`, `1.21.7`, `1.21.8`
6+
- Basically rewrote most of the mod to improve performance
7+
- All data is now stored in the `config/xray` folder instead of being in both the config and an `xray` folder
8+
- This means older configs will no longer work
9+
- Block store has been improved to support categories but this is not yet implemented in the UI
10+
- Block store now supports `rgb`, `hsl`, `hex` and `0x` color formats for the `color` field
11+
- Support has been added for more scan targets but this is not yet implemented in the UI
12+
- Reworked the scanning code to hopefully remove lag on scanning large areas
13+
- Reworked the block rendering to use VBOs per chunk to improve performance

build.gradle

Lines changed: 88 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,100 @@
11
plugins {
2-
id 'idea'
32
id 'java-library'
4-
id 'maven-publish'
5-
id 'net.neoforged.moddev' version '2.0.78'
3+
id 'fabric-loom' version '1.10-SNAPSHOT' apply(false)
4+
id 'net.neoforged.moddev' version '2.0.78' apply(false)
65
id "me.modmuss50.mod-publish-plugin" version "0.8.4"
76
}
87

98
tasks.named('wrapper', Wrapper).configure {
109
distributionType = Wrapper.DistributionType.BIN
1110
}
1211

13-
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
14-
1512
version = mod_version
1613
group = 'pro.mikey'
1714

18-
base {
19-
archivesName = "advanced-xray-neoforge"
20-
}
15+
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
2116

22-
neoForge {
23-
version = project.forge_version
24-
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
17+
allprojects {
18+
apply plugin: 'idea'
19+
apply plugin: 'java-library'
20+
apply plugin: 'maven-publish'
2521

26-
runs {
27-
// applies to all the run configs below
28-
configureEach {
29-
systemProperty 'forge.logging.markers', 'REGISTRIES'
30-
logLevel = org.slf4j.event.Level.DEBUG
31-
}
22+
version = mod_version
23+
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
3224

33-
client {
34-
client()
35-
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
36-
}
25+
tasks.withType(JavaCompile).configureEach {
26+
options.encoding = 'UTF-8'
3727
}
3828

39-
mods {
40-
"${mod_id}" {
41-
sourceSet(sourceSets.main)
29+
idea {
30+
module {
31+
downloadSources = true
32+
downloadJavadoc = true
4233
}
4334
}
44-
}
4535

46-
def replaceProperties = [
47-
minecraft_version: minecraft_version,
48-
minecraft_version_range: minecraft_version_range.replace("[%base]", minecraft_version),
49-
forge_version_range: forge_version_range,
50-
version: version,
51-
]
36+
// jar {
37+
// from(rootProject.file("LICENSE").toString()) {
38+
// rename { "${it}_${project.archivesBaseName}" }
39+
// }
40+
// }
41+
}
5242

53-
processResources {
54-
inputs.properties replaceProperties
43+
subprojects {
44+
base {
45+
archivesName = "advanced-xray-$project.name"
46+
}
5547

56-
filesMatching("META-INF/neoforge.mods.toml") {
57-
expand replaceProperties
48+
repositories {
49+
maven {
50+
url "https://libraries.minecraft.net"
51+
content {
52+
includeModule("org.lwjgl", "lwjgl-freetype")
53+
}
54+
}
5855
}
59-
}
6056

61-
configurations {
62-
runtimeClasspath.extendsFrom localRuntime
63-
}
57+
if (project.name != "common") {
58+
tasks.withType(JavaCompile).configureEach {
59+
if (!it.name.toLowerCase().contains("test")) {
60+
source(project(":common").sourceSets.main.allSource)
61+
}
62+
}
6463

65-
dependencies {
66-
}
64+
tasks.withType(Javadoc).configureEach {
65+
source(project(":common").sourceSets.main.allJava)
66+
}
6767

68-
repositories {
69-
maven {
70-
url "https://maven.neoforged.net/releases"
68+
processResources {
69+
from project(":common").sourceSets.main.resources
70+
}
7171
}
72-
}
7372

74-
java {
75-
withSourcesJar()
76-
}
73+
def replaceProperties = [
74+
minecraft_version: minecraft_version,
75+
minecraft_version_range: minecraft_version_range.replace("[%base]", minecraft_version),
76+
forge_version_range: forge_version_range,
77+
version: version,
78+
]
7779

78-
publishing {
79-
publications {
80-
mavenJava(MavenPublication) {
81-
artifactId = rootProject.archivesBaseName
82-
from components.java
80+
processResources {
81+
inputs.properties replaceProperties
82+
83+
filesMatching(["META-INF/neoforge.mods.toml", "fabric.mod.json", "META-INF/mods.toml"]) {
84+
expand replaceProperties
8385
}
8486
}
8587

86-
repositories {
87-
def token = providers.environmentVariable("SAPS_TOKEN");
88-
if (token.isPresent()) {
89-
maven {
90-
url "https://maven.saps.dev/releases"
91-
credentials {
92-
username = "mikeymods"
93-
password = token.get()
88+
publishing {
89+
repositories {
90+
def token = providers.environmentVariable("SAPS_TOKEN");
91+
if (token.isPresent()) {
92+
maven {
93+
url "https://maven.saps.dev/releases"
94+
credentials {
95+
username = "mikeymods"
96+
password = token.get()
97+
}
9498
}
9599
}
96100
}
@@ -103,13 +107,28 @@ publishMods {
103107
version = "${mod_version}"
104108
type = STABLE
105109

106-
curseforge {
110+
def createOptions = (String platform, String taskName) -> {
111+
publishOptions {
112+
file = project.provider { project(":$platform").tasks[taskName] }.flatMap { it.archiveFile }
113+
displayName = "[${platform.toUpperCase()}] Advanced XRay ${mod_version}"
114+
modLoaders.add(platform.toLowerCase())
115+
}
116+
}
117+
118+
def curseForgeOptions = curseforgeOptions {
107119
accessToken = providers.environmentVariable("CURSE_DEPLOY_TOKEN")
108-
projectId = "${curse_id}"
109120
minecraftVersions.add("${minecraft_version}")
110-
modLoaders.add("neoforge")
111-
displayName = "[NEOFORGE] [${minecraft_version}] ${project.name} ${mod_version}"
112-
file = project.tasks.jar.archiveFile
121+
javaVersions.add(JavaVersion.VERSION_21)
122+
}
123+
124+
curseforge("curseforgeNeoforge") {
125+
from(curseForgeOptions, createOptions("neoforge", "jar"))
126+
projectId = "256256"
127+
}
128+
129+
curseforge("curseforgeFabric") {
130+
from(curseForgeOptions, createOptions("fabric", "remapJar"))
131+
projectId = "444663"
113132
}
114133

115134
github {
@@ -118,17 +137,7 @@ publishMods {
118137
commitish = providers.environmentVariable("GITHUB_SHA").orElse("dryRun")
119138
tagName = providers.environmentVariable("GITHUB_REF_NAME").orElse("dryRun")
120139

121-
file = project.tasks.jar.archiveFile
140+
file = project.provider { project(":neoforge").tasks.jar }.flatMap { it.archiveFile }
141+
additionalFiles.from project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile }
122142
}
123-
}
124-
125-
tasks.withType(JavaCompile).configureEach {
126-
options.encoding = 'UTF-8'
127-
}
128-
129-
idea {
130-
module {
131-
downloadSources = true
132-
downloadJavadoc = true
133-
}
134-
}
143+
}

common/build.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
plugins {
2+
id 'fabric-loom'
3+
}
4+
5+
loom {
6+
accessWidenerPath = project(":common").file("src/main/resources/xray.accesswidener")
7+
}
8+
9+
dependencies {
10+
minecraft "com.mojang:minecraft:${project.minecraft_version}"
11+
mappings loom.officialMojangMappings()
12+
13+
testImplementation platform('org.junit:junit-bom:5.10.3')
14+
testImplementation 'org.junit.jupiter:junit-jupiter'
15+
16+
compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
17+
}
18+
19+
test {
20+
useJUnitPlatform()
21+
}
22+
23+
repositories {
24+
maven {
25+
url = "https://repo.spongepowered.org/repository/maven-public/"
26+
content {
27+
includeGroup "org.spongepowered"
28+
}
29+
}
30+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package pro.mikey.xray;
2+
3+
import net.minecraft.client.resources.language.I18n;
4+
import org.slf4j.Logger;
5+
import org.slf4j.LoggerFactory;
6+
import pro.mikey.xray.core.ScanController;
7+
8+
public class ClientController {
9+
private static final Logger LOGGER = LoggerFactory.getLogger(ClientController.class);
10+
11+
public static void onSetup() {
12+
LOGGER.debug(I18n.get("xray.debug.init"));
13+
XRay.config().load();
14+
15+
ScanController.INSTANCE.init();
16+
}
17+
}

0 commit comments

Comments
 (0)