@@ -167,12 +167,10 @@ static string GetColor(NBTag comp, string type) {
167167 return r . ToString ( "X2" ) + g . ToString ( "X2" ) + b . ToString ( "X2" ) ;
168168 }
169169
170- public static BlockDefinition [ ] blockDefs = new BlockDefinition [ 256 ] ;
171-
172- static void ParseBlockDefinitions ( NBTag cpe , Map map , String fileName ) {
170+ static void ParseBlockDefinitions ( NBTag cpe , Map map , string fileName ) {
173171 NBTag blocks = cpe [ "BlockDefinitions" ] ;
174172 bool hasBlockDefs = false ;
175- blockDefs = new BlockDefinition [ 256 ] ;
173+ BlockDefinition [ ] defs = new BlockDefinition [ 256 ] ;
176174
177175 foreach ( NBTag tag in blocks ) {
178176 if ( tag . Type != NBTType . Compound ) continue ;
@@ -226,35 +224,36 @@ static void ParseBlockDefinitions(NBTag cpe, Map map, String fileName) {
226224 if ( PropsEquals ( def , BlockDefinition . GlobalDefs [ def . BlockID ] ) )
227225 continue ;
228226
229- blockDefs [ def . BlockID ] = def ;
227+ defs [ def . BlockID ] = def ;
230228 hasBlockDefs = true ;
231229 }
232230
233231 if ( hasBlockDefs ) {
234232 BlockDefinition [ ] realDefs = new BlockDefinition [ 256 ] ;
235233 int count = 0 ;
236- for ( int i = 0 ; i < 256 ; i ++ ) {
237- if ( blockDefs [ i ] == BlockDefinition . GlobalDefs [ i ] ) realDefs [ i ] = null ;
234+ for ( int i = 0 ; i < 256 ; i ++ ) {
235+ if ( defs [ i ] == BlockDefinition . GlobalDefs [ i ] ) realDefs [ i ] = null ;
238236 else {
239237 count ++ ;
240- realDefs [ i ] = blockDefs [ i ] ;
238+ realDefs [ i ] = defs [ i ] ;
241239 }
242240 }
243- blockDefs = realDefs ;
241+ defs = realDefs ;
244242
245243 string path = Paths . BlockDefsDirectory ;
246244 path = Path . Combine ( path , Path . GetFileName ( fileName ) + ".txt" ) ;
247245 map . Metadata [ "CPE" , "HasBlockDefFile" ] = "true" ;
248246 map . Metadata [ "CPE" , "BlockDefFileName" ] = Path . GetFileName ( fileName ) ;
249247 try {
250248 using ( Stream s = File . Create ( path ) )
251- JsonSerializer . SerializeToStream ( blockDefs , s ) ;
249+ JsonSerializer . SerializeToStream ( defs , s ) ;
252250 }
253251 catch ( Exception ex ) {
254252 Logger . Log ( LogType . Error , "BlockDefinitions.Save: " + ex ) ;
255253 }
256254 }
257255 }
256+
258257 static bool PropsEquals ( BlockDefinition a , BlockDefinition b ) {
259258 if ( b == null || b . Name == null )
260259 return false ;
0 commit comments