-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: inventory loot insert now works in nether, add WIP changes fo…
…r array and inventory
- Loading branch information
Showing
36 changed files
with
513 additions
and
173 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
array/data/dt.array/functions/api/experimental/call_sum.mcfunction
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,5 +1,4 @@ | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value [1,2,3,4] | ||
function dt.array:api/experimental/sum | ||
tellraw @p ["call_sum call.return: ",{"nbt":"call.return","storage":"call_stack:"}] | ||
function call_stack:pop |
19 changes: 19 additions & 0 deletions
19
array/data/dt.array/functions/api/helper/math/add_with_max.mcfunction
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function call_stack:push | ||
execute store result score #augend dt.tmp run data get storage call_stack: this.arg0 | ||
execute store result score #addend dt.tmp run data get storage call_stack: this.arg1 | ||
execute store result score #max dt.tmp run data get storage call_stack: this.arg2 | ||
data modify storage call_stack: this.return set value [0] | ||
|
||
scoreboard players operation #sum dt.tmp = #augend dt.tmp | ||
scoreboard players operation #sum dt.tmp += #addend dt.tmp | ||
|
||
scoreboard players set #remainder dt.tmp 0 | ||
execute if score #sum dt.tmp > #max dt.tmp run scoreboard players operation #remainder dt.tmp = #sum dt.tmp | ||
execute if score #sum dt.tmp > #max dt.tmp run scoreboard players operation #remainder dt.tmp %= #max dt.tmp | ||
execute if score #sum dt.tmp > #max dt.tmp run scoreboard players operation #sum dt.tmp = #max dt.tmp | ||
|
||
execute store result storage call_stack: this.return[0] int 1 run scoreboard players get #sum dt.tmp | ||
execute if score #remainder dt.tmp matches 1.. run data modify storage call_stack: this.return append value 0 | ||
execute if score #remainder dt.tmp matches 1.. store result storage call_stack: this.return[1] int 1 run scoreboard players get #remainder dt.tmp | ||
|
||
function call_stack:pop |
19 changes: 19 additions & 0 deletions
19
array/data/dt.array/functions/api/helper/math/to_sum_components.mcfunction
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function call_stack:push | ||
execute store result score #total dt.tmp run data get storage call_stack: this.arg0 | ||
execute store result score #max dt.tmp run data get storage call_stack: this.arg1 | ||
|
||
scoreboard players operation #remainder dt.tmp = #total dt.tmp | ||
scoreboard players operation #remainder dt.tmp %= #max dt.tmp | ||
|
||
scoreboard players operation #num_max dt.tmp = #total dt.tmp | ||
scoreboard players operation #num_max dt.tmp /= #max dt.tmp | ||
|
||
execute store result storage call_stack: call.arg0 int 1 run scoreboard players get #num_max dt.tmp | ||
execute store result storage call_stack: call.arg1 int 1 run scoreboard players get #max dt.tmp | ||
function dt.array:api/n_array_of | ||
data modify storage call_stack: this.return set from storage call_stack: call.return | ||
|
||
execute if score #remainder dt.tmp matches 1.. run data modify storage call_stack: this.return append value 0 | ||
execute if score #remainder dt.tmp matches 1.. store result storage call_stack: this.return[-1] int 1 run scoreboard players get #remainder dt.tmp | ||
|
||
function call_stack:pop |
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
27 changes: 27 additions & 0 deletions
27
array/data/dt.array/functions/api/reduce/math/cumulative_add.mcfunction
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
data modify storage call_stack: call.accumulator set value [] | ||
function dt.array:api/func/reducer/push | ||
# arg1 = amount | ||
# arg2 = max | ||
execute if data storage call_stack: this.continue run data modify storage call_stack: call.arg0 set from storage call_stack: this.head | ||
execute if data storage call_stack: this.continue run data modify storage call_stack: call.arg1 set from storage call_stack: this.arg1 | ||
execute if data storage call_stack: this.continue run data modify storage call_stack: call.arg2 set from storage call_stack: this.arg2 | ||
execute if data storage call_stack: this.continue run tellraw @p ["cumulative_addAA call: ",{"nbt":"call","storage":"call_stack:"}] | ||
execute if data storage call_stack: this.continue run function dt.array:api/helper/math/add_with_max | ||
execute if data storage call_stack: this.continue run tellraw @p ["cumulative_addAA call.return: ",{"nbt":"call.return","storage":"call_stack:"}] | ||
execute if data storage call_stack: this.continue run data modify storage call_stack: this.accumulator append from storage call_stack: call.return[0] | ||
execute if data storage call_stack: this.continue run data modify storage call_stack: this.arg1 set value 0 | ||
execute if data storage call_stack: this.continue if data storage call_stack: call.return[1] run data modify storage call_stack: this.arg1 set from storage call_stack: call.return[1] | ||
execute if data storage call_stack: this.continue unless data storage call_stack: call.return[1] run data modify storage call_stack: this.accumulator append from storage call_stack: this.tail[] | ||
execute if data storage call_stack: this.continue unless data storage call_stack: call.return[1] run data modify storage call_stack: this.tail set value [] | ||
execute if data storage call_stack: this.continue unless data storage call_stack: this.tail[0] run data modify storage call_stack: call.arg0 set from storage call_stack: this.arg1 | ||
execute if data storage call_stack: this.continue unless data storage call_stack: this.tail[0] run data modify storage call_stack: call.arg1 set from storage call_stack: this.arg2 | ||
execute if data storage call_stack: this.continue unless data storage call_stack: this.tail[0] run tellraw @p ["cumulative_add call: ",{"nbt":"call","storage":"call_stack:"}] | ||
execute if data storage call_stack: this.continue unless data storage call_stack: this.tail[0] run function dt.array:api/helper/math/to_sum_components | ||
execute if data storage call_stack: this.continue unless data storage call_stack: this.tail[0] run tellraw @p ["cumulative_add call.return: ",{"nbt":"call.return","storage":"call_stack:"}] | ||
execute if data storage call_stack: this.continue unless data storage call_stack: this.tail[0] run data modify storage call_stack: this.accumulator append from storage call_stack: call.return[] | ||
execute if data storage call_stack: this.continue unless data storage call_stack: this.tail[0] run data modify storage call_stack: this.tail set value [] | ||
|
||
execute if data storage call_stack: this.continue run function dt.array:api/func/reducer/args/set | ||
execute if data storage call_stack: this.continue run function dt.array:api/reduce/math/cumulative_add | ||
function dt.array:api/func/pop |
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
66 changes: 66 additions & 0 deletions
66
array/data/dt.array/functions/test/api/helper/math/test_add_with_max.mcfunction
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# function unittest:api/config/enable/detailed_results | ||
data modify storage unittest:in name set value "Test add_with_max" | ||
function unittest:api/test_suite/setup | ||
|
||
data modify storage unittest:in name set value "Test over max" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value 2 | ||
data modify storage call_stack: call.arg1 set value 15 | ||
data modify storage call_stack: call.arg2 set value 16 | ||
function dt.array:api/helper/math/add_with_max | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [16,1] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
|
||
|
||
data modify storage unittest:in name set value "Test below max" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value 9 | ||
data modify storage call_stack: call.arg1 set value 1 | ||
data modify storage call_stack: call.arg2 set value 16 | ||
function dt.array:api/helper/math/add_with_max | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [10] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
|
||
|
||
|
||
data modify storage unittest:in name set value "Test at max" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value 9 | ||
data modify storage call_stack: call.arg1 set value 7 | ||
data modify storage call_stack: call.arg2 set value 16 | ||
function dt.array:api/helper/math/add_with_max | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [16] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
|
||
|
||
data modify storage unittest:in name set value "Test already over max" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value 19 | ||
data modify storage call_stack: call.arg1 set value 7 | ||
data modify storage call_stack: call.arg2 set value 16 | ||
function dt.array:api/helper/math/add_with_max | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [16,10] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
|
||
|
||
function unittest:api/test_suite/teardown |
50 changes: 50 additions & 0 deletions
50
array/data/dt.array/functions/test/api/helper/math/test_to_sum_components.mcfunction
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
function unittest:api/config/enable/detailed_results | ||
data modify storage unittest:in name set value "Test to_sum_components" | ||
function unittest:api/test_suite/setup | ||
|
||
data modify storage unittest:in name set value "Test sum greater than max" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value 14 | ||
data modify storage call_stack: call.arg1 set value 4 | ||
function dt.array:api/helper/math/to_sum_components | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [4,4,4,2] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
|
||
|
||
|
||
data modify storage unittest:in name set value "Test sum equal to max" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value 14 | ||
data modify storage call_stack: call.arg1 set value 14 | ||
function dt.array:api/helper/math/to_sum_components | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [14] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
|
||
|
||
|
||
|
||
data modify storage unittest:in name set value "Test sum less than to max" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value 14 | ||
data modify storage call_stack: call.arg1 set value 19 | ||
function dt.array:api/helper/math/to_sum_components | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [14] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
|
||
|
||
function unittest:api/test_suite/teardown |
46 changes: 46 additions & 0 deletions
46
array/data/dt.array/functions/test/api/math/test_cumulative_add.mcfunction
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# function unittest:api/config/enable/detailed_results | ||
data modify storage unittest:in name set value "Test Cumulative Add" | ||
function unittest:api/test_suite/setup | ||
|
||
data modify storage unittest:in name set value "Test 1" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value [16,2,4,9] | ||
data modify storage call_stack: call.arg1 set value 15 | ||
data modify storage call_stack: call.arg2 set value 16 | ||
function dt.array:api/reduce/math/cumulative_add | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [16,16,5,9] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
data modify storage unittest:in name set value "Test over" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value [16,15,14] | ||
data modify storage call_stack: call.arg1 set value 5 | ||
data modify storage call_stack: call.arg2 set value 16 | ||
function dt.array:api/reduce/math/cumulative_add | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [16,16,16,2] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
|
||
|
||
data modify storage unittest:in name set value "Test over 2" | ||
function unittest:api/test_case/setup | ||
function call_stack:push | ||
data modify storage call_stack: call.arg0 set value [16,19,14] | ||
data modify storage call_stack: call.arg1 set value 5 | ||
data modify storage call_stack: call.arg2 set value 16 | ||
function dt.array:api/reduce/math/cumulative_add | ||
data modify storage unittest:in actual set from storage call_stack: call.return | ||
data modify storage unittest:in expected set value [16,16,16,6] | ||
function call_stack:pop | ||
function unittest:api/assert/equal | ||
function unittest:api/test_case/teardown | ||
|
||
function unittest:api/test_suite/teardown |
75 changes: 0 additions & 75 deletions
75
array/data/dt.array/functions/test/api/reduce/set/test_difference.mcfunction
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.