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
33 changes: 33 additions & 0 deletions data/minecraft/loot_table/blocks/crafter.json
Original file line number Diff line number Diff line change
@@ -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"
}
3 changes: 2 additions & 1 deletion data/minecraft/tags/function/tick.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"turtlecraft:tick"
"turtlecraft:tick",
"turtlecraft:block/main"
]
}
32 changes: 32 additions & 0 deletions data/turtlecraft/advancement/block.json
Original file line number Diff line number Diff line change
@@ -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": []
}
}
31 changes: 31 additions & 0 deletions data/turtlecraft/advancement/place.json
Original file line number Diff line number Diff line change
@@ -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": []
}
}
1 change: 1 addition & 0 deletions data/turtlecraft/function/block/concat.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$$(1)$(2)$(3)$(4)$(5)
14 changes: 14 additions & 0 deletions data/turtlecraft/function/block/edit/find.mcfunction
Original file line number Diff line number Diff line change
@@ -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 -
8 changes: 8 additions & 0 deletions data/turtlecraft/function/block/func/toggle_mode.mcfunction
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions data/turtlecraft/function/block/give.mcfunction
Original file line number Diff line number Diff line change
@@ -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}']
15 changes: 15 additions & 0 deletions data/turtlecraft/function/block/init.mcfunction
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions data/turtlecraft/function/block/interacted.mcfunction
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions data/turtlecraft/function/block/line.mcfunction
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions data/turtlecraft/function/block/main.mcfunction
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions data/turtlecraft/function/block/message/bar.mcfunction
Original file line number Diff line number Diff line change
@@ -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"}]}}]
15 changes: 15 additions & 0 deletions data/turtlecraft/function/block/message/commands.mcfunction
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions data/turtlecraft/function/block/message/edit.mcfunction
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions data/turtlecraft/function/block/message/lines.mcfunction
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions data/turtlecraft/function/block/message/main_menu.mcfunction
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions data/turtlecraft/function/block/raycast.mcfunction
Original file line number Diff line number Diff line change
@@ -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)"}
3 changes: 3 additions & 0 deletions data/turtlecraft/function/block/summon.mcfunction
Original file line number Diff line number Diff line change
@@ -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
Loading