mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 11:15:12 -04:00
sorting items in creative tab by their unlocalized name now
This commit is contained in:
parent
65d951d50c
commit
dcc6a97302
@ -59,7 +59,9 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
|||||||
// Workaround for MC's untyped lists...
|
// Workaround for MC's untyped lists...
|
||||||
def add[T](list: util.List[T], value: Any) = list.add(value.asInstanceOf[T])
|
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).
|
(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, _))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
@ -48,8 +48,10 @@ class Delegator(id: Int) extends Item(id) {
|
|||||||
override def getSubItems(itemId: Int, tab: CreativeTabs, list: util.List[_]) {
|
override def getSubItems(itemId: Int, tab: CreativeTabs, list: util.List[_]) {
|
||||||
// Workaround for MC's untyped lists...
|
// Workaround for MC's untyped lists...
|
||||||
def add[T](list: util.List[T], value: Any) = list.add(value.asInstanceOf[T])
|
def add[T](list: util.List[T], value: Any) = list.add(value.asInstanceOf[T])
|
||||||
(0 until subItems.length).filter(id => subItems(id).showInItemList).
|
(0 until subItems.length).filter(subItems(_).showInItemList).
|
||||||
foreach(id => add(list, new ItemStack(this, 1, id)))
|
map(subItems(_).createItemStack()).
|
||||||
|
sortBy(_.getUnlocalizedName).
|
||||||
|
foreach(add(list, _))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
Loading…
x
Reference in New Issue
Block a user