diff --git a/data/minecraft/loot_table/blocks/crafter.json b/data/minecraft/loot_table/blocks/crafter.json new file mode 100644 index 0000000..a674f47 --- /dev/null +++ b/data/minecraft/loot_table/blocks/crafter.json @@ -0,0 +1,33 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:crafter", + "functions": [ + { + "function": "minecraft:copy_components", + "source": "block_entity", + "include": [ + "minecraft:item_model", + "minecraft:custom_name", + "minecraft:lock" + ], + "conditions": [] + } + ] + } + ], + "rolls": 1 + } + ], + "random_sequence": "minecraft:blocks/crafter" +} \ No newline at end of file diff --git a/data/minecraft/tags/function/tick.json b/data/minecraft/tags/function/tick.json index 68cace6..837c12a 100644 --- a/data/minecraft/tags/function/tick.json +++ b/data/minecraft/tags/function/tick.json @@ -1,5 +1,6 @@ { "values": [ - "turtlecraft:tick" + "turtlecraft:tick", + "turtlecraft:block/main" ] } \ No newline at end of file diff --git a/data/turtlecraft/advancement/block.json b/data/turtlecraft/advancement/block.json new file mode 100644 index 0000000..19ad23f --- /dev/null +++ b/data/turtlecraft/advancement/block.json @@ -0,0 +1,32 @@ +{ + "display": { + "icon": { + "id": "stone", + "count": 1 + }, + "title": "block", + "description": "block", + "show_toast": false, + "announce_to_chat": false, + "hidden": true + }, + "criteria": { + "main": { + "trigger": "minecraft:default_block_use", + "conditions": { + "location": [ + { + "condition": "minecraft:block_state_property", + "block": "crafter" + + } + ] + } + } + }, + "requirements": [["main"]], + "rewards": { + "function": "turtlecraft:block/interacted", + "loot": [] + } +} \ No newline at end of file diff --git a/data/turtlecraft/advancement/place.json b/data/turtlecraft/advancement/place.json new file mode 100644 index 0000000..886a1e0 --- /dev/null +++ b/data/turtlecraft/advancement/place.json @@ -0,0 +1,31 @@ +{ + "display": { + "icon": { + "id": "stone", + "count": 1 + }, + "title": "block", + "description": "block", + "show_toast": false, + "announce_to_chat": false, + "hidden": true + }, + "criteria": { + "main": { + "trigger": "minecraft:placed_block", + "conditions": { + "location": [ + { + "condition": "minecraft:block_state_property", + "block": "minecraft:crafter" + } + ] + } + } + }, + "requirements": [["main"]], + "rewards": { + "function": "turtlecraft:block/interacted", + "loot": [] + } + } \ No newline at end of file diff --git a/data/turtlecraft/function/block/concat.mcfunction b/data/turtlecraft/function/block/concat.mcfunction new file mode 100644 index 0000000..630371b --- /dev/null +++ b/data/turtlecraft/function/block/concat.mcfunction @@ -0,0 +1 @@ +$$(1)$(2)$(3)$(4)$(5) diff --git a/data/turtlecraft/function/block/edit/find.mcfunction b/data/turtlecraft/function/block/edit/find.mcfunction new file mode 100644 index 0000000..d0fab2a --- /dev/null +++ b/data/turtlecraft/function/block/edit/find.mcfunction @@ -0,0 +1,14 @@ +scoreboard players set temp turtlecraft.tmp 0 +execute at @s as @e[type=block_display,tag=turtlecraft.server,distance=..8] if score @s turtlecraft.s.id = @n[type=player] turtlecraft.s.id run scoreboard players set temp turtlecraft.tmp 1 +execute if score temp turtlecraft.tmp matches 0 run scoreboard players reset @s turtlecraft.s.id +execute if score temp turtlecraft.tmp matches 0 run return run tellraw @s ["",{"text":"\n> ","bold":true,"color":"red"},{"text":"Server not found!\n","color":"gray"}] +scoreboard players reset temp turtlecraft.tmp + +#101X - main menu trigers +execute if score @s TurtleCraft matches 1000 run tellraw @s ["",{"text":"\n> ","bold":true,"color":"red"},{"text":"Unknown trigger!\n","color":"gray"}] +execute if score @s TurtleCraft matches 1010 run function turtlecraft:block/message/main_menu +execute if score @s TurtleCraft matches 1011 run function turtlecraft:block/message/edit_prepare + +execute if score @s TurtleCraft matches 1019 at @s as @e[type=block_display,tag=turtlecraft.server,distance=..8] if score @s turtlecraft.s.id = @n[type=player] turtlecraft.s.id at @s as @n[type=player] positioned ~.1 ~.1 ~.1 align xyz run function turtlecraft:block/func/toggle_mode + +#102X - \ No newline at end of file diff --git a/data/turtlecraft/function/block/func/toggle_mode.mcfunction b/data/turtlecraft/function/block/func/toggle_mode.mcfunction new file mode 100644 index 0000000..a9f0a38 --- /dev/null +++ b/data/turtlecraft/function/block/func/toggle_mode.mcfunction @@ -0,0 +1,8 @@ +execute unless data block ~ ~ ~ lock.components.minecraft:custom_data."turtlecraft.block".Instructions[1] run return run tellraw @s ["",{"text":"\n> ","bold":true,"color":"red"},{"text":"Nothing to execute!\n","color":"gray"}] + +scoreboard players add @n[type=block_display] turtlecraft.s.mode 1 +execute as @n[type=block_display] if score @s turtlecraft.s.mode matches 2 run scoreboard players set @s turtlecraft.s.mode 0 + +execute align xyz run playsound minecraft:ui.button.click block @a[distance=..10] ~.5 ~.5 ~.5 .15 + +function turtlecraft:block/message/main_menu \ No newline at end of file diff --git a/data/turtlecraft/function/block/give.mcfunction b/data/turtlecraft/function/block/give.mcfunction new file mode 100644 index 0000000..513b7a7 --- /dev/null +++ b/data/turtlecraft/function/block/give.mcfunction @@ -0,0 +1 @@ +give @s minecraft:crafter[lock={components:{"minecraft:custom_data":{turtlecraft.block:{id:-1,Instructions:[{}]}}}},minecraft:block_entity_data={id:"minecraft:crafter",disabled_slots:[I;0,1,2,3,4,5,6,7,8]},minecraft:item_model="minecraft:command_block",minecraft:custom_name='{"text":"Server","color":"aqua","italic": false}'] diff --git a/data/turtlecraft/function/block/init.mcfunction b/data/turtlecraft/function/block/init.mcfunction new file mode 100644 index 0000000..5401966 --- /dev/null +++ b/data/turtlecraft/function/block/init.mcfunction @@ -0,0 +1,15 @@ +execute unless block ~ ~ ~ minecraft:crafter{lock:{components:{"minecraft:custom_data":{turtlecraft.block:{}}}}} run return 0 +execute align xyz unless entity @e[tag=turtlecraft.server,distance=..0.01] run return run function turtlecraft:block/summon + +stopsound @a block minecraft:block.chest.locked +execute align xyz run playsound minecraft:ui.button.click block @a[distance=..10] ~.5 ~.5 ~.5 .15 +title @s actionbar {"text":""} + +execute store result score $id turtlecraft.tmp run data get block ~ ~ ~ lock.components."minecraft:custom_data"."turtlecraft.block".id +execute if score $id turtlecraft.tmp matches -1 run scoreboard players add $global_id turtlecraft.server 1 +execute if score $id turtlecraft.tmp matches -1 store result block ~ ~ ~ lock.components."minecraft:custom_data"."turtlecraft.block".id int 1 run scoreboard players get $global_id turtlecraft.server +scoreboard players reset $id turtlecraft.tmp + +scoreboard players operation @s turtlecraft.s.id = @n[type=block_display,tag=turtlecraft.server] turtlecraft.s.id + +function turtlecraft:block/message/main_menu \ No newline at end of file diff --git a/data/turtlecraft/function/block/interacted.mcfunction b/data/turtlecraft/function/block/interacted.mcfunction new file mode 100644 index 0000000..925ccb3 --- /dev/null +++ b/data/turtlecraft/function/block/interacted.mcfunction @@ -0,0 +1,3 @@ +execute anchored eyes run function turtlecraft:block/raycast {c:"function turtlecraft:block/init"} +advancement revoke @s only turtlecraft:block +advancement revoke @s only turtlecraft:place diff --git a/data/turtlecraft/function/block/line.mcfunction b/data/turtlecraft/function/block/line.mcfunction new file mode 100644 index 0000000..67527be --- /dev/null +++ b/data/turtlecraft/function/block/line.mcfunction @@ -0,0 +1,25 @@ +# execute store result score line turtlecraft.tmp run data get block ~ ~ ~ lock.components.minecraft:custom_data."turtlecraft.block".line +scoreboard players add @s turtlecraft.s.line 1 + +data merge storage turtlecraft:tmp {temp:{1:"data modify storage turtlecraft:tmp temp.2 set from block ~ ~ ~ lock.components.minecraft:custom_data.\"turtlecraft.block\".Instructions[",2:"",3:"].text",4:"",5:""}} +execute store result storage turtlecraft:tmp temp.2 int 1 run scoreboard players get @s turtlecraft.s.line +function turtlecraft:block/concat with storage turtlecraft:tmp temp + +# tellraw @a {"nbt":"{}","storage":"turtlecraft:tmp","color": "green"} + +data merge storage turtlecraft:tmp {temp:{1:"function turtlecraft:commands/",3:"",4:"",5:""},execute:1b} +execute positioned ~.5 ~1 ~.5 as @n[type=text_display] positioned ~-.5 ~-1 ~-.5 run function turtlecraft:block/concat with storage turtlecraft:tmp temp + +data remove storage turtlecraft:tmp temp +data remove storage turtlecraft:tmp execute + +# tellraw @a {"score":{"name":"@s","objective":"turtlecraft.s.mode"}} + +execute store result score line turtlecraft.tmp run data get block ~ ~ ~ lock.components.minecraft:custom_data."turtlecraft.block".Instructions +execute if score @s turtlecraft.s.line >= line turtlecraft.tmp run scoreboard players set @s turtlecraft.s.mode 0 +# execute if score @s turtlecraft.s.line >= line turtlecraft.tmp run say hi +# execute if score @s turtlecraft.s.line >= line turtlecraft.tmp run tellraw @a {"text": "reset","color": "red"} +execute if score @s turtlecraft.s.line >= line turtlecraft.tmp run scoreboard players reset @s turtlecraft.s.line +execute positioned ~.5 ~1 ~.5 as @n[type=text_display] run data merge entity @s {text:'{"text":"Done!","color":"green"}'} + +scoreboard players reset line turtlecraft.tmp \ No newline at end of file diff --git a/data/turtlecraft/function/block/main.mcfunction b/data/turtlecraft/function/block/main.mcfunction new file mode 100644 index 0000000..4aa1ff8 --- /dev/null +++ b/data/turtlecraft/function/block/main.mcfunction @@ -0,0 +1,6 @@ +execute as @e[tag=turtlecraft.server,type=block_display] at @s positioned ~0.0005 ~0.0005 ~0.0005 align xyz unless block ~ ~ ~ crafter run kill @s +execute as @e[tag=turtlecraft.server,type=text_display] at @s positioned ~ ~-.5 ~ align xyz unless block ~ ~ ~ crafter run kill @s + +execute as @e[tag=turtlecraft.server,type=block_display] unless score @s turtlecraft.s.id matches 0.. at @s positioned ~0.0005 ~0.0005 ~0.0005 store result score @s turtlecraft.s.id run data get block ~ ~ ~ lock.components.minecraft:custom_data.'turtlecraft.block'.id + +execute as @e[tag=turtlecraft.server,type=block_display,scores={turtlecraft.s.mode=1}] if score @s turtlecraft.s.id matches 0.. at @s positioned ~0.1 ~0.1 ~0.1 align xyz run function turtlecraft:block/line diff --git a/data/turtlecraft/function/block/message/bar.mcfunction b/data/turtlecraft/function/block/message/bar.mcfunction new file mode 100644 index 0000000..1b77f58 --- /dev/null +++ b/data/turtlecraft/function/block/message/bar.mcfunction @@ -0,0 +1,2 @@ +tellraw @s[scores={turtlecraft.s.page=0}] ["\n\n",{"text":"HOME ","color":"dark_aqua"},{"text":" EDIT ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1011"},"hoverEvent":{"action":"show_text","contents":[{"text":"Edit Saved Instructions","color":"gray"}]}},{"text":" COUNTERS ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1012"},"hoverEvent":{"action":"show_text","contents":[{"text":"Show List of Counters","color":"gray"}]}},{"text":" OPTIONS ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1013"},"hoverEvent":{"action":"show_text","contents":[{"text":"Other Options","color":"gray"}]}},{"text":" MORE","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1014"},"hoverEvent":{"action":"show_text","contents":[{"text":"Credits and Tutorials","color":"gray"}]}}] +tellraw @s[scores={turtlecraft.s.page=1}] ["\n",{"text":"HOME ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1010"},"hoverEvent":{"action":"show_text","contents":[{"text":"Home page","color":"gray"}]}},{"text":" EDIT ","color":"dark_aqua"},{"text":" COUNTERS ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1012"},"hoverEvent":{"action":"show_text","contents":[{"text":"Show List of Counters","color":"gray"}]}},{"text":" OPTIONS ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1013"},"hoverEvent":{"action":"show_text","contents":[{"text":"Other Options","color":"gray"}]}},{"text":" MORE","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1014"},"hoverEvent":{"action":"show_text","contents":[{"text":"Credits and Tutorials","color":"gray"}]}}] diff --git a/data/turtlecraft/function/block/message/commands.mcfunction b/data/turtlecraft/function/block/message/commands.mcfunction new file mode 100644 index 0000000..b85effe --- /dev/null +++ b/data/turtlecraft/function/block/message/commands.mcfunction @@ -0,0 +1,15 @@ +execute store result score char turtlecraft.tmp run data get storage turtlecraft:tmp commands[0].id."text" +scoreboard players operation chars turtlecraft.tmp += char turtlecraft.tmp +scoreboard players reset char turtlecraft.tmp + +execute if score chars turtlecraft.tmp matches 40.. run data modify storage turtlecraft:tmp torender append value [] +execute if score chars turtlecraft.tmp matches 40.. run scoreboard players reset chars turtlecraft.tmp + +data modify storage turtlecraft:tmp torender[-1] append from storage turtlecraft:tmp commands[0].id +data remove storage turtlecraft:tmp commands[0] +data remove storage turtlecraft:tmp torender[-1][-1]."clickEvent" + +data modify storage turtlecraft:tmp torender[-1] append value {"text":" "} +scoreboard players add chars turtlecraft.tmp 2 + +execute if data storage turtlecraft:tmp commands[0] run function turtlecraft:block/message/commands \ No newline at end of file diff --git a/data/turtlecraft/function/block/message/commands_prepare.mcfunction b/data/turtlecraft/function/block/message/commands_prepare.mcfunction new file mode 100644 index 0000000..c9eaad7 --- /dev/null +++ b/data/turtlecraft/function/block/message/commands_prepare.mcfunction @@ -0,0 +1,24 @@ +data merge storage turtlecraft:tmp {commands:[],torender:[[]]} +function #turtlecraft:command + +# execute store result score commands turtlecraft.tmp run data get storage turtlecraft:tmp commands +function turtlecraft:block/message/commands +scoreboard players set symbols turtlecraft.tmp 34 +scoreboard players set lines turtlecraft.tmp 0 + +tellraw @s [" ",{"text":"1 < 1 > 1","color":"gray"}] + +tellraw @s [{"nbt":"torender[0]","storage":"turtlecraft:tmp","interpret":true}] +tellraw @s [{"nbt":"torender[1]","storage":"turtlecraft:tmp","interpret":true}] +tellraw @s [{"nbt":"torender[2]","storage":"turtlecraft:tmp","interpret":true}] +tellraw @s [{"nbt":"torender[3]","storage":"turtlecraft:tmp","interpret":true}] +# tellraw @s [{"nbt":"torender","storage":"turtlecraft:tmp","interpret":true}] + +# tellraw @s ["\n",{"nbt":"torender","storage":"turtlecraft:tmp","interpret":false}] +# tellraw @s ["\n",{"nbt":"toproces","storage":"turtlecraft:tmp","interpret":false}] + +scoreboard players reset symbols turtlecraft.tmp +scoreboard players reset chars turtlecraft.tmp +scoreboard players reset lines turtlecraft.tmp +data remove storage turtlecraft:tmp torender +data remove storage turtlecraft:tmp commands \ No newline at end of file diff --git a/data/turtlecraft/function/block/message/edit.mcfunction b/data/turtlecraft/function/block/message/edit.mcfunction new file mode 100644 index 0000000..c2f738e --- /dev/null +++ b/data/turtlecraft/function/block/message/edit.mcfunction @@ -0,0 +1,18 @@ +data modify storage turtlecraft:tmp temp set from block ~ ~ ~ lock.components.minecraft:custom_data."turtlecraft.block".Instructions + +scoreboard players set @s turtlecraft.s.page 1 + +tellraw @s [{"text":"\nYou should not click on any text above this!\n\n","color":"red"},{"text":" ","color":"dark_gray","strikethrough":true}] +tellraw @s {"text":"\n Edit Instructions ","color":"dark_aqua"} + +tellraw @s ["",{"text":" "},{"text":"1","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"First page","color":"gray"}]}},{"text":" < ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Previous page","color":"gray"}]}},{"score":{"name":"$current_page","objective":"turtlecraft.tmp"},"color":"gray"},{"text":" > ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Next page","color":"gray"}]}},{"score":{"name":"$last_page","objective":"turtlecraft.tmp"},"color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Last page","color":"gray"}]}}," ",{"text":" ✕ ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Remove line","color":"red"}]}},{"text":" ✂ ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Cut","color":"gray"}]}},{"text":" 🗍 ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Copy","color":"gray"}]}},{"text":" 🗐 ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Paste","color":"gray"}]}},{"text":" ↑ ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Switch up","color":"gray"}]}},{"text":" ↓ ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Switch down","color":"gray"}]}},{"text":" ❏ ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger TurtleCraft set -1000"},"hoverEvent":{"action":"show_text","contents":[{"text":"Toggle Numpad","color":"gray"}]}}] +tellraw @s "\n" + +scoreboard players set i turtlecraft.tmp 9 +function turtlecraft:block/message/lines + +function turtlecraft:block/message/commands_prepare + +scoreboard players reset chars turtlecraft.tmp +data remove storage turtlecraft:tmp temp +function turtlecraft:block/message/bar diff --git a/data/turtlecraft/function/block/message/edit_prepare.mcfunction b/data/turtlecraft/function/block/message/edit_prepare.mcfunction new file mode 100644 index 0000000..753770f --- /dev/null +++ b/data/turtlecraft/function/block/message/edit_prepare.mcfunction @@ -0,0 +1,6 @@ +scoreboard players set @s turtlecraft.s.line 1 + +execute at @s as @e[type=block_display,tag=turtlecraft.server,distance=..8] if score @s turtlecraft.s.id = @n[type=player] turtlecraft.s.id at @s as @n[type=player] positioned ~.1 ~.1 ~.1 align xyz run return run function turtlecraft:block/message/edit + +tellraw @s ["",{"text":"\n> ","bold":true,"color":"red"},{"text":"Server not found!\n","color":"gray"}] +scoreboard players reset @s turtlecraft.s.id \ No newline at end of file diff --git a/data/turtlecraft/function/block/message/lines.mcfunction b/data/turtlecraft/function/block/message/lines.mcfunction new file mode 100644 index 0000000..de27542 --- /dev/null +++ b/data/turtlecraft/function/block/message/lines.mcfunction @@ -0,0 +1,15 @@ +scoreboard players remove i turtlecraft.tmp 1 +scoreboard players add line turtlecraft.tmp 1 +execute if data storage turtlecraft:tmp temp[0] run data remove storage turtlecraft:tmp temp[0] + +execute unless data storage turtlecraft:tmp temp[0] run tellraw @s [{"score":{"name":"line","objective":"turtlecraft.tmp"},"color":"dark_gray"}," ",{"text": "| ","color": "dark_gray"}] +execute unless data storage turtlecraft:tmp temp[0] if score i turtlecraft.tmp matches 1.. run return run function turtlecraft:block/message/lines + +execute if data storage turtlecraft:tmp temp[0] unless score @s turtlecraft.s.line = line turtlecraft.tmp run tellraw @s [{"score":{"name":"line","objective":"turtlecraft.tmp"},"color":"gray"}," ",{"text": "| ","color": "dark_gray"},{"text":"","color": "white"},{"nbt":"temp[0]","storage":"turtlecraft:tmp","interpret":true}] +execute if score @s turtlecraft.s.line = line turtlecraft.tmp run tellraw @s [{"score":{"name":"line","objective":"turtlecraft.tmp"},"color":"green"}," ",{"text": "| ","color": "dark_green"},{"text":"","color": "white"},{"nbt":"temp[0]","storage":"turtlecraft:tmp","interpret":true}] + +# execute align xyz run tellraw @s {"nbt":"lock.components.minecraft:custom_data.'turtlecraft.block'","block":"~ ~ ~"} +execute if score i turtlecraft.tmp matches 1.. run return run function turtlecraft:block/message/lines + +scoreboard players reset i turtlecraft.tmp +scoreboard players reset line turtlecraft.tmp diff --git a/data/turtlecraft/function/block/message/main_menu.mcfunction b/data/turtlecraft/function/block/message/main_menu.mcfunction new file mode 100644 index 0000000..118b6a3 --- /dev/null +++ b/data/turtlecraft/function/block/message/main_menu.mcfunction @@ -0,0 +1,17 @@ +scoreboard players set @s turtlecraft.s.page 0 + +tellraw @s [{"text":"\nYou should not click on any text above this!\n\n","color":"red"},{"text":" ","color":"dark_gray","strikethrough":true}] +tellraw @s "\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + +tellraw @s [{"text":" Server","color":"dark_aqua"},{"text":" - ","color": "gray"},{"text":"Stoped","color":"red"}] +tellraw @s "\n" + +scoreboard players set mode turtlecraft.tmp 0 +execute at @s as @e[type=block_display,tag=turtlecraft.server,distance=..8] if score @s turtlecraft.s.id = @n[type=player] turtlecraft.s.id at @s as @n[type=block_display] positioned ~.1 ~.1 ~.1 align xyz run execute store result score mode turtlecraft.tmp run scoreboard players get @s turtlecraft.s.mode +execute at @s as @e[type=block_display,tag=turtlecraft.server,distance=..8] if score @s turtlecraft.s.id = @n[type=player] turtlecraft.s.id at @s positioned ~.5 ~1 ~.5 as @n[type=text_display] run data merge entity @s {text:'{"text":""}'} + +execute if score mode turtlecraft.tmp matches 0 run tellraw @s [" ",{"text":"START","color":"dark_green","clickEvent": {"action": "run_command","value": "/trigger TurtleCraft set -1019"},"hoverEvent":{"action":"show_text","contents":[{"text":"Click to start","color":"gray"}]}}] +execute if score mode turtlecraft.tmp matches 1 run tellraw @s [" ",{"text":"STOP","color":"red","clickEvent": {"action": "run_command","value": "/trigger TurtleCraft set -1019"},"hoverEvent":{"action":"show_text","contents":[{"text":"Click to stop","color":"gray"}]}}] + +scoreboard players reset mode turtlecraft.tmp +function turtlecraft:block/message/bar \ No newline at end of file diff --git a/data/turtlecraft/function/block/raycast.mcfunction b/data/turtlecraft/function/block/raycast.mcfunction new file mode 100644 index 0000000..c503abd --- /dev/null +++ b/data/turtlecraft/function/block/raycast.mcfunction @@ -0,0 +1,2 @@ +$execute positioned ^ ^ ^.002 if block ~ ~ ~ crafter run return run $(c) +$execute if entity @s[distance=..10] positioned ^ ^ ^.002 unless block ~ ~ ~ crafter run function turtlecraft:block/raycast {c:"$(c)"} diff --git a/data/turtlecraft/function/block/summon.mcfunction b/data/turtlecraft/function/block/summon.mcfunction new file mode 100644 index 0000000..df2e976 --- /dev/null +++ b/data/turtlecraft/function/block/summon.mcfunction @@ -0,0 +1,3 @@ +summon block_display ~-0.0005 ~-0.0005 ~-0.0005 {transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.001f,1.001f,1.001f]},block_state:{Name:"minecraft:command_block",Properties:{facing:"up"}},Tags:["turtlecraft.server"]} +summon minecraft:text_display ~.5 ~1.15 ~.5 {text:'{"text":""}',billboard:center,alignment:"center",Tags:["turtlecraft.server"],CustomName:'[{"text":"Server"}]'} +scoreboard players set @n[type=block_display] turtlecraft.s.mode 0 \ No newline at end of file diff --git a/data/turtlecraft/function/code/trigger/edit.mcfunction b/data/turtlecraft/function/code/trigger/edit.mcfunction index 5ca3928..7016691 100644 --- a/data/turtlecraft/function/code/trigger/edit.mcfunction +++ b/data/turtlecraft/function/code/trigger/edit.mcfunction @@ -2,5 +2,6 @@ scoreboard players operation @s TurtleCraft *= #_1 turtlecraft.math execute if score @s TurtleCraft matches 1..99 run tellraw @s ["",{"text":"\n> ","bold":true,"color":"red"},{"text":"You should use positive numbers here!\n","color":"gray"}] execute if score @s TurtleCraft matches 100..999 run function turtlecraft:code/edit/find_turtle -execute if score @s TurtleCraft matches 1000.. run tellraw @s ["",{"text":"\n> ","bold":true,"color":"red"},{"text":"You should use positive numbers here!\n","color":"gray"}] +execute if score @s TurtleCraft matches 1000..9999 run function turtlecraft:block/edit/find +execute if score @s TurtleCraft matches 10000.. run tellraw @s ["",{"text":"\n> ","bold":true,"color":"red"},{"text":"You should use positive numbers here!\n","color":"gray"}] scoreboard players set @s TurtleCraft 0 diff --git a/data/turtlecraft/function/commands/amogus.mcfunction b/data/turtlecraft/function/commands/amogus.mcfunction new file mode 100644 index 0000000..1e32cfc --- /dev/null +++ b/data/turtlecraft/function/commands/amogus.mcfunction @@ -0,0 +1,3 @@ +execute unless data storage turtlecraft:tmp {execute:1b} run return run data modify storage turtlecraft:tmp commands append value {id:{"text":"amogus","color":"red"},args:[]} + +say hi \ No newline at end of file diff --git a/data/turtlecraft/function/commands/meow.mcfunction b/data/turtlecraft/function/commands/meow.mcfunction new file mode 100644 index 0000000..ab2b8f2 --- /dev/null +++ b/data/turtlecraft/function/commands/meow.mcfunction @@ -0,0 +1,3 @@ +execute unless data storage turtlecraft:tmp {execute:1b} run return run data modify storage turtlecraft:tmp commands append value {id:{"text":"meow","color":"red"},args:[]} + +say hi \ No newline at end of file diff --git a/data/turtlecraft/function/commands/party.mcfunction b/data/turtlecraft/function/commands/party.mcfunction new file mode 100644 index 0000000..b989ab9 --- /dev/null +++ b/data/turtlecraft/function/commands/party.mcfunction @@ -0,0 +1,3 @@ +execute unless data storage turtlecraft:tmp {execute:1b} run return run data modify storage turtlecraft:tmp commands append value {id:{"text":"party","color":"yellow"},args:[]} + +say hi \ No newline at end of file diff --git a/data/turtlecraft/function/commands/say.mcfunction b/data/turtlecraft/function/commands/say.mcfunction new file mode 100644 index 0000000..27adc0d --- /dev/null +++ b/data/turtlecraft/function/commands/say.mcfunction @@ -0,0 +1,3 @@ +execute unless data storage turtlecraft:tmp {execute:1b} run return run data modify storage turtlecraft:tmp commands append value {id:{"text":"say","color":"yellow"},args:[]} + +say hi \ No newline at end of file diff --git a/data/turtlecraft/function/commands/scoreboard.mcfunction b/data/turtlecraft/function/commands/scoreboard.mcfunction new file mode 100644 index 0000000..808516e --- /dev/null +++ b/data/turtlecraft/function/commands/scoreboard.mcfunction @@ -0,0 +1,3 @@ +execute unless data storage turtlecraft:tmp {execute:1b} run return run data modify storage turtlecraft:tmp commands append value {id:{"text":"scoreboard","color":"yellow"},args:[]} + +say hi \ No newline at end of file diff --git a/data/turtlecraft/function/commands/tellraw.mcfunction b/data/turtlecraft/function/commands/tellraw.mcfunction new file mode 100644 index 0000000..79eba91 --- /dev/null +++ b/data/turtlecraft/function/commands/tellraw.mcfunction @@ -0,0 +1,3 @@ +execute unless data storage turtlecraft:tmp {execute:1b} run return run data modify storage turtlecraft:tmp commands append value {id:{"text":"tellraw","color":"yellow"},args:[]} + +say hi \ No newline at end of file diff --git a/data/turtlecraft/function/commands/tree.mcfunction b/data/turtlecraft/function/commands/tree.mcfunction new file mode 100644 index 0000000..ed1a0cf --- /dev/null +++ b/data/turtlecraft/function/commands/tree.mcfunction @@ -0,0 +1,3 @@ +execute unless data storage turtlecraft:tmp {execute:1b} run return run data modify storage turtlecraft:tmp commands append value {id:{"text":"tree","color":"yellow"},args:[]} + +say hi \ No newline at end of file diff --git a/data/turtlecraft/function/commands/variable.mcfunction b/data/turtlecraft/function/commands/variable.mcfunction new file mode 100644 index 0000000..38937c2 --- /dev/null +++ b/data/turtlecraft/function/commands/variable.mcfunction @@ -0,0 +1,3 @@ +execute unless data storage turtlecraft:tmp {execute:1b} run return run data modify storage turtlecraft:tmp commands append value {id:{"text":"variable","color":"yellow"},args:[]} + +say hi \ No newline at end of file diff --git a/data/turtlecraft/function/load.mcfunction b/data/turtlecraft/function/load.mcfunction index 6927d34..1a6aff3 100644 --- a/data/turtlecraft/function/load.mcfunction +++ b/data/turtlecraft/function/load.mcfunction @@ -11,6 +11,12 @@ function turtlecraft:forceload # Scores +scoreboard objectives add turtlecraft.server dummy +scoreboard objectives add turtlecraft.s.page dummy +scoreboard objectives add turtlecraft.s.mode dummy +scoreboard objectives add turtlecraft.s.line dummy +scoreboard objectives add turtlecraft.s.id dummy + scoreboard objectives add turtlecraft.id dummy scoreboard objectives add turtlecraft.update_id dummy scoreboard objectives add turtlecraft.line dummy diff --git a/data/turtlecraft/tags/function/command.json b/data/turtlecraft/tags/function/command.json new file mode 100644 index 0000000..dce7095 --- /dev/null +++ b/data/turtlecraft/tags/function/command.json @@ -0,0 +1,12 @@ +{ + "values": [ + "turtlecraft:commands/say", + "turtlecraft:commands/tree", + "turtlecraft:commands/tellraw", + "turtlecraft:commands/scoreboard", + "turtlecraft:commands/party", + "turtlecraft:commands/variable", + "turtlecraft:commands/amogus", + "turtlecraft:commands/meow" + ] +} \ No newline at end of file