Don't use Streams.concat because they don't improve performance here

This commit is contained in:
DBotThePony 2023-03-25 20:51:29 +07:00
parent b4aee84249
commit 581f337198
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 5 additions and 5 deletions

View File

@ -209,7 +209,7 @@ fun ICapabilityProvider.getMatteryEnergySided(side: Direction? = null): LazyOpti
* Contains all items that player might carry
*/
fun Player.itemsStream(includeCosmetics: Boolean = true): Stream<out ItemStack> {
val streams = LinkedList<Stream<out ItemStack>>()
val streams = ArrayList<Stream<out ItemStack>>()
streams.add(inventory.stream())
matteryPlayer?.let {
@ -226,7 +226,7 @@ fun Player.itemsStream(includeCosmetics: Boolean = true): Stream<out ItemStack>
streams.add(cosmeticArmorStream())
}
return Streams.concat(*streams.toTypedArray())
return streams.stream().flatMap { it }
}
/**
@ -256,7 +256,7 @@ fun Player.allItemsStream(includeCosmetics: Boolean = true): Stream<out ItemStac
* Contains all items that player might carry
*/
fun Player.awareItemsStream(includeCosmetics: Boolean = false): Stream<out AwareItemStack> {
val streams = LinkedList<Stream<out AwareItemStack>>()
val streams = ArrayList<Stream<out AwareItemStack>>()
streams.add(inventory.awareStream())
matteryPlayer?.let {
@ -273,7 +273,7 @@ fun Player.awareItemsStream(includeCosmetics: Boolean = false): Stream<out Aware
streams.add(cosmeticArmorAwareStream())
}
return Streams.concat(*streams.toTypedArray())
return streams.stream().flatMap { it }
}
/**

View File

@ -87,7 +87,7 @@ private fun Player.curiosStreamImpl(includeCosmetics: Boolean): Stream<out ItemS
}
}
return Streams.concat(*result.toTypedArray())
return result.stream().flatMap { it }
}
fun Player.curiosStream(includeCosmetics: Boolean = true): Stream<out ItemStack> {