Skip to content

Commit 508576c

Browse files
author
Michael Hillcox
committed
Fixed #3. You can no longer add 2 of the same ore
1 parent b34617e commit 508576c

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

src/main/java/com/fgtxray/client/OresSearch.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,16 @@ public static void add( String oreIdent, String name, int[] color ) // Takes a s
7777
}
7878

7979
}
80+
8081
//System.out.println( String.format( "Adding ore: %s", oreIdent ) );
82+
for( OreInfo info : OresSearch.searchList ) {
83+
if( info.getId() == id && info.getMeta() == meta ) {
84+
String notify = String.format("[Fgt XRay] This block has already been added to the block list");
85+
mc.ingameGUI.getChatGUI().printChatMessage(new TextComponentString(notify));
86+
return;
87+
}
88+
}
89+
8190
OresSearch.searchList.add( new OreInfo( name, id, meta, color, true ) );
8291
String notify = String.format( "[Fgt XRay] successfully added %s.", oreIdent );
8392
mc.ingameGUI.getChatGUI().printChatMessage(new TextComponentString(notify));

src/main/java/com/fgtxray/client/gui/GuiNewOre.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public void initGui()
6060

6161
oreName = new GuiTextField( 1, this.fontRenderer, width / 2 - 108, height / 2 + 8, 220, 20 );
6262
oreIdent = new GuiTextField( 0, this.fontRenderer, width / 2 - 108, height / 2 + 32, 220, 20 );
63-
oreName.setText( "Name of block");
64-
oreIdent.setText( "ModName:BlockName" ); // TODO: oreName
63+
oreName.setText( "Block Name");
64+
oreIdent.setText( "ID:META" ); // TODO: oreName
6565
}
6666

6767
@Override

src/main/java/com/fgtxray/reference/OreInfo.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ public OreInfo( String name, int id, int meta, int[] color, boolean draw )
1717
this.color = color;
1818
this.draw = draw;
1919
}
20-
20+
21+
public String getOreName() {
22+
return oreName;
23+
}
24+
25+
public int getMeta() {
26+
return meta;
27+
}
28+
29+
public int getId() {
30+
return id;
31+
}
32+
2133
public void disable() // Stop drawing this ore.
2234
{
2335
this.draw = false;

0 commit comments

Comments
 (0)