Move probablyParallelStream to ext

This commit is contained in:
DBotThePony 2022-11-03 21:40:11 +07:00
parent 026a670dec
commit bdb2e85bcd
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 9 additions and 9 deletions

View File

@ -409,3 +409,11 @@ fun ResourceLocation.toUUID(): UUID {
fun String.toUUID(): UUID {
return UUID.nameUUIDFromBytes(toByteArray(Charsets.UTF_8))
}
fun <T> Collection<T>.probablyParallelStream(): Stream<out T> {
if (size >= 400) {
return parallelStream()
}
return stream()
}

View File

@ -23,18 +23,10 @@ import org.apache.logging.log4j.LogManager
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.core.integerDivisionDown
import ru.dbotthepony.mc.otm.core.integerDivisionUp
import ru.dbotthepony.mc.otm.core.probablyParallelStream
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.core.set
import ru.dbotthepony.mc.otm.data.stream
import java.util.stream.Stream
private fun <T> Collection<T>.probablyParallelStream(): Stream<out T> {
if (size >= 400) {
return parallelStream()
}
return stream()
}
object MatterManager : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(), "otm_matter") {
const val DIRECTORY = "otm_matter"