Sort Items alphabetically in creative tab.

This commit is contained in:
AlgorithmX2
2014-07-01 20:44:35 -05:00
parent 9a2614540d
commit 72ea6a5fa5
2 changed files with 29 additions and 4 deletions
+13 -2
View File
@@ -1,5 +1,6 @@
package appeng.items.materials;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumSet;
@@ -298,11 +299,21 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
@Override
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List cList)
{
for (MaterialType mat : MaterialType.values())
List<MaterialType> types = Arrays.asList( MaterialType.values() );
Collections.sort( types, new Comparator<MaterialType>() {
@Override
public int compare(MaterialType o1, MaterialType o2)
{
return o1.name().compareTo( o2.name() );
}
} );
for (MaterialType mat : types)
{
if ( mat.damageValue >= 0 && mat.isRegistered() )
cList.add( new ItemStack( this, 1, mat.damageValue ) );
}
}
}