-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
By loading the pack as a data pack it is possible to access functions to convert a width to the magic digits needed. Big thanks to vdvman1 for helping with these!
- Loading branch information
Showing
23 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
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,6 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"spacefont:load" | ||
] | ||
} |
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,3 @@ | ||
# Create scoreboard and intiialize values: | ||
scoreboard objectives add spacefont dummy | ||
scoreboard players set #-1 spacefont -1 |
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,38 @@ | ||
# ----------------------- | ||
# Magic Digits Calculator | ||
# ----------------------- | ||
# | ||
# This function will convert a width in the range -6764 .. 6764 to a set of digits. | ||
# When displayed in the extended negative space font, these digits will form a space with the input width. | ||
# | ||
# Input score: width spacefont | ||
# Output score: spacer spacefont | ||
# | ||
# Example usage: | ||
# /scoreboard players set width spacefont -42 | ||
# /function spacefont:magic_digits | ||
# /tellraw @a ["Hello ", {"font": "space:default", "score": {"name": "spacer","objective": "spacefont"}}, " There"] | ||
# | ||
# Example result: "Hello -1123466899 There" but with the score turning into a space of width -42. | ||
# | ||
# Digit sizes (just for reference): | ||
# 9 = 1 | ||
# 8 = 3 | ||
# 7 = 8 | ||
# 6 = 21 | ||
# 5 = 55 | ||
# 4 = 144 | ||
# 3 = 377 | ||
# 2 = 987 | ||
# 1 = 2584 | ||
# - = -6765 | ||
# | ||
# What is this sequence? It is every other Fibonacci number. | ||
# If F(n) is the nth term, all terms before it add up to F(n+1). | ||
# With 9 digits and 10 places to put them we can duplicate one digit. | ||
# This extra capacity means we can skip every other term. | ||
# Does it produce the largest range? No, but it eases scoreboard calculations. | ||
|
||
execute if score width spacefont matches 6765.. run scoreboard players set spacer spacefont 1123456789 | ||
execute if score width spacefont matches ..-6765 run scoreboard players set spacer spacefont -9 | ||
execute if score width spacefont matches -6764..6764 run function spacefont:magic_digits/in_range |
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,3 @@ | ||
scoreboard players add spacer spacefont 1000000000 | ||
scoreboard players remove width spacefont 2584 | ||
execute if score width spacefont matches 2584.. run function spacefont:magic_digits/1_9 |
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,3 @@ | ||
scoreboard players add spacer spacefont 100000000 | ||
scoreboard players remove width spacefont 2584 | ||
execute if score width spacefont matches 987.. run function spacefont:magic_digits/2_8 |
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,3 @@ | ||
scoreboard players add spacer spacefont 20000000 | ||
scoreboard players remove width spacefont 987 | ||
execute if score width spacefont matches 377.. run function spacefont:magic_digits/3_7 |
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,3 @@ | ||
scoreboard players add spacer spacefont 200000000 | ||
scoreboard players remove width spacefont 987 | ||
execute if score width spacefont matches 987.. run function spacefont:magic_digits/2_8 |
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,3 @@ | ||
scoreboard players add spacer spacefont 3000000 | ||
scoreboard players remove width spacefont 377 | ||
execute if score width spacefont matches 144.. run function spacefont:magic_digits/4_6 |
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,3 @@ | ||
scoreboard players add spacer spacefont 30000000 | ||
scoreboard players remove width spacefont 377 | ||
execute if score width spacefont matches 377.. run function spacefont:magic_digits/3_7 |
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,3 @@ | ||
scoreboard players add spacer spacefont 400000 | ||
scoreboard players remove width spacefont 144 | ||
execute if score width spacefont matches 55.. run function spacefont:magic_digits/5_5 |
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,3 @@ | ||
scoreboard players add spacer spacefont 4000000 | ||
scoreboard players remove width spacefont 144 | ||
execute if score width spacefont matches 144.. run function spacefont:magic_digits/4_6 |
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,3 @@ | ||
scoreboard players add spacer spacefont 50000 | ||
scoreboard players remove width spacefont 55 | ||
execute if score width spacefont matches 21.. run function spacefont:magic_digits/6_4 |
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,3 @@ | ||
scoreboard players add spacer spacefont 500000 | ||
scoreboard players remove width spacefont 55 | ||
execute if score width spacefont matches 55.. run function spacefont:magic_digits/5_5 |
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,3 @@ | ||
scoreboard players add spacer spacefont 6000 | ||
scoreboard players remove width spacefont 21 | ||
execute if score width spacefont matches 8.. run function spacefont:magic_digits/7_3 |
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,3 @@ | ||
scoreboard players add spacer spacefont 60000 | ||
scoreboard players remove width spacefont 21 | ||
execute if score width spacefont matches 21.. run function spacefont:magic_digits/6_4 |
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,3 @@ | ||
scoreboard players add spacer spacefont 700 | ||
scoreboard players remove width spacefont 8 | ||
execute if score width spacefont matches 3.. run function spacefont:magic_digits/8_2 |
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,3 @@ | ||
scoreboard players add spacer spacefont 7000 | ||
scoreboard players remove width spacefont 8 | ||
execute if score width spacefont matches 8.. run function spacefont:magic_digits/7_3 |
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,3 @@ | ||
scoreboard players add spacer spacefont 80 | ||
scoreboard players remove width spacefont 3 | ||
execute if score width spacefont matches 1 run function spacefont:magic_digits/9_1 |
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,3 @@ | ||
scoreboard players add spacer spacefont 800 | ||
scoreboard players remove width spacefont 3 | ||
execute if score width spacefont matches 3.. run function spacefont:magic_digits/8_2 |
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,2 @@ | ||
scoreboard players add spacer spacefont 9 | ||
scoreboard players remove width spacefont 1 |
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,3 @@ | ||
scoreboard players add spacer spacefont 90 | ||
scoreboard players remove width spacefont 1 | ||
execute if score width spacefont matches 1 run function spacefont:magic_digits/9_1 |
1 change: 1 addition & 0 deletions
1
data/spacefont/functions/magic_digits/debug_list_scores.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 @@ | ||
tellraw @s [[{"text":"width: ","color":"gold"},{"score":{"name":"width","objective":"spacefont"}}], [{"text":"\nspacer: ","color":"dark_green"}, {"score":{"name":"spacer","objective":"spacefont"}}], [{"text":"\n#is_neg: ","color":"gray"}, {"score":{"name":"#is_neg","objective":"spacefont"}}], [{"text":"\n#-1: ","color":"gray"}, {"score":{"name":"#-1","objective":"spacefont"}}]] |
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,16 @@ | ||
scoreboard players set spacer spacefont 0 | ||
|
||
execute store result score #is_neg spacefont if score width spacefont matches ..-1 | ||
execute if score width spacefont matches ..-1 run scoreboard players add width spacefont 6765 | ||
|
||
execute if score width spacefont matches 2584..6764 run function spacefont:magic_digits/1_10 | ||
execute if score width spacefont matches 987..2583 run function spacefont:magic_digits/2_9 | ||
execute if score width spacefont matches 377..986 run function spacefont:magic_digits/3_8 | ||
execute if score width spacefont matches 144..376 run function spacefont:magic_digits/4_7 | ||
execute if score width spacefont matches 55..143 run function spacefont:magic_digits/5_6 | ||
execute if score width spacefont matches 21..54 run function spacefont:magic_digits/6_5 | ||
execute if score width spacefont matches 8..20 run function spacefont:magic_digits/7_4 | ||
execute if score width spacefont matches 3..7 run function spacefont:magic_digits/8_3 | ||
execute if score width spacefont matches 1..2 run function spacefont:magic_digits/9_2 | ||
|
||
execute if score #is_neg spacefont matches 1.. run scoreboard players operation spacer spacefont *= #-1 spacefont |