Small fixes
This commit is contained in:
parent
2fd69de12d
commit
9e614af2fb
3 changed files with 9 additions and 6 deletions
|
@ -168,7 +168,7 @@ public class MapWrapper extends AbstractMapWrapper {
|
|||
|
||||
String inventoryMenuName;
|
||||
if (ReflectionUtil.supports(19)) { //1.19
|
||||
inventoryMenuName = ReflectionUtil.VER_MINOR == 4 ? "bO" : "bT"; //1.19.4 = bO, >= 1.19.3 = bT
|
||||
inventoryMenuName = ReflectionUtil.VER_MINOR == 3 ? "bO" : "bT"; //1.19.4 = bO, >= 1.19.3 = bT
|
||||
} else if (ReflectionUtil.supports(18)) { //1.18
|
||||
inventoryMenuName = ReflectionUtil.VER_MINOR == 1 ? "bV" : "bU"; //1.18.1 = ap, 1.18(.2) = ao
|
||||
} else if (ReflectionUtil.supports(17)) { //1.17, same as 1.18(.2)
|
||||
|
@ -323,7 +323,7 @@ public class MapWrapper extends AbstractMapWrapper {
|
|||
|
||||
String dataWatcherObjectName;
|
||||
if (ReflectionUtil.supports(19)) { //1.19
|
||||
dataWatcherObjectName = ReflectionUtil.VER_MINOR == 4 ? "g" : "ao"; //1.19.4 = g, >= 1.19.3 = ao
|
||||
dataWatcherObjectName = ReflectionUtil.VER_MINOR == 3 ? "g" : "ao"; //1.19.4 = g, >= 1.19.3 = ao
|
||||
} else if (ReflectionUtil.supports(18)) { //1.18
|
||||
dataWatcherObjectName = ReflectionUtil.VER_MINOR == 1 ? "ap" : "ao"; //1.18.1 = ap, 1.18(.2) = ao
|
||||
} else if (ReflectionUtil.supports(17)) { //1.17
|
||||
|
|
|
@ -115,7 +115,7 @@ public class PacketListener implements Listener {
|
|||
} else if (packet.getClass().isAssignableFrom(packetPlayInSetCreativeSlotClass)) {
|
||||
Object packetPlayInSetCreativeSlot = packetPlayInSetCreativeSlotClass.cast(packet);
|
||||
|
||||
int slot = (int) ReflectionUtil.callDeclaredMethod(packetPlayInSetCreativeSlot, ReflectionUtil.supports(13) ? "b" : "a"); //1.13 = b, 1.12 = a
|
||||
int slot = (int) ReflectionUtil.callDeclaredMethod(packetPlayInSetCreativeSlot, ReflectionUtil.supports(19, 3) ? "a" : ReflectionUtil.supports(13) ? "b" : "a"); //1.19.4 = a, 1.19.3 - 1.13 = b, 1.12 = a
|
||||
Object nmsStack = ReflectionUtil.callDeclaredMethod(packetPlayInSetCreativeSlot, ReflectionUtil.supports(18) ? "c" : "getItemStack"); //1.18 = c, 1.17 = getItemStack
|
||||
ItemStack craftStack = (ItemStack) ReflectionUtil.callMethod(craftStackClass, "asBukkitCopy", nmsStack);
|
||||
|
||||
|
@ -143,8 +143,8 @@ public class PacketListener implements Listener {
|
|||
private Channel getChannel(Player player) {
|
||||
Object playerHandle = getHandle(player);
|
||||
Object playerConnection = getDeclaredField(playerHandle, ReflectionUtil.supports(17) ? "b" : "playerConnection"); //1.17 = b, 1.16 = playerConnection
|
||||
Object networkManager = getDeclaredField(playerConnection, ReflectionUtil.supports(19) ? "b" : ReflectionUtil.supports(17) ? "a" : "networkManager"); //1.19 = b, 1.18 = a, 1.16 = networkManager
|
||||
return (Channel) getDeclaredField(networkManager, ReflectionUtil.supports(19, 4) ? "h" : ReflectionUtil.supports(18) ? "m" : ReflectionUtil.supports(17) ? "k" : "channel"); //1.19.4 = h, >= 1.19.3 & 1.18 = m, 1.17 = k, 1.16 = channel
|
||||
Object networkManager = getDeclaredField(playerConnection, ReflectionUtil.supports(19, 3) ? "h" : ReflectionUtil.supports(19) ? "b" : ReflectionUtil.supports(17) ? "a" : "networkManager"); //1.19.4 = h, >= 1.19.3 = b, 1.18 = a, 1.16 = networkManager
|
||||
return (Channel) getDeclaredField(networkManager, ReflectionUtil.supports(18) ? "m" : ReflectionUtil.supports(17) ? "k" : "channel"); //1.19 & 1.18 = m, 1.17 = k, 1.16 = channel
|
||||
}
|
||||
|
||||
private Vector vec3DToVector(Object vec3d) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* This file is part of MapReflectionAPI.
|
||||
* Copyright (c) 2022 inventivetalent / SBDevelopment - All Rights Reserved
|
||||
* Copyright (c) 2022-2023 inventivetalent / SBDevelopment - All Rights Reserved
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -187,6 +187,9 @@ public class ReflectionUtil {
|
|||
|
||||
/**
|
||||
* Checks whether the server version is equal or greater than the given version.
|
||||
* <p>
|
||||
* PAY ATTENTION! The minor version is based on the NMS version.
|
||||
* This means that v1_19_R3 has major version 19 and minor version 3.
|
||||
*
|
||||
* @param major the major version to compare the server version with.
|
||||
* @param minor the minor version to compare the server version with.
|
||||
|
|
Loading…
Add table
Reference in a new issue