File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
common/src/main/kotlin/com/lambda/util Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ package com.lambda.util.collections
1414 * @param predicate The predicate function that determines whether an element should be included based on its type and other criteria.
1515 */
1616inline fun <reified R , C : MutableCollection <in R >> Iterable <* >.filterIsInstanceTo (
17- destination : C ,
17+ destination : C ? = null ,
1818 predicate : (R ) -> Boolean
1919) {
20+ if (destination == null ) return
2021 for (element in this ) if (element is R && predicate(element)) destination.add(element)
2122}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ object EntityUtils {
2525 var closest: T ? = null
2626 var closestDistance = Double .MAX_VALUE
2727
28- val iterator: (T ) -> Any = {
28+ val iterator: (T ) -> Unit = {
2929 val distance = it.squaredDistanceTo(pos)
3030 if (distance < closestDistance) {
3131 closest = it
@@ -72,7 +72,7 @@ object EntityUtils {
7272 inline fun <reified T : Entity > SafeContext.getFastEntities (
7373 pos : Vec3d ,
7474 distance : Double ,
75- pointer : MutableList <T >,
75+ pointer : MutableList <T >? = null ,
7676 noinline predicate : (T ) -> Boolean = { true },
7777 noinline iterator : (T ) -> Unit = { },
7878 ) {
@@ -107,7 +107,7 @@ object EntityUtils {
107107 * @return A list of entities of type [T] within the specified distance from the position without the player.
108108 */
109109 inline fun <reified T : Entity > SafeContext.getEntities (
110- pointer : MutableList <T >,
110+ pointer : MutableList <T >? = null ,
111111 noinline predicate : (T ) -> Boolean = { true },
112112 noinline iterator : (T ) -> Unit = { },
113113 ) {
You can’t perform that action at this time.
0 commit comments