Skip to content

Commit

Permalink
✨ Added version tag parser
Browse files Browse the repository at this point in the history
  • Loading branch information
haiiro2gou committed Dec 10, 2023
1 parent 8debb2b commit 81f67aa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
20 changes: 20 additions & 0 deletions data/ashen_lib/functions/version/parser/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> ashen_lib:version/parser/
#
# Convert version notation string into numerical array
#
# @input storage
# ashen_lib:api Argument
# Version : string
# @output storage
# ashen_lib:api Argument
# Return : int[]
# @api

# Validate
execute unless data storage ashen_lib:api Argument.Version run tellraw @a [{"nbt": "Ashen.Global.Prefix.ERROR", "storage": "global"},{"translate": "Ashen.Api.Error.VersionParser", "fallback": "Missing Argument: Version"}]

# Exec
execute if data storage ashen_lib:api Argument.Version run function ashen_lib:version/parser/core/

# Reset
data remove storage ashen_lib:api Argument.Version
10 changes: 10 additions & 0 deletions data/ashen_lib/functions/version/parser/core/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> ashen_lib:version/parser/core/
# @within function ashen_lib:version/parser/

# Split by one
data modify storage ashen_lib:api Argument.String set from storage ashen_lib:api Argument.Version
function ashen_lib:string/split/

# Combine to 3 numbers
data modify storage ashen_lib:api Argument.CharArray set from storage ashen_lib:api Return
function ashen_lib:string/concat/

0 comments on commit 81f67aa

Please sign in to comment.