Use right int 2 object map class for Paper

Addresses #1217
This commit is contained in:
Dan Mulloy 2021-06-20 12:42:41 -04:00
parent 583ed4b58a
commit 4fc476a125
No known key found for this signature in database
GPG Key ID: BFACD592A5F0DFD6
2 changed files with 15 additions and 1 deletions

View File

@ -164,7 +164,7 @@ class EntityUtilities {
FuzzyFieldContract.newBuilder()
.banModifier(Modifier.STATIC)
.requirePublic()
.typeExact(org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap.class)
.typeExact(MinecraftReflection.getInt2ObjectMapClass())
.build()
)
);

View File

@ -2248,4 +2248,18 @@ public class MinecraftReflection {
public static Class<?> getAttributeBase() {
return getMinecraftClass("world.entity.ai.attributes.AttributeBase", "AttributeBase");
}
public static Class<?> getInt2ObjectMapClass() {
try {
return getMinecraftLibraryClass("it.unimi.dsi.fastutil.ints.Int2ObjectMap");
} catch (RuntimeException ex) {
try {
Class<?> clazz = getMinecraftLibraryClass("org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap");
setMinecraftLibraryClass("it.unimi.dsi.fastutil.ints.Int2ObjectMap", clazz);
return clazz;
} catch (RuntimeException ignored) {
throw ex;
}
}
}
}