Skip to content
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
13 changes: 13 additions & 0 deletions datapack/data/load/functions/__init.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# If you are a user of this library, do not modify this function, or you risk
# causing compatibility issues with other data packs. If you have a good reason
# to *add* something, feel free to make an issue on the GitHub for this project:
# https://github.com/LanternMC/Load

# Add the common objective to be used for version resolution.
scoreboard objectives add load dummy

# Reset all scores on this objective to allow for version resolution on reload.
scoreboard players reset * load

# Call a nonexistent function to allow for this data pack to be extended later.
function load:__init2
8 changes: 8 additions & 0 deletions datapack/data/load/tags/functions/__init.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
"load:__init",
"#load:standard",
"#load:load",
"#load:post_load"
]
}
3 changes: 3 additions & 0 deletions datapack/data/load/tags/functions/post_load.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"values": []
}
5 changes: 5 additions & 0 deletions datapack/data/load/tags/functions/standard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"#vplib:load/init"
]
}
2 changes: 1 addition & 1 deletion datapack/data/minecraft/tags/functions/load.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"values": [
"#vplib:load/init"
"#load:__init"
]
}
2 changes: 1 addition & 1 deletion datapack/data/vplib/functions/load/init.mcfunction
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#> vplib:load/init
# Description: Initialize versioning objective and load core module.
# From: '#vplib:core/load/init(#minecraft:load)'
# From: '#vplib:core/load/init(#load:standard)'

# Add Objective
scoreboard objectives add vplib.load dummy
Expand Down
16 changes: 0 additions & 16 deletions datapack/data/vplib/functions/math/api/color/hsv_to_rgb.mcfunction

This file was deleted.

10 changes: 0 additions & 10 deletions datapack/data/vplib/functions/math/api/lcg/ranged.mcfunction

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions datapack/data/vplib/functions/math/api/power/solve.mcfunction

This file was deleted.

12 changes: 0 additions & 12 deletions datapack/data/vplib/functions/math/api/quadratic/solve.mcfunction

This file was deleted.

11 changes: 0 additions & 11 deletions datapack/data/vplib/functions/math/api/sqrt/solve.mcfunction

This file was deleted.

3 changes: 0 additions & 3 deletions datapack/data/vplib/functions/math/api/uninstall.mcfunction

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
# From: #vplib:math/api/quadratic/solve

# Run function if lib version matches
execute if score #vplib.math.current vplib.load matches 1 run function vplib:math/v1/sqrt/solve

function vplib:math/api/sqrt/solve
execute if score #vplib.math.current vplib.load matches 1 run function vplib:math/v1/sqrt/solve
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
data remove block -30000000 0 4320 Items

# Set armor
replaceitem block -30000000 0 4320 container.0 minecraft:leather_boots{display:{color:0}}
replaceitem block -30000000 0 4320 container.1 minecraft:leather_leggings{display:{color:0}}
replaceitem block -30000000 0 4320 container.2 minecraft:leather_chestplate{display:{color:0}}
replaceitem block -30000000 0 4320 container.3 minecraft:leather_helmet{display:{color:0}}
item replace block -30000000 0 4320 container.0 with minecraft:leather_boots{display: {color: 0}}
item replace block -30000000 0 4320 container.1 with minecraft:leather_leggings{display: {color: 0}}
item replace block -30000000 0 4320 container.2 with minecraft:leather_chestplate{display: {color: 0}}
item replace block -30000000 0 4320 container.3 with minecraft:leather_helmet{display: {color: 0}}

# Loop color
scoreboard players operation $color vplib.math += $color_rate vplib.math
Expand Down
73 changes: 1 addition & 72 deletions datapack/data/vplib/functions/math/v1/core/constants.mcfunction
Original file line number Diff line number Diff line change
@@ -1,75 +1,4 @@
#> vplib:math/v1/core/constants

