1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-21 01:38:51 +00:00

feat: compatible 1.18

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2021-12-06 14:57:28 +00:00
parent 834f3d7d58
commit 1d1303b31c
2 changed files with 8 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId> <groupId>pw.yumc</groupId>
<artifactId>YumCore</artifactId> <artifactId>YumCore</artifactId>
<version>1.9.2</version> <version>1.9.3</version>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>

View File

@ -78,9 +78,13 @@ public class C {
Class<?> typePlayerConnection = subVersion < 17 ? Class.forName(a("PlayerConnection")) : Class.forName("net.minecraft.server.network.PlayerConnection"); Class<?> typePlayerConnection = subVersion < 17 ? Class.forName(a("PlayerConnection")) : Class.forName("net.minecraft.server.network.PlayerConnection");
getHandle = typeCraftPlayer.getMethod("getHandle"); getHandle = typeCraftPlayer.getMethod("getHandle");
playerConnection = subVersion < 17 ? typeNMSPlayer.getField("playerConnection") : typeNMSPlayer.getField("b"); playerConnection = subVersion < 17 ? typeNMSPlayer.getField("playerConnection") : typeNMSPlayer.getField("b");
sendPacket = typePlayerConnection.getMethod("sendPacket", subVersion < 17 ? if (subVersion < 17) {
Class.forName(a("Packet")) : sendPacket = typePlayerConnection.getMethod("sendPacket", Class.forName(a("Packet")));
Class.forName("net.minecraft.network.protocol.Packet")); } else if (subVersion == 17) {
sendPacket = typePlayerConnection.getMethod("sendPacket", Class.forName("net.minecraft.network.protocol.Packet"));
} else {
sendPacket = typePlayerConnection.getMethod("a", Class.forName("net.minecraft.network.protocol.Packet"));
}
init = true; init = true;
} catch (Exception e) { } catch (Exception e) {
Log.w("C 兼容性工具初始化失败 可能造成部分功能不可用!"); Log.w("C 兼容性工具初始化失败 可能造成部分功能不可用!");