WrappedPacketOutBlockChange hopefully now supports 1.18.1+

This commit is contained in:
retrooper committed 2022-03-31 23:05:25 +02:00
1 parent 177e9b7f4e
commit 3d7a0d901f
1 file changed
+8
@@ -71,7 +71,15 @@ public class WrappedPacketOutBlockChange extends WrappedPacket implements Sendab
@Override
protected void load() {
getNMSBlockMethodCache = Reflection.getMethod(NMSUtils.iBlockDataClass, "getBlock", 0);
if (getNMSBlockMethodCache == null) {
Class<?> blockDataClass = NMSUtils.iBlockDataClass.getSuperclass();
getNMSBlockMethodCache = Reflection.getMethod(blockDataClass, NMSUtils.blockClass, 0);
}
getNMSWorldTypeMethodCache = Reflection.getMethod(NMSUtils.nmsWorldClass, "getType", 0);
if (getNMSWorldTypeMethodCache == null) {
getNMSWorldTypeMethodCache = Reflection.getMethod(NMSUtils.nmsWorldClass,
"getBlockStateIfLoaded", 0);
}
v_1_7_10 = version.isOlderThan(ServerVersion.v_1_8);
v_1_17 = version.isNewerThanOrEquals(ServerVersion.v_1_17);
if (v_1_17) {