Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-25 15:50:10 +01:00
Dieser Commit ist enthalten in:
Ursprung
6b8b0e1771
Commit
c214ca02e8
@ -122,11 +122,15 @@ public class CommandBlockListener implements Listener {
|
||||
private long[] getPosition(Object obj) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
|
||||
return new long[]{
|
||||
(long) ReflectionUtil.getSuper(obj, "a", int.class), //X
|
||||
(long) ReflectionUtil.getSuper(obj, "c", int.class), //Y
|
||||
(long) ReflectionUtil.getSuper(obj, "d", int.class) //Z
|
||||
(long) ReflectionUtil.getSuper(obj, isR1() ? "b" : "c", int.class), //Y
|
||||
(long) ReflectionUtil.getSuper(obj, isR1() ? "c" : "d", int.class) //Z
|
||||
};
|
||||
}
|
||||
|
||||
private boolean isR1() {
|
||||
return ReflectionUtil.getVersion().equals("v1_8_R1");
|
||||
}
|
||||
|
||||
private CompoundTag getNBT(Object obj) throws Exception {
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
Method m = ReflectionUtil.nms("NBTCompressedStreamTools").getMethod("a", ReflectionUtil.nms("NBTTagCompound"), DataOutput.class);
|
||||
|
@ -22,6 +22,10 @@ public class ReflectionUtil {
|
||||
return Class.forName(BASE + "." + className);
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return BASE.substring(BASE.lastIndexOf('.') + 1);
|
||||
}
|
||||
|
||||
public static Object invokeStatic(Class<?> clazz, String method) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
Method m = clazz.getDeclaredMethod(method);
|
||||
return m.invoke(null);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren