GeoEngine possible NPE checks.

This commit is contained in:
MobiusDev 2018-03-08 12:34:53 +00:00
parent 44f924c2ae
commit 1a13176a33
6 changed files with 54 additions and 30 deletions

View File

@ -67,7 +67,7 @@ public class GeoEngine
}
/**
* GeoEngine contructor. Loads all geodata files of chosen geodata format.
* GeoEngine constructor. Loads all geodata files of chosen geodata format.
*/
public GeoEngine()
{
@ -314,7 +314,8 @@ public class GeoEngine
*/
public final short getHeightNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearest(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -327,7 +328,8 @@ public class GeoEngine
*/
public final short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearestOriginal(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -339,7 +341,8 @@ public class GeoEngine
*/
public final byte getNsweNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearest(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**
@ -352,7 +355,8 @@ public class GeoEngine
*/
public final byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearestOriginal(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**

View File

@ -67,7 +67,7 @@ public class GeoEngine
}
/**
* GeoEngine contructor. Loads all geodata files of chosen geodata format.
* GeoEngine constructor. Loads all geodata files of chosen geodata format.
*/
public GeoEngine()
{
@ -314,7 +314,8 @@ public class GeoEngine
*/
public final short getHeightNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearest(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -327,7 +328,8 @@ public class GeoEngine
*/
public final short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearestOriginal(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -339,7 +341,8 @@ public class GeoEngine
*/
public final byte getNsweNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearest(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**
@ -352,7 +355,8 @@ public class GeoEngine
*/
public final byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearestOriginal(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**

View File

@ -67,7 +67,7 @@ public class GeoEngine
}
/**
* GeoEngine contructor. Loads all geodata files of chosen geodata format.
* GeoEngine constructor. Loads all geodata files of chosen geodata format.
*/
public GeoEngine()
{
@ -314,7 +314,8 @@ public class GeoEngine
*/
public final short getHeightNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearest(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -327,7 +328,8 @@ public class GeoEngine
*/
public final short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearestOriginal(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -339,7 +341,8 @@ public class GeoEngine
*/
public final byte getNsweNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearest(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**
@ -352,7 +355,8 @@ public class GeoEngine
*/
public final byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearestOriginal(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**

View File

@ -67,7 +67,7 @@ public class GeoEngine
}
/**
* GeoEngine contructor. Loads all geodata files of chosen geodata format.
* GeoEngine constructor. Loads all geodata files of chosen geodata format.
*/
public GeoEngine()
{
@ -314,7 +314,8 @@ public class GeoEngine
*/
public final short getHeightNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearest(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -327,7 +328,8 @@ public class GeoEngine
*/
public final short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearestOriginal(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -339,7 +341,8 @@ public class GeoEngine
*/
public final byte getNsweNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearest(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**
@ -352,7 +355,8 @@ public class GeoEngine
*/
public final byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearestOriginal(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**

View File

@ -65,7 +65,7 @@ public class GeoEngine
}
/**
* GeoEngine contructor. Loads all geodata files of chosen geodata format.
* GeoEngine constructor. Loads all geodata files of chosen geodata format.
*/
public GeoEngine()
{
@ -312,7 +312,8 @@ public class GeoEngine
*/
public final short getHeightNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearest(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -325,7 +326,8 @@ public class GeoEngine
*/
public final short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearestOriginal(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -337,7 +339,8 @@ public class GeoEngine
*/
public final byte getNsweNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearest(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**
@ -350,7 +353,8 @@ public class GeoEngine
*/
public final byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearestOriginal(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**

View File

@ -67,7 +67,7 @@ public class GeoEngine
}
/**
* GeoEngine contructor. Loads all geodata files of chosen geodata format.
* GeoEngine constructor. Loads all geodata files of chosen geodata format.
*/
public GeoEngine()
{
@ -314,7 +314,8 @@ public class GeoEngine
*/
public final short getHeightNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearest(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -327,7 +328,8 @@ public class GeoEngine
*/
public final short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getHeightNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getHeightNearestOriginal(geoX, geoY, worldZ) : (short) worldZ;
}
/**
@ -339,7 +341,8 @@ public class GeoEngine
*/
public final byte getNsweNearest(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearest(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearest(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**
@ -352,7 +355,8 @@ public class GeoEngine
*/
public final byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
{
return getBlock(geoX, geoY).getNsweNearestOriginal(geoX, geoY, worldZ);
final ABlock block = getBlock(geoX, geoY);
return block != null ? block.getNsweNearestOriginal(geoX, geoY, worldZ) : (byte) 0xFF;
}
/**