1111import net .minecraft .block .Block ;
1212import net .minecraft .init .Blocks ;
1313import net .minecraftforge .common .config .Configuration ;
14+ import net .minecraftforge .oredict .OreDictionary ;
1415
1516public class DefaultConfig {
1617 // Below are the 'default' ores/blocks to add through the ore dictionary.
17- final static Map <String , OreInfo > defaults = new HashMap <String , OreInfo >()
18+ private final static Map <String , OreInfo > defaults = new HashMap <String , OreInfo >()
1819 {{
1920 put ("oreLapis" , new OreInfo ("Lapis" , 0 , 0 , new int []{0 , 0 , 255 }, false ) );
2021 put ("oreCopper" , new OreInfo ("Copper" , 0 , 0 , new int []{204 , 102 , 0 }, true ) );
@@ -26,18 +27,17 @@ public class DefaultConfig {
2627 put ("oreDiamond" , new OreInfo ("Diamond" , 0 , 0 , new int []{136 , 136 , 255 }, false ) );
2728 put ("blockDiamond" , new OreInfo ("Diamond Block" , 0 , 0 , new int []{136 , 136 , 255 }, false ) );
2829 put ("oreEmerald" , new OreInfo ("Emerald" , 0 , 0 , new int []{0 , 136 , 10 }, true ) );
29- put ("blockGold " , new OreInfo ("Gold Block " , 0 , 0 , new int []{255 , 255 , 0 }, false ) );
30+ put ("oreGold " , new OreInfo ("Gold" , 0 , 0 , new int []{255 , 255 , 0 }, false ) );
3031 put ("oreRedstone" , new OreInfo ("Redstone" , 0 , 0 , new int []{255 , 0 , 0 }, false ) );
3132 put ("oreIron" , new OreInfo ("Iron" , 0 , 0 , new int []{170 , 117 , 37 }, false ) );
3233 put ("oreSilver" , new OreInfo ("Silver" , 0 , 0 , new int []{143 ,143 ,143 }, false ) );
33- put ("mossystone" , new OreInfo ("Mossy Stone" , 0 , 0 , new int []{0 , 0 , 255 }, false ) );
3434 put ("oreQuartz" , new OreInfo ("Quartz" , 0 , 0 , new int []{30 ,74 ,0 }, false ) );
3535 put ("oreCoal" , new OreInfo ("Coal" , 0 , 0 , new int []{0 , 0 , 0 }, false ) );
3636 put ("blockGlass" , new OreInfo ("Glass" , 0 , 0 , new int []{136 , 136 , 255 }, false ) );
3737 }};
3838
3939 // Default block to add. Mostly just so people can add custom blocks manually through the config until I setup a gui for it.
40- final static List <OreInfo > custom = new ArrayList <OreInfo >()
40+ private final static List <OreInfo > custom = new ArrayList <OreInfo >()
4141 {{
4242 add ( new OreInfo ("Redstone Wire" , Block .getIdFromBlock ( Blocks .REDSTONE_WIRE ), 0 , new int []{255 , 0 , 0 }, false ) );
4343 add ( new OreInfo ("Chest" , Block .getIdFromBlock ( Blocks .CHEST ), 0 , new int []{255 , 0 , 255 }, true ) );
@@ -46,17 +46,22 @@ public class DefaultConfig {
4646
4747 public static void create (Configuration config ) // Put default blocks and settings into the config file.
4848 {
49- config .get (config .CATEGORY_GENERAL , "searchdist" , 0 ); // Default search distance is index 0 (8)
50-
49+ config .get (Configuration .CATEGORY_GENERAL , "searchdist" , 0 ); // Default search distance is index 0 (8)
50+ //OreDictionary ores = new OreDictionary();
51+
5152 for ( Entry <String , OreInfo > ore : defaults .entrySet () )
5253 {
5354 String key = ore .getKey ();
5455 OreInfo value = ore .getValue ();
56+
57+ if ( !OreDictionary .doesOreNameExist ( key ) )
58+ continue ;
59+
5560 String category = value .oreName .replaceAll ("\\ s+" , "" ).toLowerCase (); // No whitespace or capitals in the config file categories
5661
5762 config .get ("oredict." +category , "dictname" , "SOMETHINGBROKE" ).set ( key ); // We need the capitals for the ore dictionary.
5863 config .get ("oredict." +category , "guiname" , "SOMETHINGBROKE" ).set ( value .oreName );
59- config .get ("oredict." +category , "id" , -1 ).set ( value . id );
64+ config .get ("oredict." +category , "id" , -1 ).set ( OreDictionary . getOreID ( key ) );
6065 config .get ("oredict." +category , "meta" , -1 ).set ( value .meta );
6166 config .get ("oredict." +category , "red" , -1 ).set ( value .color [0 ] );
6267 config .get ("oredict." +category , "green" , -1 ).set ( value .color [1 ] );
0 commit comments