Skip to content

Commit da90204

Browse files
author
Michael Hillcox
committed
Some more refactorying
1 parent 508576c commit da90204

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ private static boolean checkList( List<OreInfo> temp, OreInfo value, ItemStack s
3333
public static void add( String oreIdent, String name, int[] color ) // Takes a string of id:meta or oreName to add to our search list.
3434
{
3535
oreIdent = oreIdent.replaceAll( "\\p{C}", "?" );
36-
int id = 0;
37-
int meta = 0;
36+
int id, meta = 0;
3837

3938
if( oreIdent.contains( ":" ) ) // Hopefully a proper id:meta string.
4039
{
@@ -71,8 +70,7 @@ public static void add( String oreIdent, String name, int[] color ) // Takes a s
7170
}
7271
catch( NumberFormatException e )
7372
{
74-
String notify = String.format( "[Fgt XRay] Doesn't support in-game additions to the ore dictionary yet.. Failed to add." );
75-
mc.ingameGUI.getChatGUI().printChatMessage( new TextComponentString(notify) );
73+
mc.ingameGUI.getChatGUI().printChatMessage( new TextComponentString("[Fgt XRay] Doesn't support in-game additions to the ore dictionary yet.. Failed to add.") );
7674
return;
7775
}
7876

@@ -81,8 +79,7 @@ public static void add( String oreIdent, String name, int[] color ) // Takes a s
8179
//System.out.println( String.format( "Adding ore: %s", oreIdent ) );
8280
for( OreInfo info : OresSearch.searchList ) {
8381
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));
82+
mc.ingameGUI.getChatGUI().printChatMessage(new TextComponentString("[Fgt XRay] This block has already been added to the block list"));
8683
return;
8784
}
8885
}
@@ -137,15 +134,12 @@ public static List<OreInfo> get() // Return the searchList, create it if needed.
137134
System.out.println( String.format( "[Fgt XRay] Ore %s doesn't exist! Skipping. (We shouldn't have this issue here! Please tell me about this!)", key ) );
138135
continue;
139136
}
140-
for( int i = 0; i < oreDictOres.size(); i++ )
141-
{
142-
ItemStack oreItem = oreDictOres.get( i );
143-
if( checkList( temp, value, oreItem ) )
144-
{
145-
System.out.println("[Fgt XRay] Duplicate ore found in Ore Dictionary!!! ("+key+")");
137+
for (ItemStack oreItem : oreDictOres) {
138+
if (checkList(temp, value, oreItem)) {
139+
System.out.println("[Fgt XRay] Duplicate ore found in Ore Dictionary!!! (" + key + ")");
146140
continue;
147141
}
148-
temp.add( new OreInfo( value.oreName, Item.getIdFromItem( oreItem.getItem() ), oreItem.getItemDamage(), value.color, value.draw ) );
142+
temp.add(new OreInfo(value.oreName, Item.getIdFromItem(oreItem.getItem()), oreItem.getItemDamage(), value.color, value.draw));
149143
//System.out.println( String.format("[Fgt XRay] Adding OreInfo( %s, %d, %d, %s, %b ) ", value.oreName, Item.getIdFromItem( oreItem.getItem() ), oreItem.getItemDamage(), value.color[0], value.draw ) );
150144
}
151145
}

0 commit comments

Comments
 (0)