@@ -23,7 +23,7 @@ import kotlin.math.abs
2323import kotlin.math.roundToInt
2424import kotlin.math.roundToLong
2525
26- fun List <Iota>.getDouble (idx : Int , argc : Int = 0): Double {
26+ fun Vector <Iota>.getDouble (idx : Int , argc : Int = 0): Double {
2727 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
2828 if (x is DoubleIota ) {
2929 return x.double
@@ -33,7 +33,7 @@ fun List<Iota>.getDouble(idx: Int, argc: Int = 0): Double {
3333 }
3434}
3535
36- fun List <Iota>.getEntity (idx : Int , argc : Int = 0): Entity {
36+ fun Vector <Iota>.getEntity (idx : Int , argc : Int = 0): Entity {
3737 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
3838 if (x is EntityIota ) {
3939 return x.entity
@@ -42,7 +42,7 @@ fun List<Iota>.getEntity(idx: Int, argc: Int = 0): Entity {
4242 }
4343}
4444
45- fun List <Iota>.getList (idx : Int , argc : Int = 0): Vector <Iota > {
45+ fun Vector <Iota>.getList (idx : Int , argc : Int = 0): Vector <Iota > {
4646 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
4747 if (x is ListIota ) {
4848 return x.list
@@ -51,7 +51,7 @@ fun List<Iota>.getList(idx: Int, argc: Int = 0): Vector<Iota> {
5151 }
5252}
5353
54- fun List <Iota>.getPattern (idx : Int , argc : Int = 0): HexPattern {
54+ fun Vector <Iota>.getPattern (idx : Int , argc : Int = 0): HexPattern {
5555 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
5656 if (x is PatternIota ) {
5757 return x.pattern
@@ -60,7 +60,7 @@ fun List<Iota>.getPattern(idx: Int, argc: Int = 0): HexPattern {
6060 }
6161}
6262
63- fun List <Iota>.getVec3 (idx : Int , argc : Int = 0): Vec3 {
63+ fun Vector <Iota>.getVec3 (idx : Int , argc : Int = 0): Vec3 {
6464 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
6565 if (x is Vec3Iota ) {
6666 return x.vec3
@@ -69,7 +69,7 @@ fun List<Iota>.getVec3(idx: Int, argc: Int = 0): Vec3 {
6969 }
7070}
7171
72- fun List <Iota>.getBool (idx : Int , argc : Int = 0): Boolean {
72+ fun Vector <Iota>.getBool (idx : Int , argc : Int = 0): Boolean {
7373 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
7474 if (x is BooleanIota ) {
7575 return x.bool
@@ -80,7 +80,7 @@ fun List<Iota>.getBool(idx: Int, argc: Int = 0): Boolean {
8080
8181// Helpers
8282
83- fun List <Iota>.getItemEntity (idx : Int , argc : Int = 0): ItemEntity {
83+ fun Vector <Iota>.getItemEntity (idx : Int , argc : Int = 0): ItemEntity {
8484 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
8585 if (x is EntityIota ) {
8686 val e = x.entity
@@ -90,7 +90,7 @@ fun List<Iota>.getItemEntity(idx: Int, argc: Int = 0): ItemEntity {
9090 throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " entity.item" )
9191}
9292
93- fun List <Iota>.getPlayer (idx : Int , argc : Int = 0): ServerPlayer {
93+ fun Vector <Iota>.getPlayer (idx : Int , argc : Int = 0): ServerPlayer {
9494 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
9595 if (x is EntityIota ) {
9696 val e = x.entity
@@ -100,7 +100,7 @@ fun List<Iota>.getPlayer(idx: Int, argc: Int = 0): ServerPlayer {
100100 throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " entity.player" )
101101}
102102
103- fun List <Iota>.getMob (idx : Int , argc : Int = 0): Mob {
103+ fun Vector <Iota>.getMob (idx : Int , argc : Int = 0): Mob {
104104 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
105105 if (x is EntityIota ) {
106106 val e = x.entity
@@ -110,7 +110,7 @@ fun List<Iota>.getMob(idx: Int, argc: Int = 0): Mob {
110110 throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " entity.mob" )
111111}
112112
113- fun List <Iota>.getLivingEntityButNotArmorStand (idx : Int , argc : Int = 0): LivingEntity {
113+ fun Vector <Iota>.getLivingEntityButNotArmorStand (idx : Int , argc : Int = 0): LivingEntity {
114114 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
115115 if (x is EntityIota ) {
116116 val e = x.entity
@@ -120,7 +120,7 @@ fun List<Iota>.getLivingEntityButNotArmorStand(idx: Int, argc: Int = 0): LivingE
120120 throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " entity.living" )
121121}
122122
123- fun List <Iota>.getPositiveDouble (idx : Int , argc : Int = 0): Double {
123+ fun Vector <Iota>.getPositiveDouble (idx : Int , argc : Int = 0): Double {
124124 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
125125 if (x is DoubleIota ) {
126126 val double = x.double
@@ -131,7 +131,7 @@ fun List<Iota>.getPositiveDouble(idx: Int, argc: Int = 0): Double {
131131 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " double.positive" )
132132}
133133
134- fun List <Iota>.getPositiveDoubleUnder (idx : Int , max : Double , argc : Int = 0): Double {
134+ fun Vector <Iota>.getPositiveDoubleUnder (idx : Int , max : Double , argc : Int = 0): Double {
135135 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
136136 if (x is DoubleIota ) {
137137 val double = x.double
@@ -142,7 +142,7 @@ fun List<Iota>.getPositiveDoubleUnder(idx: Int, max: Double, argc: Int = 0): Dou
142142 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " double.positive.less" , max)
143143}
144144
145- fun List <Iota>.getPositiveDoubleUnderInclusive (idx : Int , max : Double , argc : Int = 0): Double {
145+ fun Vector <Iota>.getPositiveDoubleUnderInclusive (idx : Int , max : Double , argc : Int = 0): Double {
146146 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
147147 if (x is DoubleIota ) {
148148 val double = x.double
@@ -153,7 +153,7 @@ fun List<Iota>.getPositiveDoubleUnderInclusive(idx: Int, max: Double, argc: Int
153153 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " double.positive.less.equal" , max)
154154}
155155
156- fun List <Iota>.getDoubleBetween (idx : Int , min : Double , max : Double , argc : Int = 0): Double {
156+ fun Vector <Iota>.getDoubleBetween (idx : Int , min : Double , max : Double , argc : Int = 0): Double {
157157 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
158158 if (x is DoubleIota ) {
159159 val double = x.double
@@ -164,7 +164,7 @@ fun List<Iota>.getDoubleBetween(idx: Int, min: Double, max: Double, argc: Int =
164164 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " double.between" , min, max)
165165}
166166
167- fun List <Iota>.getInt (idx : Int , argc : Int = 0): Int {
167+ fun Vector <Iota>.getInt (idx : Int , argc : Int = 0): Int {
168168 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
169169 if (x is DoubleIota ) {
170170 val double = x.double
@@ -176,7 +176,7 @@ fun List<Iota>.getInt(idx: Int, argc: Int = 0): Int {
176176 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int" )
177177}
178178
179- fun List <Iota>.getLong (idx : Int , argc : Int = 0): Long {
179+ fun Vector <Iota>.getLong (idx : Int , argc : Int = 0): Long {
180180 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
181181 if (x is DoubleIota ) {
182182 val double = x.double
@@ -188,7 +188,7 @@ fun List<Iota>.getLong(idx: Int, argc: Int = 0): Long {
188188 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int" ) // shh we're lying
189189}
190190
191- fun List <Iota>.getPositiveInt (idx : Int , argc : Int = 0): Int {
191+ fun Vector <Iota>.getPositiveInt (idx : Int , argc : Int = 0): Int {
192192 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
193193 if (x is DoubleIota ) {
194194 val double = x.double
@@ -200,7 +200,7 @@ fun List<Iota>.getPositiveInt(idx: Int, argc: Int = 0): Int {
200200 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.positive" )
201201}
202202
203- fun List <Iota>.getPositiveLong (idx : Int , argc : Int = 0): Long {
203+ fun Vector <Iota>.getPositiveLong (idx : Int , argc : Int = 0): Long {
204204 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
205205 if (x is DoubleIota ) {
206206 val double = x.double
@@ -212,7 +212,7 @@ fun List<Iota>.getPositiveLong(idx: Int, argc: Int = 0): Long {
212212 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.positive" )
213213}
214214
215- fun List <Iota>.getPositiveIntUnder (idx : Int , max : Int , argc : Int = 0): Int {
215+ fun Vector <Iota>.getPositiveIntUnder (idx : Int , max : Int , argc : Int = 0): Int {
216216 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
217217 if (x is DoubleIota ) {
218218 val double = x.double
@@ -224,7 +224,7 @@ fun List<Iota>.getPositiveIntUnder(idx: Int, max: Int, argc: Int = 0): Int {
224224 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.positive.less" , max)
225225}
226226
227- fun List <Iota>.getPositiveIntUnderInclusive (idx : Int , max : Int , argc : Int = 0): Int {
227+ fun Vector <Iota>.getPositiveIntUnderInclusive (idx : Int , max : Int , argc : Int = 0): Int {
228228 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
229229 if (x is DoubleIota ) {
230230 val double = x.double
@@ -236,7 +236,7 @@ fun List<Iota>.getPositiveIntUnderInclusive(idx: Int, max: Int, argc: Int = 0):
236236 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.positive.less.equal" , max)
237237}
238238
239- fun List <Iota>.getIntBetween (idx : Int , min : Int , max : Int , argc : Int = 0): Int {
239+ fun Vector <Iota>.getIntBetween (idx : Int , min : Int , max : Int , argc : Int = 0): Int {
240240 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
241241 if (x is DoubleIota ) {
242242 val double = x.double
@@ -248,7 +248,7 @@ fun List<Iota>.getIntBetween(idx: Int, min: Int, max: Int, argc: Int = 0): Int {
248248 throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.between" , min, max)
249249}
250250
251- fun List <Iota>.getBlockPos (idx : Int , argc : Int = 0): BlockPos {
251+ fun Vector <Iota>.getBlockPos (idx : Int , argc : Int = 0): BlockPos {
252252 val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
253253 if (x is Vec3Iota ) {
254254 return BlockPos .containing(x.vec3)
@@ -257,7 +257,7 @@ fun List<Iota>.getBlockPos(idx: Int, argc: Int = 0): BlockPos {
257257 throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " vector" )
258258}
259259
260- fun List <Iota>.getNumOrVec (idx : Int , argc : Int = 0): Either <Double , Vec3 > {
260+ fun Vector <Iota>.getNumOrVec (idx : Int , argc : Int = 0): Either <Double , Vec3 > {
261261 val datum = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
262262 return when (datum) {
263263 is DoubleIota -> Either .left(datum.double)
@@ -270,7 +270,7 @@ fun List<Iota>.getNumOrVec(idx: Int, argc: Int = 0): Either<Double, Vec3> {
270270 }
271271}
272272
273- fun List <Iota>.getLongOrList (idx : Int , argc : Int = 0): Either <Long , Vector <Iota >> {
273+ fun Vector <Iota>.getLongOrList (idx : Int , argc : Int = 0): Either <Long , Vector <Iota >> {
274274 val datum = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
275275 if (datum is DoubleIota ) {
276276 val double = datum.double
@@ -309,15 +309,15 @@ fun aplKinnie(operatee: Either<Double, Vec3>, fn: DoubleUnaryOperator): Iota =
309309 { vec -> Vec3Iota (Vec3 (fn.applyAsDouble(vec.x), fn.applyAsDouble(vec.y), fn.applyAsDouble(vec.z))) }
310310 )
311311
312- inline val Boolean .asActionResult get() = listOf (BooleanIota (this ))
313- inline val Double .asActionResult get() = listOf (DoubleIota (this ))
314- inline val Number .asActionResult get() = listOf (DoubleIota (this .toDouble()))
312+ inline val Boolean .asActionResult: Vector < Iota > get() = Vector .from( listOf (BooleanIota (this ) ))
313+ inline val Double .asActionResult: Vector < Iota > get() = Vector .from( listOf (DoubleIota (this ) ))
314+ inline val Number .asActionResult: Vector < Iota > get() = Vector .from( listOf (DoubleIota (this .toDouble() )))
315315
316- inline val List <Iota >.asActionResult get() = listOf ( ListIota ( Vector .from(this )))
316+ inline val Vector <Iota >.asActionResult: Vector < Iota > get() = Vector .from( listOf ( ListIota (this )))
317317
318- inline val BlockPos .asActionResult get() = listOf (Vec3Iota (Vec3 .atCenterOf(this )))
319- inline val Vector3f .asActionResult get() = listOf (Vec3Iota (Vec3 (this )))
320- inline val Vec3 .asActionResult get() = listOf (Vec3Iota (this ))
318+ inline val BlockPos .asActionResult: Vector < Iota > get() = Vector .from( listOf (Vec3Iota (Vec3 .atCenterOf(this ) )))
319+ inline val Vector3f .asActionResult: Vector < Iota > get() = Vector .from( listOf (Vec3Iota (Vec3 (this ) )))
320+ inline val Vec3 .asActionResult: Vector < Iota > get() = Vector .from( listOf (Vec3Iota (this ) ))
321321
322- inline val Entity ?.asActionResult get() = listOf (if (this == null ) NullIota () else EntityIota (this ))
323- inline val HexPattern .asActionResult get() = listOf (PatternIota (this ))
322+ inline val Entity ?.asActionResult: Vector < Iota > get() = Vector .from( listOf (if (this == null ) NullIota () else EntityIota (this ) ))
323+ inline val HexPattern .asActionResult: Vector < Iota > get() = Vector .from( listOf (PatternIota (this ) ))
0 commit comments