Skip to content

Commit bd4c2b4

Browse files
author
Michael Hillcox
committed
This should fix #11
1 parent 996eb3f commit bd4c2b4

3 files changed

Lines changed: 18 additions & 14 deletions

File tree

src/main/java/com/fgtXray/FgtXRay.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public class FgtXRay
4646
public static final int keyIndex_showXrayMenu = 1;
4747
public static final int[] keyBind_keyValues =
4848
{
49-
Keyboard.KEY_NONE,
50-
Keyboard.KEY_NONE
49+
Keyboard.KEY_X,
50+
Keyboard.KEY_Z
5151
};
5252
public static final String[] keyBind_descriptions =
5353
{

src/main/java/com/fgtXray/client/KeyBindingHandler.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package com.fgtXray.client;
22

3+
import com.fgtXray.FgtXRay;
4+
import com.fgtXray.client.gui.GuiSettings;
5+
import net.minecraft.client.Minecraft;
6+
import net.minecraft.client.gui.GuiChat;
37
import net.minecraftforge.fml.client.FMLClientHandler;
48
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
59
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
610

7-
import net.minecraft.client.Minecraft;
8-
import net.minecraft.client.gui.GuiChat;
9-
import com.fgtXray.FgtXRay;
10-
import com.fgtXray.client.gui.GuiSettings;
11-
1211
public class KeyBindingHandler
1312
{
1413
private Minecraft mc = Minecraft.getMinecraft();

src/main/java/com/fgtXray/config/DefaultConfig.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
import net.minecraft.block.Block;
1212
import net.minecraft.init.Blocks;
1313
import net.minecraftforge.common.config.Configuration;
14+
import net.minecraftforge.oredict.OreDictionary;
1415

1516
public 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

Comments
 (0)