Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💥 v1 #2

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
14 changes: 1 addition & 13 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,10 @@
"master"
],
"git.branchProtectionPrompt": "alwaysPrompt",
"gitmoji.addCustomEmoji": [
{
"code": ":balance_scale:",
"emoji": "⚖️",
"description": "Corrections regarding balance adjustment",
"description_zh_cn": ""
}
],
"git-graph.customEmojiShortcodeMappings": [
{
"shortcode": ":technologist:",
"emoji": "🧑‍💻"
},
{
"shortcode": ":balance_scale:",
"emoji": "⚖️"
}
]
],
}
4 changes: 2 additions & 2 deletions data/ashen_lib/advancements/handler/consume_item.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"criteria": {
"requirement": {
"trigger": "minecraft:location"
"trigger": "consume_item"
}
}
}
}
4 changes: 2 additions & 2 deletions data/ashen_lib/advancements/handler/inventory_change.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"criteria": {
"requirement": {
"trigger": "minecraft:location"
"trigger": "inventory_changed"
}
}
}
}
10 changes: 2 additions & 8 deletions data/ashen_lib/advancements/handler/killed.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{
"criteria": {
"requirement": {
"trigger": "minecraft:location"
"trigger": "player_killed_entity"
}
}
}{
"criteria": {
"requirement": {
"trigger": "minecraft:location"
}
}
}
}
4 changes: 2 additions & 2 deletions data/ashen_lib/advancements/handler/using_item.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"criteria": {
"requirement": {
"trigger": "minecraft:location"
"trigger": "using_item"
}
}
}
}
1 change: 0 additions & 1 deletion data/ashen_lib/functions/handler/using_item.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@

# load dependents
function #ashen_lib:handler/using_item

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#> ashen_lib:load
#> ashen_lib:load/
#
# Functions executed at #load
#
Expand All @@ -8,11 +8,11 @@
data modify storage global Ashen.Lib.IsProduction set value false

# Load once the first time
execute if data storage global Ashen.Lib{IsProduction: 1b} unless data storage global Ashen.Lib.Version run function ashen_lib:load_once
execute if data storage global Ashen.Lib{IsProduction: 0b} run function ashen_lib:load_once
execute if data storage global Ashen.Lib{IsProduction: 1b} unless data storage global Ashen.Lib.Version run function ashen_lib:load/once
execute if data storage global Ashen.Lib{IsProduction: 0b} run function ashen_lib:load/once

# Migration
function ashen_lib:migration/

# Dependent pack loader
function #ashen_lib:load
function #ashen_lib:load/
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#> ashen_lib:define_const
# @within function ashen_lib:load_once
#> ashen_lib:load/define_const
# @within function ashen_lib:load/once

scoreboard players set #-100 Ashen.Global.Const -100
scoreboard players set #-99 Ashen.Global.Const -99
Expand Down
77 changes: 77 additions & 0 deletions data/ashen_lib/functions/load/once.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#> ashen_lib:load/once
#
# Functions executed on initial #load
#
# @within function ashen_lib:load/

# Version tag
data modify storage global Ashen.Lib.Version set value "v0.4.0"

# Reset
scoreboard objectives remove Ashen.Lib.FirstJoin

# Dimension
#> Clipboard
# @public
#declare dimension ashen_lib:clipboard
#declare dimension_type ashen_lib:clipboard
execute in ashen_lib:clipboard run forceload add 0 0
execute in ashen_lib:clipboard run setblock 0 0 0 shulker_box{Lock: "lock"}
execute in ashen_lib:clipboard run summon marker 0 0 0 {UUID: [I; 0, 0, 0, 0]}

# Score
#> Global
# @public
scoreboard objectives add Ashen.Global.Global dummy {"translate": "Ashen.Global.ScoreGlobal", "fallback": "[Ashen Lib] Global"}

#> Random
# @private
#declare tag Random
summon area_effect_cloud ~ ~ ~ {Age:-2147483648,Duration:-1,WaitTime:-2147483648,Tags:["Random"]}
execute store result score #Random.Base Ashen.Global.Global run data get entity @e[tag=Random,limit=1] UUID[1]
execute store result score #Random.Carry Ashen.Global.Global run data get entity @e[tag=Random,limit=1] UUID[3]
kill @e[tag=Random,limit=1]

#> Const
# @public
scoreboard objectives add Ashen.Global.Const dummy {"translate": "Ashen.Global.ScoreConst", "fallback": "[Ashen Lib] Const"}
function ashen_lib:load/define_const

