mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-30 04:19:27 +00:00
修改构造器
This commit is contained in:
@@ -1255,7 +1255,17 @@ public final class NetworkReflections {
|
||||
|
||||
// 1.20.2+
|
||||
public static final Constructor<?> constructor$DiscardedPayload = Optional.ofNullable(clazz$DiscardedPayload)
|
||||
.map(ReflectionUtils::getTheOnlyConstructor)
|
||||
.map(it -> {
|
||||
if (VersionHelper.isOrAbove1_20_5()) {
|
||||
Constructor<?> constructor1 = ReflectionUtils.getConstructor(it, CoreReflections.clazz$ResourceLocation, ByteBuf.class);
|
||||
if (constructor1 != null) {
|
||||
return constructor1;
|
||||
}
|
||||
return ReflectionUtils.getConstructor(it, CoreReflections.clazz$ResourceLocation, byte[].class);
|
||||
} else {
|
||||
return ReflectionUtils.getConstructor(it, CoreReflections.clazz$ResourceLocation);
|
||||
}
|
||||
})
|
||||
.orElse(null);
|
||||
|
||||
public static final Class<?> clazz$ClientboundContainerSetContentPacket = requireNonNull(
|
||||
@@ -1644,7 +1654,7 @@ public final class NetworkReflections {
|
||||
|
||||
// 1.20.2~1.20.4
|
||||
public static final Constructor<?> constructor$UnknownPayload = Optional.ofNullable(clazz$UnknownPayload)
|
||||
.map(ReflectionUtils::getTheOnlyConstructor)
|
||||
.map(it -> ReflectionUtils.getConstructor(it, CoreReflections.clazz$ResourceLocation, ByteBuf.class))
|
||||
.orElse(null);
|
||||
|
||||
// 1.21.5+
|
||||
|
||||
@@ -372,7 +372,7 @@ public class BukkitServerPlayer extends Player {
|
||||
Object responsePacket;
|
||||
if (VersionHelper.isOrAbove1_20_2()) {
|
||||
Object dataPayload;
|
||||
if (NetworkReflections.clazz$UnknownPayload != null) {
|
||||
if (!VersionHelper.isOrAbove1_20_5()) {
|
||||
dataPayload = NetworkReflections.constructor$UnknownPayload.newInstance(channelResourceLocation, Unpooled.wrappedBuffer(data));
|
||||
} else if (DiscardedPayload.useNewMethod) {
|
||||
dataPayload = NetworkReflections.constructor$DiscardedPayload.newInstance(channelResourceLocation, data);
|
||||
|
||||
Reference in New Issue
Block a user