fCraft.Map.ConvertBlockTypes C# (CSharp) Method

ConvertBlockTypes() public method

Converts nonstandard (50-255) blocks using the given mapping.
public ConvertBlockTypes ( [ mapping ) : bool
mapping [ Byte array of length 256.
return bool
        public bool ConvertBlockTypes( [NotNull] byte[] mapping )
        {
            if ( mapping == null )
                throw new ArgumentNullException( "mapping" );
            if ( mapping.Length != 256 )
                throw new ArgumentException( "Mapping must list all 256 blocks", "mapping" );

            bool mapped = false;
            fixed ( byte* ptr = Blocks ) {
                for ( int j = 0; j < Blocks.Length; j++ ) {
                    if ( ptr[j] > 49 ) {
                        ptr[j] = mapping[ptr[j]];
                        mapped = true;
                    }
                }
            }
            if ( mapped )
                HasChangedSinceSave = true;
            return mapped;
        }