Added a Nullcheck

This commit is contained in:
canitzp 2016-02-18 22:48:53 +01:00
parent f0d7585fd9
commit 51de083209

View file

@ -37,7 +37,8 @@ public class PosUtil{
} }
public static int getMetadata(BlockPos pos, IBlockAccess world){ public static int getMetadata(BlockPos pos, IBlockAccess world){
return getBlock(pos, world).getMetaFromState(world.getBlockState(pos)); Block block = getBlock(pos, world);
return block != null ? getBlock(pos, world).getMetaFromState(world.getBlockState(pos)) : 0;
} }
public static BlockPos offset(BlockPos pos, int x, int y, int z){ public static BlockPos offset(BlockPos pos, int x, int y, int z){