Merge pull request #2692 from pk910/v3.0

spigot 1.15 support
This commit is contained in:
mikeprimm 2019-12-14 22:12:19 -06:00 committed by GitHub
commit 475db4a97c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 80 additions and 69 deletions

View File

@ -47,6 +47,8 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
private Method cw_gethandle; private Method cw_gethandle;
/** BiomeBase related helpers */ /** BiomeBase related helpers */
protected Class<?> biomestorage;
protected Field biomestoragebase;
protected Class<?> biomebase; protected Class<?> biomebase;
protected Class<?> biomebasearray; protected Class<?> biomebasearray;
protected Field biomebaselist; protected Field biomebaselist;
@ -131,7 +133,12 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
/* CraftChunkSnapshot */ /* CraftChunkSnapshot */
craftchunksnapshot = getOBCClass("org.bukkit.craftbukkit.CraftChunkSnapshot"); craftchunksnapshot = getOBCClass("org.bukkit.craftbukkit.CraftChunkSnapshot");
biomebasearray = getNMSClass("[Lnet.minecraft.server.BiomeBase;"); biomebasearray = getNMSClass("[Lnet.minecraft.server.BiomeBase;");
ccss_biome = getPrivateField(craftchunksnapshot, new String[] { "biome" }, biomebasearray); ccss_biome = getPrivateFieldNoFail(craftchunksnapshot, new String[] { "biome" }, biomebasearray);
if(ccss_biome == null) {
biomestorage = getNMSClass("net.minecraft.server.BiomeStorage");
biomestoragebase = getPrivateField(biomestorage, new String[] { "f" }, biomebasearray);
ccss_biome = getPrivateField(craftchunksnapshot, new String[] { "biome" }, biomestorage);
}
/* CraftChunk */ /* CraftChunk */
craftchunk = getOBCClass("org.bukkit.craftbukkit.CraftChunk"); craftchunk = getOBCClass("org.bukkit.craftbukkit.CraftChunk");
cc_gethandle = getMethod(craftchunk, new String[] { "getHandle" }, new Class[0]); cc_gethandle = getMethod(craftchunk, new String[] { "getHandle" }, new Class[0]);
@ -321,7 +328,11 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
* Get list of defined biomebase objects * Get list of defined biomebase objects
*/ */
public Object[] getBiomeBaseList() { public Object[] getBiomeBaseList() {
return (Object[]) getFieldValue(biomebase, biomebaselist, new Object[0]); Object baselist = getFieldValue(biomebase, biomebaselist, new Object[0]);
if(biomestoragebase != null)
baselist = getFieldValue(baselist, biomestoragebase, new Object[0]);
return (Object[])baselist;
} }
/** Get temperature from biomebase */ /** Get temperature from biomebase */
public float getBiomeBaseTemperature(Object bb) { public float getBiomeBaseTemperature(Object bb) {