From 419c6a6028dfb7420ff46923dd7d6f364abe7896 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Fri, 18 Feb 2022 00:21:03 +0100 Subject: [PATCH] Fix wrong ReflectRegistry entries --- .../lib/paper/reflect/ReflectRegistry.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/ReflectRegistry.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/ReflectRegistry.java index ca0c691..e3ee860 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/ReflectRegistry.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/ReflectRegistry.java @@ -27,11 +27,15 @@ public class ReflectRegistry { public static final class SharedConstants { public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.SharedConstants")); public static final ReflectMethod getCurrentVersion = wrapEx(() -> MAPPING.mojMethod("getCurrentVersion")); + public static final ReflectMethod getProtocolVersion = wrapEx(() -> MAPPING.mojMethod("getProtocolVersion")); } public static final class WorldVersion { public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.WorldVersion")); - public static final ReflectMethod getProtocolVersion = wrapEx(() -> MAPPING.runtimeReflect().method("getProtocolVersion")); + } + + public static final class DetectedVersion { + public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.DetectedVersion")); } public static final class DedicatedServer { @@ -41,7 +45,7 @@ public class ReflectRegistry { public static final class Commands { public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.Commands")); - public static final ReflectField dispatcher = wrapEx(() -> MAPPING.mojField("dispatcher")); // TODO vérifier + public static final ReflectField dispatcher = wrapEx(() -> MAPPING.mojField("dispatcher")); } public static final class Vec3 { @@ -102,9 +106,10 @@ public class ReflectRegistry { public static final class BlockPos { public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.core.BlockPos")); - public static final ReflectMethod BLOCKPOS_GETX = wrapEx(() -> MAPPING.mojMethod("getX")); - public static final ReflectMethod BLOCKPOS_GETY = wrapEx(() -> MAPPING.mojMethod("getY")); - public static final ReflectMethod BLOCKPOS_GETZ = wrapEx(() -> MAPPING.mojMethod("getZ")); + public static final ClassMapping MAPPING_SUPERCLASS = wrapEx(() -> NMSReflect.mojClass("net.minecraft.core.Vec3i")); + public static final ReflectMethod getX = wrapEx(() -> MAPPING_SUPERCLASS.mojMethod("getX")); // these 3 methods are declared in the superclass + public static final ReflectMethod getY = wrapEx(() -> MAPPING_SUPERCLASS.mojMethod("getY")); // so the mapping is only referenced in the superclass + public static final ReflectMethod getZ = wrapEx(() -> MAPPING_SUPERCLASS.mojMethod("getZ")); } public static final class ResourceLocationArgument {