scoreboard players set #-1 vplib.math -1
scoreboard players set #1 vplib.math 1
scoreboard players set #2 vplib.math 2
scoreboard players set #3 vplib.math 3
scoreboard players set #4 vplib.math 4
scoreboard players set #5 vplib.math 5
scoreboard players set #6 vplib.math 6
scoreboard players set #7 vplib.math 7
scoreboard players set #8 vplib.math 8
scoreboard players set #9 vplib.math 9
scoreboard players set #10 vplib.math 10
scoreboard players set #11 vplib.math 11
scoreboard players set #12 vplib.math 12
scoreboard players set #13 vplib.math 13
scoreboard players set #14 vplib.math 14
scoreboard players set #15 vplib.math 15
scoreboard players set #16 vplib.math 16
scoreboard players set #17 vplib.math 17
scoreboard players set #18 vplib.math 18
scoreboard players set #19 vplib.math 19
scoreboard players set #20 vplib.math 20
scoreboard players set #25 vplib.math 25
scoreboard players set #30 vplib.math 30
scoreboard players set #35 vplib.math 35
scoreboard players set #32 vplib.math 32
scoreboard players set #40 vplib.math 40
scoreboard players set #45 vplib.math 45
scoreboard players set #50 vplib.math 50
scoreboard players set #55 vplib.math 55
scoreboard players set #60 vplib.math 60
scoreboard players set #64 vplib.math 64
scoreboard players set #65 vplib.math 65
scoreboard players set #70 vplib.math 70
scoreboard players set #75 vplib.math 75
scoreboard players set #80 vplib.math 80
scoreboard players set #85 vplib.math 85
scoreboard players set #90 vplib.math 90
scoreboard players set #95 vplib.math 95
scoreboard players set #100 vplib.math 100
scoreboard players set #128 vplib.math 128
scoreboard players set #256 vplib.math 256
scoreboard players set #512 vplib.math 512
scoreboard players set #1000 vplib.math 1000
scoreboard players set #1024 vplib.math 1024
scoreboard players set #2048 vplib.math 2048
scoreboard players set #4096 vplib.math 4096
scoreboard players set #8192 vplib.math 8192
scoreboard players set #8192 vplib.math 8192
scoreboard players set #10000 vplib.math 10000
scoreboard players set #16384 vplib.math 16384
scoreboard players set #32768 vplib.math 32768
scoreboard players set #65536 vplib.math 65546
scoreboard players set #100000 vplib.math 100000
scoreboard players set #131072 vplib.math 131072
scoreboard players set #262144 vplib.math 262144
scoreboard players set #524288 vplib.math 524288
scoreboard players set #1000000 vplib.math 1000000
scoreboard players set #1048576 vplib.math 1048576
scoreboard players set #2097152 vplib.math 2097152
scoreboard players set #4194304 vplib.math 4194304
scoreboard players set #8388608 vplib.math 8388608
scoreboard players set #10000000 vplib.math 10000000
scoreboard players set #16777216 vplib.math 16777216
scoreboard players set #33554432 vplib.math 33554432
scoreboard players set #67108864 vplib.math 67108864
scoreboard players set #100000000 vplib.math 100000000
scoreboard players set #134217728 vplib.math 134217728
scoreboard players set #268435456 vplib.math 268435456
scoreboard players set #536870912 vplib.math 536870912
scoreboard players set #1000000000 vplib.math 1000000000
scoreboard players set #1073741824 vplib.math 1073741824

# LCG
scoreboard players set #lcg.multiplier vplib.math 1630111353
16 changes: 8 additions & 8 deletions datapack/data/vplib/functions/math/v1/lcg/reset_seed.mcfunction
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#> vplib:math/v1/lcg/reset_seed

# Summon AEC
execute at @e[limit=1] run summon minecraft:area_effect_cloud ~ ~ ~ {Duration:1,Tags:["vplib.uuid"]}
# Get starting seed from a temp AEC UUID
execute positioned -30000000 0 4320 run summon minecraft:area_effect_cloud ~ ~ ~ {Duration:1, UUID:[I; 43, 0, 0, 1], Tags:["vplib.uuid"]}
execute store result score #lcg.seed vplib.math run data get entity 2b-0-0-0-1 UUID[0]
kill 2b-0-0-0-1

# Store UUID
execute store result score #lcg vplib.math run data get entity @e[type=area_effect_cloud,tag=vplib.uuid,limit=1] UUID[0]

# Kill AEC
kill @e[type=area_effect_cloud,tag=vplib.uuid,limit=1]
# Invert seed if negative
execute if score #lcg.seed vplib.math matches ..-1 run scoreboard players operation #lcg.seed vplib.math *= #-1 vplib.math

# Invert if negative
execute if score #lcg vplib.math matches ..-1 run scoreboard players operation #lcg vplib.math *= #-1 vplib.math
# Init lcg score
scoreboard players operation #lcg vplib.math = #lcg.seed vplib.math
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
scoreboard players set #load vplib.load 1

