@@ -23,7 +23,7 @@ import kotlin.math.abs
23
23
import kotlin.math.roundToInt
24
24
import kotlin.math.roundToLong
25
25
26
- fun List <Iota>.getDouble (idx : Int , argc : Int = 0): Double {
26
+ fun Vector <Iota>.getDouble (idx : Int , argc : Int = 0): Double {
27
27
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
28
28
if (x is DoubleIota ) {
29
29
return x.double
@@ -33,7 +33,7 @@ fun List<Iota>.getDouble(idx: Int, argc: Int = 0): Double {
33
33
}
34
34
}
35
35
36
- fun List <Iota>.getEntity (idx : Int , argc : Int = 0): Entity {
36
+ fun Vector <Iota>.getEntity (idx : Int , argc : Int = 0): Entity {
37
37
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
38
38
if (x is EntityIota ) {
39
39
return x.entity
@@ -42,7 +42,7 @@ fun List<Iota>.getEntity(idx: Int, argc: Int = 0): Entity {
42
42
}
43
43
}
44
44
45
- fun List <Iota>.getList (idx : Int , argc : Int = 0): Vector <Iota > {
45
+ fun Vector <Iota>.getList (idx : Int , argc : Int = 0): Vector <Iota > {
46
46
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
47
47
if (x is ListIota ) {
48
48
return x.list
@@ -51,7 +51,7 @@ fun List<Iota>.getList(idx: Int, argc: Int = 0): Vector<Iota> {
51
51
}
52
52
}
53
53
54
- fun List <Iota>.getPattern (idx : Int , argc : Int = 0): HexPattern {
54
+ fun Vector <Iota>.getPattern (idx : Int , argc : Int = 0): HexPattern {
55
55
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
56
56
if (x is PatternIota ) {
57
57
return x.pattern
@@ -60,7 +60,7 @@ fun List<Iota>.getPattern(idx: Int, argc: Int = 0): HexPattern {
60
60
}
61
61
}
62
62
63
- fun List <Iota>.getVec3 (idx : Int , argc : Int = 0): Vec3 {
63
+ fun Vector <Iota>.getVec3 (idx : Int , argc : Int = 0): Vec3 {
64
64
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
65
65
if (x is Vec3Iota ) {
66
66
return x.vec3
@@ -69,7 +69,7 @@ fun List<Iota>.getVec3(idx: Int, argc: Int = 0): Vec3 {
69
69
}
70
70
}
71
71
72
- fun List <Iota>.getBool (idx : Int , argc : Int = 0): Boolean {
72
+ fun Vector <Iota>.getBool (idx : Int , argc : Int = 0): Boolean {
73
73
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
74
74
if (x is BooleanIota ) {
75
75
return x.bool
@@ -80,7 +80,7 @@ fun List<Iota>.getBool(idx: Int, argc: Int = 0): Boolean {
80
80
81
81
// Helpers
82
82
83
- fun List <Iota>.getItemEntity (idx : Int , argc : Int = 0): ItemEntity {
83
+ fun Vector <Iota>.getItemEntity (idx : Int , argc : Int = 0): ItemEntity {
84
84
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
85
85
if (x is EntityIota ) {
86
86
val e = x.entity
@@ -90,7 +90,7 @@ fun List<Iota>.getItemEntity(idx: Int, argc: Int = 0): ItemEntity {
90
90
throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " entity.item" )
91
91
}
92
92
93
- fun List <Iota>.getPlayer (idx : Int , argc : Int = 0): ServerPlayer {
93
+ fun Vector <Iota>.getPlayer (idx : Int , argc : Int = 0): ServerPlayer {
94
94
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
95
95
if (x is EntityIota ) {
96
96
val e = x.entity
@@ -100,7 +100,7 @@ fun List<Iota>.getPlayer(idx: Int, argc: Int = 0): ServerPlayer {
100
100
throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " entity.player" )
101
101
}
102
102
103
- fun List <Iota>.getMob (idx : Int , argc : Int = 0): Mob {
103
+ fun Vector <Iota>.getMob (idx : Int , argc : Int = 0): Mob {
104
104
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
105
105
if (x is EntityIota ) {
106
106
val e = x.entity
@@ -110,7 +110,7 @@ fun List<Iota>.getMob(idx: Int, argc: Int = 0): Mob {
110
110
throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " entity.mob" )
111
111
}
112
112
113
- fun List <Iota>.getLivingEntityButNotArmorStand (idx : Int , argc : Int = 0): LivingEntity {
113
+ fun Vector <Iota>.getLivingEntityButNotArmorStand (idx : Int , argc : Int = 0): LivingEntity {
114
114
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
115
115
if (x is EntityIota ) {
116
116
val e = x.entity
@@ -120,7 +120,7 @@ fun List<Iota>.getLivingEntityButNotArmorStand(idx: Int, argc: Int = 0): LivingE
120
120
throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " entity.living" )
121
121
}
122
122
123
- fun List <Iota>.getPositiveDouble (idx : Int , argc : Int = 0): Double {
123
+ fun Vector <Iota>.getPositiveDouble (idx : Int , argc : Int = 0): Double {
124
124
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
125
125
if (x is DoubleIota ) {
126
126
val double = x.double
@@ -131,7 +131,7 @@ fun List<Iota>.getPositiveDouble(idx: Int, argc: Int = 0): Double {
131
131
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " double.positive" )
132
132
}
133
133
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 {
135
135
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
136
136
if (x is DoubleIota ) {
137
137
val double = x.double
@@ -142,7 +142,7 @@ fun List<Iota>.getPositiveDoubleUnder(idx: Int, max: Double, argc: Int = 0): Dou
142
142
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " double.positive.less" , max)
143
143
}
144
144
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 {
146
146
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
147
147
if (x is DoubleIota ) {
148
148
val double = x.double
@@ -153,7 +153,7 @@ fun List<Iota>.getPositiveDoubleUnderInclusive(idx: Int, max: Double, argc: Int
153
153
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " double.positive.less.equal" , max)
154
154
}
155
155
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 {
157
157
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
158
158
if (x is DoubleIota ) {
159
159
val double = x.double
@@ -164,7 +164,7 @@ fun List<Iota>.getDoubleBetween(idx: Int, min: Double, max: Double, argc: Int =
164
164
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " double.between" , min, max)
165
165
}
166
166
167
- fun List <Iota>.getInt (idx : Int , argc : Int = 0): Int {
167
+ fun Vector <Iota>.getInt (idx : Int , argc : Int = 0): Int {
168
168
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
169
169
if (x is DoubleIota ) {
170
170
val double = x.double
@@ -176,7 +176,7 @@ fun List<Iota>.getInt(idx: Int, argc: Int = 0): Int {
176
176
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int" )
177
177
}
178
178
179
- fun List <Iota>.getLong (idx : Int , argc : Int = 0): Long {
179
+ fun Vector <Iota>.getLong (idx : Int , argc : Int = 0): Long {
180
180
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
181
181
if (x is DoubleIota ) {
182
182
val double = x.double
@@ -188,7 +188,7 @@ fun List<Iota>.getLong(idx: Int, argc: Int = 0): Long {
188
188
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int" ) // shh we're lying
189
189
}
190
190
191
- fun List <Iota>.getPositiveInt (idx : Int , argc : Int = 0): Int {
191
+ fun Vector <Iota>.getPositiveInt (idx : Int , argc : Int = 0): Int {
192
192
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
193
193
if (x is DoubleIota ) {
194
194
val double = x.double
@@ -200,7 +200,7 @@ fun List<Iota>.getPositiveInt(idx: Int, argc: Int = 0): Int {
200
200
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.positive" )
201
201
}
202
202
203
- fun List <Iota>.getPositiveLong (idx : Int , argc : Int = 0): Long {
203
+ fun Vector <Iota>.getPositiveLong (idx : Int , argc : Int = 0): Long {
204
204
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
205
205
if (x is DoubleIota ) {
206
206
val double = x.double
@@ -212,7 +212,7 @@ fun List<Iota>.getPositiveLong(idx: Int, argc: Int = 0): Long {
212
212
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.positive" )
213
213
}
214
214
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 {
216
216
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
217
217
if (x is DoubleIota ) {
218
218
val double = x.double
@@ -224,7 +224,7 @@ fun List<Iota>.getPositiveIntUnder(idx: Int, max: Int, argc: Int = 0): Int {
224
224
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.positive.less" , max)
225
225
}
226
226
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 {
228
228
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
229
229
if (x is DoubleIota ) {
230
230
val double = x.double
@@ -236,7 +236,7 @@ fun List<Iota>.getPositiveIntUnderInclusive(idx: Int, max: Int, argc: Int = 0):
236
236
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.positive.less.equal" , max)
237
237
}
238
238
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 {
240
240
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
241
241
if (x is DoubleIota ) {
242
242
val double = x.double
@@ -248,7 +248,7 @@ fun List<Iota>.getIntBetween(idx: Int, min: Int, max: Int, argc: Int = 0): Int {
248
248
throw MishapInvalidIota .of(x, if (argc == 0 ) idx else argc - (idx + 1 ), " int.between" , min, max)
249
249
}
250
250
251
- fun List <Iota>.getBlockPos (idx : Int , argc : Int = 0): BlockPos {
251
+ fun Vector <Iota>.getBlockPos (idx : Int , argc : Int = 0): BlockPos {
252
252
val x = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
253
253
if (x is Vec3Iota ) {
254
254
return BlockPos .containing(x.vec3)
@@ -257,7 +257,7 @@ fun List<Iota>.getBlockPos(idx: Int, argc: Int = 0): BlockPos {
257
257
throw MishapInvalidIota .ofType(x, if (argc == 0 ) idx else argc - (idx + 1 ), " vector" )
258
258
}
259
259
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 > {
261
261
val datum = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
262
262
return when (datum) {
263
263
is DoubleIota -> Either .left(datum.double)
@@ -270,7 +270,7 @@ fun List<Iota>.getNumOrVec(idx: Int, argc: Int = 0): Either<Double, Vec3> {
270
270
}
271
271
}
272
272
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 >> {
274
274
val datum = this .getOrElse(idx) { throw MishapNotEnoughArgs (idx + 1 , this .size) }
275
275
if (datum is DoubleIota ) {
276
276
val double = datum.double
@@ -309,15 +309,15 @@ fun aplKinnie(operatee: Either<Double, Vec3>, fn: DoubleUnaryOperator): Iota =
309
309
{ vec -> Vec3Iota (Vec3 (fn.applyAsDouble(vec.x), fn.applyAsDouble(vec.y), fn.applyAsDouble(vec.z))) }
310
310
)
311
311
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() )))
315
315
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 )))
317
317
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 ) ))
321
321
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