sorting items in creative tab by their unlocalized name now

This commit is contained in:
Florian Nücke 2014-01-16 18:15:29 +01:00
parent 65d951d50c
commit dcc6a97302
2 changed files with 7 additions and 3 deletions

View File

@ -59,7 +59,9 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
// Workaround for MC's untyped lists...
def add[T](list: util.List[T], value: Any) = list.add(value.asInstanceOf[T])
(0 until subBlocks.length).filter(id => subBlocks(id).showInItemList && subBlocks(id).parent == this).
foreach(id => add(list, new ItemStack(this, 1, id)))
map(new ItemStack(this, 1, _)).
sortBy(_.getUnlocalizedName).
foreach(add(list, _))
}
// ----------------------------------------------------------------------- //

View File

@ -48,8 +48,10 @@ class Delegator(id: Int) extends Item(id) {
override def getSubItems(itemId: Int, tab: CreativeTabs, list: util.List[_]) {
// Workaround for MC's untyped lists...
def add[T](list: util.List[T], value: Any) = list.add(value.asInstanceOf[T])
(0 until subItems.length).filter(id => subItems(id).showInItemList).
foreach(id => add(list, new ItemStack(this, 1, id)))
(0 until subItems.length).filter(subItems(_).showInItemList).
map(subItems(_).createItemStack()).
sortBy(_.getUnlocalizedName).
foreach(add(list, _))
}
// ----------------------------------------------------------------------- //