Skip to content

Commit

Permalink
feat: getting the current timestamp for time based events
Browse files Browse the repository at this point in the history
  • Loading branch information
edayot committed Nov 2, 2023
1 parent b4a689d commit da6f700
Show file tree
Hide file tree
Showing 19 changed files with 186 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ See the [documentation](https://edayot.github.io/SimpleDrawer/) for adding your



# Some sources :
# Some credits :
- StorageDrawer mod (idea and textures) : https://github.com/jaquadro/StorageDrawers

- Isometric rendering mod : https://github.com/glisco03/isometric-renders
Expand All @@ -47,3 +47,5 @@ See the [documentation](https://edayot.github.io/SimpleDrawer/) for adding your
- ItemIO : https://github.com/edayot/ItemIO

- Minecraft Title Generator (blockbench plugin) : https://ewanhowell.com/plugins/minecraft-title-generator/

- Minecraft base64 decoder : https://github.com/DorkOrc/Minecraft-Base64-Tool
6 changes: 5 additions & 1 deletion airdox_.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def cache_dependencies(ctx: Context):

list_dep=list()
for dep in ctx.meta["smithed_dependencies"]:
list_dep.append(f"{dep['id']}@{dep['version_']}")
if dep["versioning"]["type"]=="normal":
list_dep.append(f"{dep['id']}@{dep['version_']}")


for dep in list_dep:
Expand Down Expand Up @@ -158,6 +159,9 @@ def load_included(ctx: Context):
weld.toolchain.main.weld(ctx)

for dep in ctx.meta["smithed_dependencies"]:
if not dep["versioning"]["type"]=="normal":
continue

dep_author,dep_id=dep["id"].split(":")
identifier=f"{dep_id}@{dep['version_']}"
data=DataPack(zipfile=f"{ctx.cache.path}/airdox_/dep/{identifier}_datapack.zip")
Expand Down
11 changes: 8 additions & 3 deletions beet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ author: AirDox_
output: "build"

overrides:
- meta.smithed.versioning.scheduled_paths: [impl/tick,impl/5tick,impl/20tick,impl/mc_version_check]
- meta.smithed.versioning.scheduled_paths: [impl/tick,impl/5tick,impl/20tick,impl/mc_version_check,impl/timestamp]

data_pack:
load: [.]
Expand Down Expand Up @@ -47,8 +47,13 @@ meta:
prefix: "#smithed.actionbar"

- id: "airdox_:itemio"
version_: "0.9.0"
version_: "0.9.1"
versioning:
type: "normal"
prefix: "#itemio"


- id: "dorkorc:dork.base64"
version_: "0.0.0"
versioning:
type: "included"
prefix: "dork.base64"
8 changes: 8 additions & 0 deletions data/dork.base64/functions/api/decode.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# arguments: input

$data modify storage dork.base64:io decode.input set value "$(input)"
scoreboard players set .check_for_terminator dork.temp 0
function dork.base64:impl/decode/main

execute if score .success dork.temp matches 1 run return 1
return 0
5 changes: 5 additions & 0 deletions data/dork.base64/functions/api/decode/direct.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scoreboard players set .check_for_terminator dork.temp 0
execute if data storage dork.base64:io decode.input run function dork.base64:impl/decode/main

execute if score .success dork.temp matches 1 run return 1
return 0
8 changes: 8 additions & 0 deletions data/dork.base64/functions/api/decode/from.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# arguments: source

$data modify storage dork.base64:io decode.input set from $(source)
scoreboard players set .check_for_terminator dork.temp 0
function dork.base64:impl/decode/main

execute if score .success dork.temp matches 1 run return 1
return 0
21 changes: 21 additions & 0 deletions data/dork.base64/functions/api/decode/get.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# arguments: input

$data modify storage dork.base64:io decode.input set value "$(input)"
scoreboard players set .check_for_terminator dork.temp 0
function dork.base64:impl/decode/main

$execute if score .success dork.temp matches 1 run tellraw @s ["Decoded '",{"text":"$(input)","color":"aqua"},"' to '",{"storage":"dork.base64:io","nbt":"decode.output","color":"green"},"'"]
execute if score .success dork.temp matches 1 run return 1

execute store result score .start_index dork.temp store result score .end_index dork.temp run scoreboard players get .index dork.temp
execute store result storage dork.base64:temp args.decode.end_index int 1 run scoreboard players add .end_index dork.temp 1
scoreboard players remove .start_index dork.temp 10
execute if score .start_index dork.temp matches ..-1 run scoreboard players set .start_index dork.temp 0
execute store result storage dork.base64:temp args.decode.start_index int 1 run scoreboard players get .start_index dork.temp

$data modify storage dork.base64:io decode.input set value "$(input)"
function dork.base64:impl/decode/get_error_message with storage dork.base64:temp args.decode
execute if score .start_index dork.temp matches 0 run tellraw @s [{"text":"Invalid character at position ","color":"red"},{"score":{"name":".index","objective":"dork.temp"}},": ",{"storage":"dork.base64:temp","nbt":"section"},"<--[HERE]"]
execute if score .start_index dork.temp matches 1.. run tellraw @s [{"text":"Invalid character at position ","color":"red"},{"score":{"name":".index","objective":"dork.temp"}},": ...",{"storage":"dork.base64:temp","nbt":"section"},"<--[HERE]"]

return 0
9 changes: 9 additions & 0 deletions data/dork.base64/functions/api/decode/until.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# arguments: terminator, include_terminator (bool)

$scoreboard players set .include_terminator dork.temp $(include_terminator)
$data modify storage dork.base64:io decode.terminator set value "$(terminator)"
scoreboard players set .check_for_terminator dork.temp 1
execute if data storage dork.base64:io decode.input run function dork.base64:impl/decode/main

execute if score .success dork.temp matches 1 run return 1
return 0
8 changes: 8 additions & 0 deletions data/dork.base64/functions/impl/decode/concatenate.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$data modify storage dork.base64:temp args.decode.output set value "$(output)$(character)"

execute unless score .check_for_terminator dork.temp matches 1 run return 0
data modify storage dork.base64:temp end set value ""
$data modify storage dork.base64:temp end set string storage dork.base64:temp args.decode.output -$(terminator_length)
execute store success score .different dork.temp store success score .continue dork.temp run data modify storage dork.base64:temp end set from storage dork.base64:io decode.terminator
execute if score .different dork.temp matches 0 run scoreboard players set .index dork.temp -1
$execute if score .different dork.temp matches 0 if score .include_terminator dork.temp matches 0 run data modify storage dork.base64:temp args.decode.output set string storage dork.base64:temp args.decode.output 0 -$(terminator_length)
7 changes: 7 additions & 0 deletions data/dork.base64/functions/impl/decode/do_convert.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data modify storage dork.base64:temp args.decode.binary set string storage dork.base64:temp args.decode.binary 8
data modify storage dork.base64:temp args.decode.character set value ""
$data modify storage dork.base64:temp args.decode.character set from storage dork.base64:global binary_to_ascii."$(byte)"

data modify entity @s text set value '{"storage":"dork.base64:temp","nbt":"args.decode.output"}'
data modify storage dork.base64:temp args.decode.output set string entity @s text 9 -2
function dork.base64:impl/decode/concatenate with storage dork.base64:temp args.decode
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$data modify storage dork.base64:temp section set string storage dork.base64:io decode.input $(start_index) $(end_index)
2 changes: 2 additions & 0 deletions data/dork.base64/functions/impl/decode/init_entity.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kill @s
function dork.base64:impl/decode/loop with storage dork.base64:temp args.decode
12 changes: 12 additions & 0 deletions data/dork.base64/functions/impl/decode/loop.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$execute unless data storage dork.base64:global digit_to_binary."$(char)" run scoreboard players set .success dork.temp 0
execute if score .success dork.temp matches 0 run return 0

data modify storage dork.base64:temp args.decode.converted set value ""
$data modify storage dork.base64:temp args.decode.converted set from storage dork.base64:global digit_to_binary."$(char)"
function dork.base64:impl/decode/try_convert with storage dork.base64:temp args.decode

# repeat
data modify storage dork.base64:temp args.decode.char set string storage dork.base64:io decode.input 0 1
data modify storage dork.base64:io decode.input set string storage dork.base64:io decode.input 1
scoreboard players add .index dork.temp 1
execute if score .index dork.temp < .length dork.temp if score .continue dork.temp matches 1 run function dork.base64:impl/decode/loop with storage dork.base64:temp args.decode
15 changes: 15 additions & 0 deletions data/dork.base64/functions/impl/decode/main.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# (storage dork.base64:io decode.input)

scoreboard players set .success dork.temp 1
execute store result score .length dork.temp run data get storage dork.base64:io decode.input
scoreboard players set .index dork.temp 0
scoreboard players set .continue dork.temp 1

data modify storage dork.base64:temp args.decode set value {output:"",binary:"","converted":"",terminator_length:1}
execute if score .check_for_terminator dork.temp matches 1 store result storage dork.base64:temp args.decode.terminator_length int 1 run data get storage dork.base64:io decode.terminator
data modify storage dork.base64:temp args.decode.char set string storage dork.base64:io decode.input 0 1
data modify storage dork.base64:io decode.input set string storage dork.base64:io decode.input 1
execute if score .index dork.temp < .length dork.temp positioned ~ -2000 ~ summon text_display run function dork.base64:impl/decode/init_entity

execute if score .success dork.temp matches 1 run data modify storage dork.base64:io decode.output set from storage dork.base64:temp args.decode.output
execute if score .success dork.temp matches 0 run data remove storage dork.base64:io decode.output
4 changes: 4 additions & 0 deletions data/dork.base64/functions/impl/decode/try_convert.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$data modify storage dork.base64:temp args.decode.binary set value "$(binary)$(converted)"
data modify storage dork.base64:temp args.decode.byte set value ""
data modify storage dork.base64:temp args.decode.byte set string storage dork.base64:temp args.decode.binary 0 8
execute unless data storage dork.base64:temp args.decode{byte:""} run function dork.base64:impl/decode/do_convert with storage dork.base64:temp args.decode
4 changes: 4 additions & 0 deletions data/dork.base64/functions/load.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scoreboard objectives add dork.temp dummy

data modify storage dork.base64:global digit_to_binary set value {"A": "000000", "B": "000001", "C": "000010", "D": "000011", "E": "000100", "F": "000101", "G": "000110", "H": "000111", "I": "001000", "J": "001001", "K": "001010", "L": "001011", "M": "001100", "N": "001101", "O": "001110", "P": "001111", "Q": "010000", "R": "010001", "S": "010010", "T": "010011", "U": "010100", "V": "010101", "W": "010110", "X": "010111", "Y": "011000", "Z": "011001", "a": "011010", "b": "011011", "c": "011100", "d": "011101", "e": "011110", "f": "011111", "g": "100000", "h": "100001", "i": "100010", "j": "100011", "k": "100100", "l": "100101", "m": "100110", "n": "100111", "o": "101000", "p": "101001", "q": "101010", "r": "101011", "s": "101100", "t": "101101", "u": "101110", "v": "101111", "w": "110000", "x": "110001", "y": "110010", "z": "110011", "0": "110100", "1": "110101", "2": "110110", "3": "110111", "4": "111000", "5": "111001", "6": "111010", "7": "111011", "8": "111100", "9": "111101", "+": "111110", "/": "111111", "=": ""}
data modify storage dork.base64:global binary_to_ascii set value {"00100000": " ", "00100001": "!", "00100010": "\\\"", "00100011": "#", "00100100": "$", "00100101": "%", "00100110": "&", "00100111": "'", "00101000": "(", "00101001": ")", "00101010": "*", "00101011": "+", "00101100": ",", "00101101": "-", "00101110": ".", "00101111": "/", "00110000": "0", "00110001": "1", "00110010": "2", "00110011": "3", "00110100": "4", "00110101": "5", "00110110": "6", "00110111": "7", "00111000": "8", "00111001": "9", "00111010": ":", "00111011": ";", "00111100": "<", "00111101": "=", "00111110": ">", "00111111": "?", "01000000": "@", "01000001": "A", "01000010": "B", "01000011": "C", "01000100": "D", "01000101": "E", "01000110": "F", "01000111": "G", "01001000": "H", "01001001": "I", "01001010": "J", "01001011": "K", "01001100": "L", "01001101": "M", "01001110": "N", "01001111": "O", "01010000": "P", "01010001": "Q", "01010010": "R", "01010011": "S", "01010100": "T", "01010101": "U", "01010110": "V", "01010111": "W", "01011000": "X", "01011001": "Y", "01011010": "Z", "01011011": "[", "01011100": "\\\\", "01011101": "]", "01011110": "^", "01011111": "_", "01100000": "`", "01100001": "a", "01100010": "b", "01100011": "c", "01100100": "d", "01100101": "e", "01100110": "f", "01100111": "g", "01101000": "h", "01101001": "i", "01101010": "j", "01101011": "k", "01101100": "l", "01101101": "m", "01101110": "n", "01101111": "o", "01110000": "p", "01110001": "q", "01110010": "r", "01110011": "s", "01110100": "t", "01110101": "u", "01110110": "v", "01110111": "w", "01111000": "x", "01111001": "y", "01111010": "z", "01111011": "{", "01111100": "|", "01111101": "}", "01111110": "~"}
8 changes: 7 additions & 1 deletion data/simpledrawer/functions/impl/load.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,10 @@ schedule function simpledrawer:impl/tick 1t replace
schedule function simpledrawer:impl/5tick 5t replace
schedule function simpledrawer:impl/20tick 20t replace

function simpledrawer:impl/mc_version_warning
function simpledrawer:impl/mc_version_warning

setblock -29999990 33 1610 air
setblock -29999990 33 1610 player_head{SkullOwner:{Name:"jeb_"}}


function simpledrawer:impl/timestamp
39 changes: 39 additions & 0 deletions data/simpledrawer/functions/impl/timestamp.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@


function ./timestamp/scoreboard_process:
$data modify storage simpledrawer:timestamp timestamp set value $(timestamp)L
execute store result score #timestamp simpledrawer.math run data get storage simpledrawer:timestamp timestamp 0.001


function ./timestamp/process:
data modify storage simpledrawer:timestamp timestamp set from block -29999990 33 1610 SkullOwner.Properties.textures[0].Value
data modify storage simpledrawer:timestamp timestamp set string storage simpledrawer:timestamp timestamp 24 -1
data modify storage dork.base64:io decode.input set from storage simpledrawer:timestamp timestamp
function dork.base64:api/decode/until {terminator: ",", include_terminator: false}
data modify storage simpledrawer:timestamp timestamp set from storage dork.base64:io decode.output
function ./timestamp/scoreboard_process with storage simpledrawer:timestamp


schedule clear simpledrawer:impl/timestamp




scoreboard players set #success_ts simpledrawer.math 0

execute
as @p at @s
if data block -29999990 33 1610 SkullOwner.Properties.textures[0]
run scoreboard players set #success_ts simpledrawer.math 1


execute if score #success_ts simpledrawer.math matches 1 run function ./timestamp/process

execute if score #success_ts simpledrawer.math matches 0 run schedule function simpledrawer:impl/timestamp 5t replace



setblock -29999990 33 1610 air
setblock -29999990 33 1610 player_head{SkullOwner:{Name:"jeb_"}}

20 changes: 20 additions & 0 deletions data/simpledrawer/loot_tables/impl/player_head.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:player_head",
"functions": [
{
"function": "minecraft:fill_player_head",
"entity": "this"
}
]
}
]
}
]
}

0 comments on commit da6f700

Please sign in to comment.