## Missing core
scoreboard players set #expected.vplib.core vplib.load 1
scoreboard players set #expected.vplib.core vplib.load 2

execute unless score #vplib.core.current vplib.load >= #expected.vplib.core vplib.load run scoreboard players set #load vplib.load -1
execute if score #vplib.core.breaking vplib.load > #expected.vplib.core vplib.load run scoreboard players set #load vplib.load -2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#> vplib:math/v1/load/enumerate
# DEBUG
tellraw @a[tag=vplib.debug+] [{"text":"[Debug]: ","color":"yellow","bold":true},{"text":"Enumerated Vanilla+ Library: Math __ver","color":"white","bold":false}]

# Set current version
execute unless score #vplib.math.current vplib.load matches 1.. run scoreboard players set #vplib.math.current vplib.load 1
Expand Down
2 changes: 2 additions & 0 deletions datapack/data/vplib/functions/math/v1/load/resolve.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#> vplib:math/v1/load/resolve
# DEBUG
execute unless score #vplib.math.current vplib.load matches 1 run tellraw @a[tag=vplib.debug+] [{"text":"[Debug]: ","color":"yellow","bold":true},{"text":"Failed to resolve Vanilla+ Library: Math __ver","color":"white","bold":false}]

# Load if lib version matches
execute if score #vplib.math.current vplib.load matches 1 run function vplib:math/v1/load/check
6 changes: 3 additions & 3 deletions datapack/data/vplib/functions/math/v1/power/solve.mcfunction
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#> vplib:math/v1/power/solve

# Set output
# Init output
scoreboard players set #output vplib.math 1

# Set loop
# Get loop length from exponent(always positive)
scoreboard players operation #loop vplib.temp = #exponent vplib.math
execute if score #loop vplib.temp matches ..-1 run scoreboard players operation #loop vplib.temp *= #-1 vplib.math

# Scale factor if exponent is negative
# Set default scale factor if exponent is negative
execute unless score #scale_factor vplib.math matches 1.. run scoreboard players set #scale_factor vplib.math 1000
execute if score #exponent vplib.math matches ..-1 run scoreboard players operation #output vplib.math *= #scale_factor vplib.math

Expand Down
6 changes: 4 additions & 2 deletions datapack/data/vplib/tags/functions/load/init.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"values": [
"#vplib:load/library",
"#vplib:load/dependents"
"vplib:load/init",
"#vplib:load/enumerate",
"#vplib:load/resolve",
"#vplib:load/post"
]
}
8 changes: 0 additions & 8 deletions datapack/data/vplib/tags/functions/load/library.json

This file was deleted.

17 changes: 17 additions & 0 deletions datapack/data/vplib/tags/functions/math/api/color/hsv_to_rgb.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
{
"description": [
" Converts HSV(Hue, Saturation, Value) to RGB(Red, Green, Blue) color format. ",
" ",
" INPUTS: ",
" #hsv.h vplib.math (0-100%/0-360º with scale factor = 100) ",
" #hsv.s vplib.math (0-100% percentage with scale factor = 100) ",
" #hsv.v vplib.math (0-100% percentage with scale factor = 100) ",
" #scale_factor vplib.math (Corresponds to the amount of decimals used in the inputs) ",
" #hsv.h_degrees vplib.math (0 = Hue is a 0-100 percentage, 1 = Hue is in 0-360 degrees) ",
" ",
" OUTPUTS: ",
" #rgb.r vplib.math ",
" #rgb.g vplib.math ",
" #rgb.b vplib.math ",
" #rgb.int vplib.math (Ready to store in leather armor) "
],

"values": [
"vplib:math/v1/api/color/hsv_to_rgb"
]
Expand Down
11 changes: 11 additions & 0 deletions datapack/data/vplib/tags/functions/math/api/lcg/ranged.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
{
"description": [
" Generate a random number within a range. ",
" ",
" INPUTS: ",
" #min vplib.math ",
" #max vplib.math ",
" ",
" OUTPUTS: ",
" #output vplib.math "
],

"values": [
"vplib:math/v1/api/lcg/ranged"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"description": [
" Reset LCG seed. "
],

"values": [
"vplib:math/v1/api/lcg/reset_seed"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"description": [
" Generate a random integer(-2146473648..2146473647) ",
" ",
" OUTPUTS: ",
" #output vplib.math "
],

"values": [
"vplib:math/v1/api/lcg/simplified"
]
Expand Down
Loading