#> User ID
# @public
scoreboard objectives add Ashen.Global.UserID dummy {"translate": "Ashen.Global.ScoreFirstJoin", "fallback": "[Ashen Lib] User ID"}

#> Handler
# @within function
# ashen_lib:load/once
# ashen_lib:handler/*
# ashen_lib:tick/**
scoreboard objectives add Ashen.Lib.FirstJoin custom:play_time {"translate": "Ashen.Lib.ScoreFirstJoin", "fallback": "[Ashen Lib] First Join"}
scoreboard objectives add Ashen.Lib.Rejoin custom:leave_game {"translate": "Ashen.Lib.ScoreRejoin", "fallback": "[Ashen Lib] Rejoin"}
scoreboard objectives add Ashen.Lib.Death deathCount {"translate": "Ashen.Lib.ScoreDeath", "fallback": "[Ashen Lib] Death"}
scoreboard objectives add Ashen.Lib.Respawn custom:time_since_death {"translate": "Ashen.Lib.ScoreRespawn", "fallback": "[Ashen Lib] Respawn"}
scoreboard objectives add Ashen.Lib.Sneak custom:sneak_time {"translate": "Ashen.Lib.ScoreSneak", "fallback": "[Ashen Lib] Sneak"}
scoreboard objectives add Ashen.Lib.Drop custom:drop {"translate": "Ashen.Lib.ScoreDrop", "fallback": "[Ashen Lib] Drop Item"}

#> Temporary
# @public
scoreboard objectives add Ashen.Global.Temporary dummy {"translate": "Ashen.Global.ScoreTemporary", "fallback": "[Ashen Lib] Temp"}

# Storage
#> Global
# @public
#declare storage global
data modify storage global Ashen.Global.Prefix.INFO set value "§3INFO >> §r"
data modify storage global Ashen.Global.Prefix.ERROR set value "§cERROR >> §r"
data modify storage global Ashen.Global.Prefix.WARN set value "§eWARN >> §r"

#> API
# @public
#declare storage ashen_lib:api

#> Temporary
# @public
#declare storage ashen_lib:temp

# Dependencies
function #ashen_lib:load/once
99 changes: 0 additions & 99 deletions data/ashen_lib/functions/load_once.mcfunction

This file was deleted.

2 changes: 1 addition & 1 deletion data/ashen_lib/functions/migration/.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Migration Process
#
# @within function ashen_lib:load
# @within function ashen_lib:load/

execute if data storage global Ashen.Lib{Version: "v0.0.0"} run function ashen_lib:migration/v0.0.1/

Expand Down
4 changes: 2 additions & 2 deletions data/ashen_lib/functions/random/_index.d.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
#> rng
# @within function
# ashen_lib:random/*
# ashen_lib:load_once
# ashen_lib:load/once
#declare score_holder #Random.Base
#declare score_holder #Random.Carry
#declare score_holder #Random.Carry
10 changes: 5 additions & 5 deletions data/ashen_lib/functions/version/check/.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
#
# @input storage
# ashen_lib:api Argument
# TargetVersion : string
# MinVersion : string
# MaxVersion : string?
# TargetVersion : string
# @output storage
# ashen_lib:api Argument
# Return : boolean
# ashen_lib:api Return
# Compatible : boolean
# @api

# Validate
execute unless data storage ashen_lib:api Argument.MinVersion run tellraw @a [{"nbt": "Ashen.Global.Prefix.ERROR", "storage": "global"},{"translate": "Ashen.Api.Error.MinVersion", "fallback": "Missing Argument: MinVersion"}]
execute unless data storage ashen_lib:api Argument.MaxVersion run data modify storage ashen_lib:api Argument.MaxVersion set value "inf"
# execute unless data storage ashen_lib:api Argument.MaxVersion run
execute unless data storage ashen_lib:api Argument.TargetVersion run tellraw @a [{"nbt": "Ashen.Global.Prefix.ERROR", "storage": "global"},{"translate": "Ashen.Api.Error.TargetVersion", "fallback": "Missing Argument: TargetVersion"}]

# Exec
execute if data storage ashen_lib:api Argument.MinVersion if data storage ashen_lib:api Argument.TargetVersion run function ashen_lib:version/check/core/
execute if data storage ashen_lib:api Argument.MinVersion if data storage ashen_lib:api Argument.TargetVersion if function ashen_lib:version/check/core/ run tellraw @a [{"nbt":"Ashen.Global.Prefix.ERROR","storage":"global"},{"translate":"Ashen.Api.Error.Common","fallback":"Error has occurred during api process"}]

# Reset
data remove storage ashen_lib:api Argument.MinVersion
Expand Down
Loading
Loading