mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
INMS Additions
This commit is contained in:
parent
1d9862fe11
commit
6c397da1f8
@ -25,8 +25,12 @@ import org.bukkit.block.Biome;
|
|||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
public interface INMSBinding {
|
public interface INMSBinding {
|
||||||
|
boolean supportsCustomHeight();
|
||||||
|
|
||||||
Object getBiomeBaseFromId(int id);
|
Object getBiomeBaseFromId(int id);
|
||||||
|
|
||||||
|
int getMinHeight(World world);
|
||||||
|
|
||||||
boolean supportsCustomBiomes();
|
boolean supportsCustomBiomes();
|
||||||
|
|
||||||
int getTrueBiomeBaseId(Object biomeBase);
|
int getTrueBiomeBaseId(Object biomeBase);
|
||||||
|
@ -68,6 +68,16 @@ public class NMSBinding16_1 implements INMSBinding {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinHeight(World world) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsCustomHeight() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsCustomBiomes() {
|
public boolean supportsCustomBiomes() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -125,6 +125,16 @@ public class NMSBinding16_2 implements INMSBinding {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinHeight(World world) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsCustomHeight() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private Class<?>[] classify(Object... par) {
|
private Class<?>[] classify(Object... par) {
|
||||||
Class<?>[] g = new Class<?>[par.length];
|
Class<?>[] g = new Class<?>[par.length];
|
||||||
for (int i = 0; i < g.length; i++) {
|
for (int i = 0; i < g.length; i++) {
|
||||||
|
@ -53,6 +53,16 @@ public class NMSBinding16_3 implements INMSBinding {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsCustomHeight() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinHeight(World world) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsCustomBiomes() {
|
public boolean supportsCustomBiomes() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -58,6 +58,11 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsCustomHeight() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private Field getFieldForBiomeStorage(Object storage) {
|
private Field getFieldForBiomeStorage(Object storage) {
|
||||||
Field f = biomeStorageCache;
|
Field f = biomeStorageCache;
|
||||||
|
|
||||||
@ -108,6 +113,11 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinHeight(World world) {
|
||||||
|
return world.getMinHeight();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getCustomBiomeBaseFor(String mckey) {
|
public Object getCustomBiomeBaseFor(String mckey) {
|
||||||
try {
|
try {
|
||||||
|
@ -24,12 +24,44 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class NMSBinding1X implements INMSBinding {
|
public class NMSBinding1X implements INMSBinding {
|
||||||
|
private static final boolean supportsCustomHeight = testCustomHeight();
|
||||||
|
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
|
private static boolean testCustomHeight() {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(World.class.getDeclaredMethod("getMaxHeight") != null && World.class.getDeclaredMethod("getMinHeight") != null);
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Throwable ignored)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsCustomHeight() {
|
||||||
|
return supportsCustomHeight;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getBiomeBaseFromId(int id) {
|
public Object getBiomeBaseFromId(int id) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinHeight(World world) {
|
||||||
|
return supportsCustomHeight ? world.getMinHeight() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsCustomBiomes() {
|
public boolean supportsCustomBiomes() {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user