@@ -40,18 +40,6 @@ import kotlin.math.ceil
4040 *
4141 */
4242object WorldUtils {
43- /* *
44- * Gets the closest entity of type [T] within a specified range.
45- */
46- inline fun <reified T : Entity > SafeContext.getClosestEntity (
47- type : Class <out T >, // This is a class reference, not an instance of the class.
48- pos : Vec3d ,
49- range : Double ,
50- predicate : (T ) -> Boolean = { true },
51- ): T ? {
52- return getClosestEntity(pos, range, predicate)
53- }
54-
5543 /* *
5644 * Gets the closest entity of type [T] within a specified range.
5745 *
@@ -67,6 +55,7 @@ object WorldUtils {
6755 pos : Vec3d ,
6856 range : Double ,
6957 predicate : (T ) -> Boolean = { true },
58+ type : Class <out T > = T : :class.java,
7059 ): T ? {
7160 var closest: T ? = null
7261 var closestDistance = Double .MAX_VALUE
@@ -84,20 +73,6 @@ object WorldUtils {
8473 return closest
8574 }
8675
87- /* *
88- * Gets all entities of type [T] within a specified distance from a position.
89- */
90- inline fun <T : Entity > SafeContext.getFastEntities (
91- type : Class <out T >, // This is a class reference, not an instance of the class.
92- pos : Vec3d ,
93- distance : Double ,
94- pointer : MutableList <Entity >? = null,
95- iterator : (Entity , Int ) -> Unit = { _, _ -> },
96- predicate : (Entity ) -> Boolean = { true },
97- ) {
98- return getFastEntities(pos, distance, pointer, iterator, predicate)
99- }
100-
10176 /* *
10277 * Gets all entities of type [T] within a specified distance from a position.
10378 *
@@ -132,6 +107,7 @@ object WorldUtils {
132107 pointer : MutableList <T >? = null,
133108 iterator : (T , Int ) -> Unit = { _, _ -> },
134109 predicate : (T ) -> Boolean = { true },
110+ type : Class <out T > = T : :class.java,
135111 ) {
136112 val chunks = ceil(distance / 16 ).toInt()
137113 val sectionX = pos.x.toInt() shr 4
@@ -157,20 +133,6 @@ object WorldUtils {
157133 }
158134 }
159135
160- /* *
161- * Gets all entities of type [T] within a specified distance from a position.
162- */
163- inline fun <reified T : Entity > SafeContext.getEntities (
164- type : Class <out T >, // This is a class reference, not an instance of the class.
165- pos : Vec3d ,
166- distance : Double ,
167- pointer : MutableList <Entity >? = null,
168- iterator : (Entity , Int ) -> Unit = { _, _ -> },
169- predicate : (Entity ) -> Boolean = { true },
170- ) {
171- return getEntities(pos, distance, pointer, iterator, predicate)
172- }
173-
174136 /* *
175137 * Gets all entities of type [T] within a specified distance from a position.
176138 *
@@ -187,6 +149,7 @@ object WorldUtils {
187149 pointer : MutableList <T >? = null,
188150 iterator : (T , Int ) -> Unit = { _, _ -> },
189151 predicate : (T ) -> Boolean = { true },
152+ type : Class <out T > = T : :class.java,
190153 ) {
191154 world.entities.filterPointer(pointer, iterator) { entity ->
192155 entity != player &&
0 commit comments