Don't use parallelStream
because https://github.com/MinecraftForge/EventBus/issues/44
This commit is contained in:
parent
d811a671c5
commit
2ec47c5d59
@ -246,7 +246,8 @@ fun String.toUUID(): UUID {
|
||||
|
||||
fun <T> Collection<T>.probablyParallelStream(): Stream<out T> {
|
||||
if (size >= 400) {
|
||||
return parallelStream()
|
||||
// TODO: https://github.com/MinecraftForge/EventBus/issues/44
|
||||
return stream()
|
||||
}
|
||||
|
||||
return stream()
|
||||
|
@ -392,7 +392,7 @@ class QuantumBatteryItem : Item {
|
||||
|
||||
companion object {
|
||||
fun clientDisconnect(event: ClientPlayerNetworkEvent.LoggingOut) {
|
||||
ForgeRegistries.ITEMS.values.parallelStream().forEach { if (it is QuantumBatteryItem) it.clientPowerMap.clear() }
|
||||
ForgeRegistries.ITEMS.values.stream().forEach { if (it is QuantumBatteryItem) it.clientPowerMap.clear() }
|
||||
}
|
||||
|
||||
fun readPacket(buff: FriendlyByteBuf): ChargePacket {
|
||||
|
@ -5,8 +5,6 @@ import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.tags.TagKey
|
||||
import net.minecraft.world.item.Item
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.probablyParallelStream
|
||||
import ru.dbotthepony.mc.otm.core.nbt.set
|
||||
import ru.dbotthepony.mc.otm.core.set
|
||||
|
||||
class InsertAction : AbstractRegistryAction {
|
||||
@ -68,7 +66,7 @@ class InsertAction : AbstractRegistryAction {
|
||||
if (key != null) {
|
||||
if (replaceIfExists) {
|
||||
// search & replace in parallel, if possible
|
||||
val replaced = registry.probablyParallelStream().anyMatch {
|
||||
val replaced = registry.stream().anyMatch {
|
||||
if (it is MutableKeyEntry && it.key == key) {
|
||||
if (!comparePriority || it.priority < priority!!) {
|
||||
it.matter = matter
|
||||
@ -93,7 +91,7 @@ class InsertAction : AbstractRegistryAction {
|
||||
)
|
||||
}
|
||||
} else {
|
||||
if (registry.probablyParallelStream().anyMatch { it is MutableKeyEntry && it.key == key }) {
|
||||
if (registry.stream().anyMatch { it is MutableKeyEntry && it.key == key }) {
|
||||
fail { "Value with key $key already exists" }
|
||||
return
|
||||
}
|
||||
@ -110,7 +108,7 @@ class InsertAction : AbstractRegistryAction {
|
||||
} else {
|
||||
if (replaceIfExists) {
|
||||
// search & replace in parallel, if possible
|
||||
val replaced = registry.probablyParallelStream().anyMatch {
|
||||
val replaced = registry.stream().anyMatch {
|
||||
if (it is MutableTagEntry && it.tag == tag) {
|
||||
if (!comparePriority || it.priority < priority!!) {
|
||||
it.matter = matter
|
||||
@ -135,7 +133,7 @@ class InsertAction : AbstractRegistryAction {
|
||||
)
|
||||
}
|
||||
} else {
|
||||
if (registry.probablyParallelStream().anyMatch { it is MutableTagEntry && it.tag == tag }) {
|
||||
if (registry.stream().anyMatch { it is MutableTagEntry && it.tag == tag }) {
|
||||
fail { "Value with tag $tag already exists" }
|
||||
return
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ object MatterManager {
|
||||
val ignoreDamageables = data["ignore_damageables"]?.asBoolean ?: false
|
||||
val allowBacktrack = data["allow_backtrack"]?.asBoolean ?: true
|
||||
|
||||
var stream = server.recipeManager.byType(findRecipeType).values.parallelStream().filter { !it.isIncomplete }
|
||||
var stream = server.recipeManager.byType(findRecipeType).values.stream().filter { !it.isIncomplete }
|
||||
|
||||
if (ignoreDamageables) {
|
||||
stream = stream.filter { it.ingredients.stream().flatMap { it.items.stream() }.noneMatch { it.isDamageableItem } }
|
||||
@ -523,7 +523,7 @@ object MatterManager {
|
||||
val allowBacktrack = data["allow_backtrack"]?.asBoolean ?: true
|
||||
val ignoreDamageables = data["ignore_damageables"]?.asBoolean ?: false
|
||||
val isCritical = data["is_critical"]?.asBoolean ?: true
|
||||
var stream = server.recipeManager.byType(RecipeType.CRAFTING).values.parallelStream().filter { !it.isIncomplete }
|
||||
var stream = server.recipeManager.byType(RecipeType.CRAFTING).values.stream().filter { !it.isIncomplete }
|
||||
|
||||
if (ignoreDamageables) {
|
||||
stream = stream.filter { it.ingredients.stream().flatMap { it.items.stream() }.noneMatch { it.isDamageableItem } }
|
||||
|
Loading…
Reference in New Issue
Block a user