Skip to content

Commit 70e7bdb

Browse files
authored
feat: 1.21.11 support (#50)
* feat: 1.21.11 support * feat: 1.21.11 mojang mapping support
1 parent e57fbb3 commit 70e7bdb

File tree

9 files changed

+438
-11
lines changed

9 files changed

+438
-11
lines changed

.github/workflows/buildtools.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ checkVersion "1.21.3" "21"
3737
checkVersion "1.21.4" "21"
3838
checkVersion "1.21.5" "21"
3939
checkVersion "1.21.6" "21"
40-
checkVersion "1.21.9" "21"
40+
checkVersion "1.21.10" "21"
41+
checkVersion "1.21.11" "21"

pom.xml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
<plugin.compile.version>3.10.1</plugin.compile.version>
2828
<plugin.shade.version>3.4.0</plugin.shade.version>
29+
<plugin.jar.version>3.4.2</plugin.jar.version>
2930
<plugin.flatten.version>1.2.7</plugin.flatten.version>
3031
<plugin.specialsource.version>2.0.2</plugin.specialsource.version>
3132

@@ -51,14 +52,6 @@
5152
</resource>
5253
</resources>
5354
<plugins>
54-
<plugin>
55-
<groupId>org.apache.maven.plugins</groupId>
56-
<artifactId>maven-compiler-plugin</artifactId>
57-
<version>${plugin.compile.version}</version>
58-
<configuration>
59-
<release>17</release>
60-
</configuration>
61-
</plugin>
6255
<plugin>
6356
<groupId>org.apache.maven.plugins</groupId>
6457
<artifactId>maven-shade-plugin</artifactId>
@@ -90,6 +83,26 @@
9083
</filters>
9184
</configuration>
9285
</plugin>
86+
<plugin>
87+
<groupId>org.apache.maven.plugins</groupId>
88+
<artifactId>maven-jar-plugin</artifactId>
89+
<version>${plugin.jar.version}</version>
90+
<configuration>
91+
<archive>
92+
<manifestEntries>
93+
<paperweight-mappings-namespace>mojang</paperweight-mappings-namespace>
94+
</manifestEntries>
95+
</archive>
96+
</configuration>
97+
</plugin>
98+
<plugin>
99+
<groupId>org.apache.maven.plugins</groupId>
100+
<artifactId>maven-compiler-plugin</artifactId>
101+
<version>${plugin.compile.version}</version>
102+
<configuration>
103+
<release>17</release>
104+
</configuration>
105+
</plugin>
93106
<plugin>
94107
<groupId>org.codehaus.mojo</groupId>
95108
<artifactId>flatten-maven-plugin</artifactId>

zip-common/src/main/java/net/imprex/zip/common/MinecraftVersion.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ private static final class NmsMapping {
1818
private static final List<NmsMapping> MAPPINGS = new ArrayList<>();
1919

2020
static {
21-
MAPPINGS.add(new NmsMapping("1.21.9", "v1_21_R6"));
21+
MAPPINGS.add(new NmsMapping("1.21.11", "v1_21_R7"));
22+
MAPPINGS.add(new NmsMapping("1.21.10", "v1_21_R6"));
2223
MAPPINGS.add(new NmsMapping("1.21.6", "v1_21_R5"));
2324
MAPPINGS.add(new NmsMapping("1.21.5", "v1_21_R4"));
2425
MAPPINGS.add(new NmsMapping("1.21.4", "v1_21_R3"));
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @author Imprex-Development
3+
* @see <a href="https://github.com/Imprex-Development/orebfuscator/blob/master/orebfuscator-nms/orebfuscator-nms-api/src/main/java/net/imprex/orebfuscator/util/ServerVersion.java">ServerVersion.java</a>
4+
*/
5+
package net.imprex.zip.common;
6+
7+
public class ServerVersion {
8+
9+
private static final boolean IS_MOJANG_MAPPED = classExists("net.minecraft.core.BlockPos")
10+
&& fieldExists("net.minecraft.world.level.block.Blocks", "AIR");
11+
private static final boolean IS_FOLIA = classExists("io.papermc.paper.threadedregions.RegionizedServer");
12+
private static final boolean IS_PAPER = !IS_FOLIA && classExists("com.destroystokyo.paper.PaperConfig");
13+
private static final boolean IS_BUKKIT = !IS_FOLIA && !IS_PAPER;
14+
15+
private static boolean classExists(String className) {
16+
try {
17+
Class.forName(className);
18+
return true;
19+
} catch (ClassNotFoundException e) {
20+
return false;
21+
}
22+
}
23+
24+
private static boolean fieldExists(String className, String fieldName) {
25+
try {
26+
Class<?> target = Class.forName(className);
27+
return target.getDeclaredField(fieldName) != null;
28+
} catch (Exception e) {
29+
return false;
30+
}
31+
}
32+
33+
public static boolean isMojangMapped() {
34+
return IS_MOJANG_MAPPED;
35+
}
36+
37+
public static boolean isFolia() {
38+
return IS_FOLIA;
39+
}
40+
41+
public static boolean isPaper() {
42+
return IS_PAPER;
43+
}
44+
45+
public static boolean isBukkit() {
46+
return IS_BUKKIT;
47+
}
48+
}

zip-nms/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
<module>zip-nms-v1_21_R4</module>
2626
<module>zip-nms-v1_21_R5</module>
2727
<module>zip-nms-v1_21_R6</module>
28+
<module>zip-nms-v1_21_R7</module>
2829
</modules>
2930
</project>

zip-nms/zip-nms-v1_21_R7/pom.xml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
4+
<parent>
5+
<groupId>net.imprex</groupId>
6+
<artifactId>zip-nms</artifactId>
7+
<version>${revision}</version>
8+
</parent>
9+
10+
<artifactId>zip-nms-v1_21_R7</artifactId>
11+
12+
<dependencies>
13+
<dependency>
14+
<groupId>net.imprex</groupId>
15+
<artifactId>zip-nms-api</artifactId>
16+
<version>${revision}</version>
17+
<scope>provided</scope>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.spigotmc</groupId>
21+
<artifactId>spigot</artifactId>
22+
<version>1.21.11-R0.1-SNAPSHOT</version>
23+
<classifier>remapped-mojang</classifier>
24+
<scope>provided</scope>
25+
</dependency>
26+
</dependencies>
27+
28+
<build>
29+
<plugins>
30+
<plugin>
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-shade-plugin</artifactId>
33+
<configuration>
34+
<shadedArtifactAttached>true</shadedArtifactAttached>
35+
<shadedClassifierName>mojang-mapped</shadedClassifierName>
36+
<relocations>
37+
<relocation>
38+
<pattern>net.imprex.zip.nms.v1_21_R7</pattern>
39+
<shadedPattern>net.imprex.zip.nms.v1_21_R7_mojang</shadedPattern>
40+
</relocation>
41+
</relocations>
42+
</configuration>
43+
</plugin>
44+
<plugin>
45+
<groupId>net.md-5</groupId>
46+
<artifactId>specialsource-maven-plugin</artifactId>
47+
<version>${plugin.specialsource.version}</version>
48+
<executions>
49+
<execution>
50+
<phase>package</phase>
51+
<goals>
52+
<goal>remap</goal>
53+
</goals>
54+
<id>remap-obf</id>
55+
<configuration>
56+
<srgIn>
57+
org.spigotmc:minecraft-server:1.21.11-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
58+
<reverse>true</reverse>
59+
<remappedDependencies>
60+
org.spigotmc:spigot:1.21.11-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
61+
<remappedArtifactAttached>true</remappedArtifactAttached>
62+
<remappedClassifierName>remapped-obf</remappedClassifierName>
63+
</configuration>
64+
</execution>
65+
<execution>
66+
<phase>package</phase>
67+
<goals>
68+
<goal>remap</goal>
69+
</goals>
70+
<id>remap-spigot</id>
71+
<configuration>
72+
<inputFile>
73+
${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
74+
<srgIn>
75+
org.spigotmc:minecraft-server:1.21.11-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
76+
<remappedDependencies>
77+
org.spigotmc:spigot:1.21.11-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
78+
</configuration>
79+
</execution>
80+
</executions>
81+
</plugin>
82+
</plugins>
83+
</build>
84+
</project>

0 commit comments

Comments
 (0)