Skip to content

Commit 5bc7e1a

Browse files
committed
Merge branch 'feature-1.19.2' into nyan-work/dev
2 parents 1ca85f5 + 6001836 commit 5bc7e1a

File tree

10 files changed

+90
-18
lines changed

10 files changed

+90
-18
lines changed

build.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
plugins {
22
id("maven-publish")
33
id("fabric-loom").version("1.3-SNAPSHOT").apply(false)
4-
// https://github.com/Juuxel/LoomQuiltflower
5-
id("io.github.juuxel.loom-quiltflower").version("1.10.0").apply(false)
6-
id("net.kyori.blossom").version("1.3.1").apply(false)
4+
// https://github.com/Juuxel/loom-vineflower
5+
id("io.github.juuxel.loom-vineflower").version("1.11.0").apply(false)
76
id("org.ajoberstar.grgit").version("5.2.0")
87
id("com.replaymod.preprocess").version("SNAPSHOT")
98
}
@@ -18,6 +17,7 @@ preprocess {
1817
def mc1193 = createNode("1.19.3", 1_19_03, "mojang")
1918
def mc1194 = createNode("1.19.4", 1_19_04, "mojang")
2019
def mc1201 = createNode("1.20.1", 1_20_01, "mojang")
20+
def mc1202 = createNode("1.20.2", 1_20_02, "mojang")
2121

2222
mc1144.link(mc1152, null)
2323
mc1152.link(mc1165, file("versions/mapping-1.15.2-1.16.5.txt"))
@@ -27,6 +27,7 @@ preprocess {
2727
mc1192.link(mc1193, file("versions/mapping-1.19.2-1.19.3.txt"))
2828
mc1193.link(mc1194, null)
2929
mc1194.link(mc1201, null)
30+
mc1201.link(mc1202, null)
3031
}
3132

3233
ext {

common.gradle

+69-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
import com.google.common.collect.ImmutableList
2+
import com.google.common.collect.ImmutableMap
3+
import org.objectweb.asm.ClassReader
4+
import org.objectweb.asm.ClassWriter
5+
import org.objectweb.asm.tree.ClassNode
6+
import org.objectweb.asm.tree.LdcInsnNode
7+
18
apply(plugin: "maven-publish")
29
apply(plugin: "fabric-loom")
3-
apply(plugin: "io.github.juuxel.loom-quiltflower")
4-
apply(plugin: "net.kyori.blossom")
10+
apply(plugin: "io.github.juuxel.loom-vineflower")
511
apply(plugin: "com.replaymod.preprocess")
612

713
int mcVersion = 1
@@ -200,12 +206,6 @@ processResources {
200206
}
201207
}
202208

203-
blossom {
204-
replaceToken("@MOD_IDENTIFIER@" , project.mod_id)
205-
replaceToken("@MOD_NAME@" , project.mod_name)
206-
replaceToken("@MINECRAFT_VERSION_IDENTIFY@", project.minecraft_version.replace(".", "_"))
207-
}
208-
209209
java {
210210
sourceCompatibility(JavaVersion.VERSION_1_8)
211211
targetCompatibility(JavaVersion.VERSION_1_8)
@@ -232,3 +232,64 @@ publishing {
232232
}
233233
}
234234
}
235+
236+
ImmutableMap<Object, Object> replaceTokenMap = ImmutableMap.builder()
237+
.put("@MOD_IDENTIFIER@" , project.mod_id)
238+
.put("@MOD_NAME@" , project.mod_name)
239+
.put("@MINECRAFT_VERSION_IDENTIFY@", project.minecraft_version.replace(".", "_"))
240+
.build()
241+
ImmutableList<Object> replaceTokenFile = ImmutableList.builder()
242+
.add("OhMyMinecraftClientReference")
243+
.build()
244+
245+
tasks.classes {
246+
doLast {
247+
File dir = file("build/classes/java")
248+
249+
dir.eachFileRecurse {
250+
String path = it.path.replace(dir.path, "")
251+
252+
if (path.endsWith(".class") && replaceTokenFile.stream().anyMatch { path.contains(it as String) }) {
253+
ClassReader cr = new ClassReader(it.newInputStream().bytes)
254+
ClassNode cn = new ClassNode()
255+
cr.accept(cn, ClassReader.SKIP_FRAMES | ClassReader.SKIP_DEBUG)
256+
257+
// ReplaceToken in fields
258+
cn.fields.each {
259+
if (it.desc == "Ljava/lang/String;" && it.value instanceof String) {
260+
String value = it.value as String
261+
262+
replaceTokenMap.each {
263+
value = value.replace(it.key as String, it.value as String)
264+
}
265+
266+
it.value = value
267+
}
268+
}
269+
270+
// ReplaceToken in methods
271+
cn.methods.each {
272+
it.instructions.each {
273+
if (it instanceof LdcInsnNode) {
274+
LdcInsnNode ldc = it as LdcInsnNode
275+
276+
if (ldc.cst instanceof String) {
277+
String value = ldc.cst as String
278+
279+
replaceTokenMap.each {
280+
value = value.replace(it.key as String, it.value as String)
281+
}
282+
283+
ldc.cst = value
284+
}
285+
}
286+
}
287+
}
288+
289+
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES)
290+
cn.accept(cw)
291+
new FileOutputStream(it).write(cw.toByteArray())
292+
}
293+
}
294+
}
295+
}

gradle.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ mod_sources=https://github.com/plusls/oh-my-minecraft-client
1515
mod_version=0.5
1616

1717
# Required Libraries
18-
# MagicLib - 0.7.345
19-
magiclib_dependency=0.7.345
20-
magiclib_version=0.7.345
18+
# MagicLib - 0.7.376+bce84f9-beta
19+
magiclib_dependency=0.7.376+bce84f9-beta
20+
magiclib_version=0.7.376+bce84f9-beta
2121

2222
# Annotation processor
2323
lombok_version=1.18.28

gradle/wrapper/gradle-wrapper.jar

346 Bytes
Binary file not shown.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
8788

8889
# Use the maximum available, or set MAX_FD != -1 to use that value.
8990
MAX_FD=maximum

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def versions = Arrays.asList(
3737
"1.19.3",
3838
"1.19.4",
3939
"1.20.1",
40+
"1.20.2",
4041
)
4142

4243
for (String version : versions) {

src/main/java/com/plusls/ommc/feature/highlithtWaypoint/HighlightWaypointUtil.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ public static void init() {
128128
}
129129

130130
public static void postRespawn(@NotNull ClientboundRespawnPacket packet) {
131-
//#if MC > 11502
131+
//#if MC > 12001
132+
//$$ ResourceKey<Level> newDimension = packet.commonPlayerSpawnInfo().dimension();
133+
//#elseif MC > 11502
132134
ResourceKey<Level> newDimension = packet.getDimension();
133135
//#else
134136
//$$ DimensionType newDimension = packet.getDimension();

versions/1.20.1/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Development Environment
22
minecraft_version=1.20.1
3-
minecraft_dependency=1.20.x
3+
minecraft_dependency=>1.20 <=1.20.1
44

55
# Compatible Libraries
66
sodium_version=mc1.20-0.4.10

versions/1.20.2/gradle.properties

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Development Environment
2+
minecraft_version=23w33a
3+
minecraft_dependency=1.20.2-alpha.23.33.a
4+
5+
# Compatible Libraries
6+
sodium_version=0

0 commit comments

Comments
 (0)