@@ -146,38 +146,22 @@ public static DrawType Draw(Block b) {
146
146
}
147
147
148
148
149
- const string Names = "Air Stone Grass Dirt Cobblestone Wood Sapling Bedrock Water StillWater Lava " +
150
- " StillLava Sand Gravel GoldOre IronOre CoalOre Log Leaves Sponge Glass Red Orange Yellow Lime Green " +
151
- " Teal Aqua Cyan Blue Indigo Violet Magenta Pink Black Gray White Dandelion Rose BrownMushroom RedMushroom " +
152
- " Gold Iron DoubleSlab Slab Brick TNT Bookshelf MossyRocks Obsidian CobblestoneSlab Rope Sandstone " +
153
- " Snow Fire LightPink ForestGreen Brown DeepBlue Turquoise Ice CeramicTile Magma Pillar Crate StoneBrick" ;
149
+ const string RawNames = "Air_Stone_Grass_Dirt_Cobblestone_Wood_Sapling_Bedrock_Water_Still water_Lava " +
150
+ "_Still lava_Sand_Gravel_Gold ore_Iron ore_Coal ore_Log_Leaves_Sponge_Glass_Red_Orange_Yellow_Lime_Green " +
151
+ "_Teal_Aqua_Cyan_Blue_Indigo_Violet_Magenta_Pink_Black_Gray_White_Dandelion_Rose_Brown mushroom_Red mushroom " +
152
+ "_Gold_Iron_Double slab_Slab_Brick_TNT_Bookshelf_Mossy rocks_Obsidian_Cobblestone slab_Rope_Sandstone " +
153
+ "_Snow_Fire_Light pink_Forest green_Brown_Deep blue_Turquoise_Ice_Ceramic tile_Magma_Pillar_Crate_Stone brick" ;
154
154
155
155
static string Name ( int block ) {
156
156
// Find start and end of this particular block name
157
157
int start = 0 ;
158
158
for ( int i = 0 ; i < block ; i ++ )
159
- start = Names . IndexOf ( ' ' , start ) + 1 ;
160
- int end = Names . IndexOf ( ' ' , start ) ;
161
- if ( end == - 1 ) end = Names . Length ;
159
+ start = RawNames . IndexOf ( '_' , start ) + 1 ;
162
160
163
- StringBuilder buffer = new StringBuilder ( ) ;
164
- SplitUppercase ( buffer , start , end ) ;
165
- return buffer . ToString ( ) ;
166
- }
167
-
168
- static void SplitUppercase ( StringBuilder buffer , int start , int end ) {
169
- for ( int i = start ; i < end ; i ++ ) {
170
- char c = Names [ i ] ;
171
- bool upper = Char . IsUpper ( c ) && i > start ;
172
- bool nextLower = i < end - 1 && ! Char . IsUpper ( Names [ i + 1 ] ) ;
173
-
174
- if ( upper && nextLower ) {
175
- buffer . Append ( ' ' ) ;
176
- buffer . Append ( Char . ToLower ( c ) ) ;
177
- } else {
178
- buffer . Append ( c ) ;
179
- }
180
- }
161
+ int end = RawNames . IndexOf ( '_' , start ) ;
162
+ if ( end == - 1 ) end = RawNames . Length ;
163
+
164
+ return RawNames . Substring ( start , end - start ) ;
181
165
}
182
166
183
167
0 commit comments