-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getter on gamevalues in GameValues.kt and add vectors
- Loading branch information
1 parent
79db2f6
commit cc5c7b8
Showing
9 changed files
with
128 additions
and
95 deletions.
There are no files selected for viewing
184 changes: 92 additions & 92 deletions
184
KotlinFire/src/main/kotlin/io/github/flyingpig525/base/item/GameValues.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 24 additions & 1 deletion
25
KotlinFire/src/main/kotlin/io/github/flyingpig525/base/item/type/VecItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
package io.github.flyingpig525.base.item.type | ||
|
||
class VecItem | ||
import io.github.flyingpig525.base.JsonData | ||
import io.github.flyingpig525.base.item.Item | ||
|
||
class VecItem(x: Number, y: Number, z: Number) : Item(ID.VECTOR), JsonData { | ||
val x = x.toFloat() | ||
val y = y.toFloat() | ||
val z = z.toFloat() | ||
|
||
override fun getJsonData(): String { | ||
return """ | ||
"x": $x, | ||
"y": $y, | ||
"z": $z | ||
""".trimIndent() | ||
} | ||
|
||
companion object { | ||
fun List<Number>.toVecItem(): VecItem? { | ||
if (this.size == 3) return VecItem(this[0].toFloat(), this[1].toFloat(), this[2].toFloat()) | ||
return null | ||
} | ||
} | ||
|
||
} |