Support Paper 1.21, print proper exception

Closes https://github.com/ViaVersion/ViaRewind-Legacy-Support/issues/82
This commit is contained in:
FlorianMichael 2024-07-14 20:48:50 +02:00
parent 28f14ce635
commit 5380fc9c1b
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -18,6 +18,7 @@
package com.viaversion.viarewind.legacysupport.feature;
import com.viaversion.viarewind.legacysupport.util.ReflectionUtil;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import java.lang.reflect.Field;
@ -154,7 +155,10 @@ public class BlockCollisionChanges {
final Field isEmpty = getFieldAccessible(voxelShape, "isEmpty");
isEmpty.setBoolean(voxelShapeArray, true);
final Method initCache = voxelShape.getDeclaredMethod("initCache");
final Method initCache = ReflectionUtil.findMethod(voxelShape, new String[]{ "initCache", "moonrise$initCache" });
if (initCache == null) {
throw new IllegalStateException("Could not find initCache method in " + voxelShape.getName());
}
initCache.invoke(voxelShapeArray);
}
}