diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/container/IEnhancedContainer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/container/IEnhancedContainer.kt index 24ca9c248..6edd68823 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/container/IEnhancedContainer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/container/IEnhancedContainer.kt @@ -15,6 +15,8 @@ import ru.dbotthepony.mc.otm.core.collect.filter import ru.dbotthepony.mc.otm.core.collect.map import ru.dbotthepony.mc.otm.core.isNotEmpty import java.util.function.Predicate +import java.util.stream.Stream +import java.util.stream.StreamSupport /** * "Backward-compatible" enhanced container interface, where all methods can be derived/emulated from existing [IContainer] ([Container]) code @@ -291,6 +293,10 @@ interface IEnhancedContainer : IContainer, RecipeInput, Iterable, Sta return addItem(stack, false, slots, onlyIntoExisting, popTime).isEmpty } + fun stream(): Stream { + return StreamSupport.stream(spliterator(), false) + } + private class Wrapper(private val parent: Container) : IEnhancedContainer { override fun clearContent() { return parent.clearContent()