1
0
Fork 0

Inital commit

This commit is contained in:
abtmtr 2025-08-27 20:49:18 -05:00
commit b5089257c5
1005 changed files with 23476 additions and 0 deletions

View file

@ -0,0 +1 @@
{"criteria":{"hurt":{"trigger":"minecraft:player_hurt_entity","conditions":{"entity":{"type":"minecraft:interaction","nbt":"{Tags:['graves.grave']}"}}}},"rewards":{"function":"graves:opening/attack_grave"}}

View file

@ -0,0 +1 @@
{"criteria":{"tick":{"trigger":"minecraft:tick"}},"rewards":{"function":"graves:creation/check_death_markers_later_in_tick"}}

View file

@ -0,0 +1 @@
{"criteria":{"hurt":{"trigger":"minecraft:entity_hurt_player","conditions":{"player":[{"condition":"minecraft:entity_scores","entity":"this","scores":{"graves.deaths":{"min":1}}}]}}},"rewards":{"function":"graves:creation/die"}}

View file

@ -0,0 +1 @@
{"criteria":{"hurt":{"trigger":"minecraft:player_interacted_with_entity","conditions":{"entity":{"type":"minecraft:interaction","nbt":"{Tags:['graves.grave']}"}}}},"rewards":{"function":"graves:opening/interact_with_grave"}}

View file

@ -0,0 +1,15 @@
tellraw @s {"text":" ","color":"dark_gray","strikethrough":true}
tellraw @s [" Graves",{"text":" / ","color":"gray"},"Global Settings "]
tellraw @s {"text":" ","color":"dark_gray","strikethrough":true}
execute if data storage graves:config {allow_robbing:1b} run tellraw @s [{"text":"[ \u2714 ]","color":"green","clickEvent":{"action":"run_command","value":"/function graves:disable_allow_robbing"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Click to disable ","color":"red"},"Grave Robbing",{"text":".","color":"red"},{"text":"\nWhen enabled, players can open graves they do not own.","color":"gray"},{"text":"\nDefault: Disabled","color":"dark_gray"}]}}," Grave Robbing"]
execute unless data storage graves:config {allow_robbing:1b} run tellraw @s ["",{"text":"[ \u274c ]","color":"red","clickEvent":{"action":"run_command","value":"/function graves:enable_allow_robbing"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Click to enable ","color":"green"},"Grave Robbing",{"text":".","color":"green"},{"text":"\nWhen enabled, players can open graves they do not own.","color":"gray"},{"text":"\nDefault: Disabled","color":"dark_gray"}]}}," Grave Robbing"]
execute if data storage graves:config {pick_up_xp:1b} run tellraw @s ["",{"text":"[ \u2714 ]","color":"green","clickEvent":{"action":"run_command","value":"/function graves:disable_pick_up_xp"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Click to disable ","color":"red"},"XP Collection",{"text":".","color":"red"},{"text":"\nWhen enabled, graves collect XP dropped on death.\nNote that players do not drop all their XP on death.","color":"gray"},{"text":"\nDefault: Enabled","color":"dark_gray"}]}}," XP Collection"]
execute unless data storage graves:config {pick_up_xp:1b} run tellraw @s ["",{"text":"[ \u274c ]","color":"red","clickEvent":{"action":"run_command","value":"/function graves:enable_pick_up_xp"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Click to enable ","color":"green"},"XP Collection",{"text":".","color":"green"},{"text":"\nWhen enabled, graves collect XP dropped on death.\nNote that players do not drop all their XP on death.","color":"gray"},{"text":"\nDefault: Enabled","color":"dark_gray"}]}}," XP Collection"]
execute if data storage graves:config {allow_locating:1b} run tellraw @s ["",{"text":"[ \u2714 ]","color":"green","clickEvent":{"action":"run_command","value":"/function graves:disable_allow_locating"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Click to disable ","color":"red"},"Grave Locating",{"text":".","color":"red"},{"text":"\nWhen enabled, players can see the coordinates of their graves.","color":"gray"},{"text":"\nDefault: Opposite of /gamerule reducedDebugInfo","color":"dark_gray"}]}}," Grave Locating"]
execute unless data storage graves:config {allow_locating:1b} run tellraw @s ["",{"text":"[ \u274c ]","color":"red","clickEvent":{"action":"run_command","value":"/function graves:enable_allow_locating"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Click to enable ","color":"green"},"Grave Locating",{"text":".","color":"green"},{"text":"\nWhen enabled, players can see the coordinates of their graves.","color":"gray"},{"text":"\nDefault: Opposite of /gamerule reducedDebugInfo","color":"dark_gray"}]}}," Grave Locating"]
execute if data storage graves:config {compatibility_mode:1b} run tellraw @s ["",{"text":"[ \u2714 ]","color":"green","clickEvent":{"action":"run_command","value":"/function graves:disable_compatibility_mode"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Click to disable ","color":"red"},"Compatibility Mode",{"text":".","color":"red"},{"text":"\nThis fixes graves not picking up items from certain modded slots, or not picking up certain modded items with special behavior on death. When enabled, graves pick up every item dropped in the exact same tick and position of death, even if the item wasn't detected in your inventory.","color":"gray"},{"text":"\nThis also means if multiple players die in the exact same tick and position, one grave picks up all the items.","color":"red"},{"text":"\nDefault: Disabled","color":"dark_gray"}]}}," Compatibility Mode"]
execute unless data storage graves:config {compatibility_mode:1b} run tellraw @s ["",{"text":"[ \u274c ]","color":"red","clickEvent":{"action":"run_command","value":"/function graves:enable_compatibility_mode"},"hoverEvent":{"action":"show_text","contents":["",{"text":"Click to enable ","color":"green"},"Compatibility Mode",{"text":".","color":"green"},{"text":"\nThis fixes graves not picking up items from certain modded slots, or not picking up certain modded items with special behavior on death. When enabled, graves pick up every item dropped in the exact same tick and position of death, even if the item wasn't detected in your inventory.","color":"gray"},{"text":"\nThis also means if multiple players die in the exact same tick and position, one grave picks up all the items.","color":"red"},{"text":"\nDefault: Disabled","color":"dark_gray"}]}}," Compatibility Mode"]
tellraw @s ["",{"text":"[ \u270e ]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set $despawn_seconds graves.config "},"hoverEvent":{"action":"show_text","contents":["",{"text":"Click to enter the number of seconds after which a grave and its contents are deleted.\nA grave's despawn timer only runs while the grave is loaded.\nEnter ","color":"gray"},"0",{"text":" to disable grave despawning.\nItems normally take ","color":"gray"},"300",{"text":" seconds (5 minutes) to despawn.","color":"gray"},{"text":"\nAccepts: whole numbers 0+\nDefault: 0","color":"dark_gray"}]}}," Grave Despawn Time ",{"text":"(Current: ","color":"gray"},{"score":{"name":"$despawn_seconds","objective":"graves.config"},"color":"gray"},{"text":")","color":"gray"}]
tellraw @s ["",{"text":"\n>> ","color":"gold"},{"text":"[ List All Graves ]","clickEvent":{"action":"run_command","value":"/function graves:list"},"hoverEvent":{"action":"show_text","contents":[{"text":"Click to run ","color":"gray"},{"text":"/function graves:list","color":"white"},"."]}}]
tellraw @s ["",{"text":">> ","color":"gold"},{"text":"[ Receive Grave Key ]","clickEvent":{"action":"run_command","value":"/function graves:give_grave_key"},"hoverEvent":{"action":"show_text","contents":{"text":"Click to receive a grave key which can be used to forcibly open graves.","color":"gray"}}}]
tellraw @s {"text":" ","color":"dark_gray","strikethrough":true}

View file

@ -0,0 +1,3 @@
data modify storage graves:main creation set from entity @s data.graves.creation
execute if function graves:creation/handle_death_as_death_marker run function graves:creation/unmark_death
data remove storage graves:main creation

View file

@ -0,0 +1,2 @@
execute as @e[type=minecraft:marker,tag=graves.death_marker] at @s run function graves:creation/check_death_marker
execute if score $death_marker_count graves.dummy matches 1.. run schedule function graves:creation/check_death_markers 1

View file

@ -0,0 +1,3 @@
execute unless score $death_marker_count graves.dummy matches 1.. run return 1
execute as @e[type=minecraft:marker,tag=graves.death_marker] at @s run function graves:creation/check_death_marker
execute if score $death_marker_count graves.dummy matches 1.. run advancement revoke @s only graves:check_death_markers_later_in_tick

View file

@ -0,0 +1,3 @@
execute store result storage graves:main creation.inventory_pos_ints.x int 1.0 run data get storage graves:main creation.grave.inventory_pos[0]
execute store result storage graves:main creation.inventory_pos_ints.y int 1.0 run data get storage graves:main creation.grave.inventory_pos[1]
execute store result storage graves:main creation.inventory_pos_ints.z int 1.0 run data get storage graves:main creation.grave.inventory_pos[2]

View file

@ -0,0 +1,14 @@
data modify storage graves:main creation.pre_death_inventory set from storage graves:main creation.grave_item.pre_death_inventory
function graves:creation/items/save_next_pre_death_item_slot with storage graves:main creation.pre_death_inventory[-1]
data modify storage graves:main creation merge value {items:[],grave:{slots:[]}}
data modify storage graves:main creation.inventory_pos_compound.x set from storage graves:main creation.grave.inventory_pos[0]
data modify storage graves:main creation.inventory_pos_compound.y set from storage graves:main creation.grave.inventory_pos[1]
data modify storage graves:main creation.inventory_pos_compound.z set from storage graves:main creation.grave.inventory_pos[2]
function graves:creation/items/pick_up_items_at_inventory_pos with storage graves:main creation.inventory_pos_compound
execute if data storage graves:main creation{found_drops_late:1b} run function graves:creation/items/check_for_missing_pre_death_items
scoreboard players reset $non_pre_death_item_count graves.dummy
execute if data storage graves:config {pick_up_xp:1b} run function graves:creation/xp/pick_up_xp
execute store result storage graves:main creation.grave.xp_points int 1.0 run scoreboard players get $xp_points graves.dummy
scoreboard players reset $xp_points graves.dummy
execute unless data storage graves:main creation.items[0] if data storage graves:main creation.grave{xp_points:0} run return run function graves:creation/remove_loading_grave_listing with storage graves:main creation.grave_item
execute summon minecraft:item_display run function graves:creation/initialize_grave

View file

@ -0,0 +1,2 @@
$execute unless data storage graves:main players[{uuid: $(owner_uuid)}] run data modify storage graves:main players append value { uuid: $(owner_uuid), name: '{"italic":true,"color":"gray","text":"(Name loading... Try again, or click to open NameMC profile.)","hoverEvent":{"action":"show_text","contents":["",{"color":"gray","text":"Click to open URL:\\n"},"https://namemc.com/$(owner_uuid_0),$(owner_uuid_1),$(owner_uuid_2),$(owner_uuid_3)"]},"clickEvent":{"action":"open_url","value":"https://namemc.com/$(owner_uuid_0),$(owner_uuid_1),$(owner_uuid_2),$(owner_uuid_3)"}}', graves: [], }
$data modify storage graves:main players[{uuid: $(owner_uuid)}].graves append from storage graves:main creation.grave_listing

View file

@ -0,0 +1,25 @@
advancement revoke @s only graves:die
scoreboard players reset @s graves.deaths
execute if entity @s[gamemode=spectator] run return 1
schedule function graves:creation/increment_tick_id 1
execute anchored eyes positioned ^ ^ ^ positioned ~ ~-0.3 ~ summon minecraft:marker run function graves:creation/save_inventory_pos
execute store result storage graves:main creation.grave.death_gametime int 1.0 run time query gametime
data modify storage graves:main creation.player set from entity @s
data modify storage graves:main creation.target_grave_item.owner_uuid set from storage graves:main creation.player.UUID
data modify storage graves:main creation.target_grave_item.tick_id set from storage graves:main tick_id
data modify storage graves:main creation.grave_listing set value {location_text:{color:"gold",text:"(Grave loading... Try again.)"},item_count:"?",xp_points:"?"}
data modify storage graves:main creation.grave_listing.death_gametime set from storage graves:main creation.grave.death_gametime
data modify storage graves:main creation.grave_listing.dimension set from storage graves:main creation.player.Dimension
data modify storage graves:main creation.grave_listing.pos set from storage graves:main creation.player.Pos
data modify storage graves:main creation.grave_listing.loading.tick_id set from storage graves:main tick_id
data modify storage graves:main creation.grave_listing.owner_uuid set from storage graves:main creation.player.UUID
data remove storage graves:main creation.player
data modify storage graves:main creation.macro_args.owner_uuid set from storage graves:main creation.target_grave_item.owner_uuid
data modify storage graves:main creation.macro_args.owner_uuid_0 set from storage graves:main creation.macro_args.owner_uuid[0]
data modify storage graves:main creation.macro_args.owner_uuid_1 set from storage graves:main creation.macro_args.owner_uuid[1]
data modify storage graves:main creation.macro_args.owner_uuid_2 set from storage graves:main creation.macro_args.owner_uuid[2]
data modify storage graves:main creation.macro_args.owner_uuid_3 set from storage graves:main creation.macro_args.owner_uuid[3]
function graves:creation/create_loading_grave_listing with storage graves:main creation.macro_args
data remove storage graves:main creation.macro_args
execute unless function graves:creation/handle_death_as_player summon minecraft:marker run function graves:creation/initialize_death_marker
data remove storage graves:main creation

View file

@ -0,0 +1,4 @@
data modify storage graves:main creation.grave_item set from entity @s Item.components."minecraft:custom_data".graves
execute store success storage graves:main creation.changed byte 1.0 run data modify storage graves:main creation.grave_item merge from storage graves:main creation.target_grave_item
execute if data storage graves:main creation{changed:0b} run return 1
data remove storage graves:main creation.grave_item

View file

@ -0,0 +1,5 @@
function graves:creation/remove_loading_grave_listing with storage graves:main creation.target_grave_item
execute unless data storage graves:main creation.grave.inventory_pos run return run tellraw @s [{"color":"red","text":"Your inventory dropped (if there was anything to drop) at an unknown location, and the Graves data pack couldn't find your death information.\n\nThis may be an incompatibility or bug. We can help solve this for you in our data pack help channel:\n"},{"underlined":true,"text":"https://vanillatweaks.net/discord","hoverEvent":{"action":"show_text","value":"Click to open URL."},"clickEvent":{"action":"open_url","value":"https://vanillatweaks.net/discord"}}]
execute if data storage graves:config {allow_locating:0b} run return run tellraw @s [{"color":"red","text":"Your inventory dropped (if there was anything to drop), but the Graves data pack couldn't find your death information.\n\nThis may be an incompatibility or bug. We can help solve this for you in our data pack help channel:\n"},{"underlined":true,"text":"https://vanillatweaks.net/discord","hoverEvent":{"action":"show_text","value":"Click to open URL."},"clickEvent":{"action":"open_url","value":"https://vanillatweaks.net/discord"}}]
function graves:creation/convert_inventory_pos_to_ints
return run tellraw @s [{"color":"red","text":"Your inventory dropped (if there was anything to drop) at ("},{"storage":"graves:main","nbt":"creation.inventory_pos_ints.x"},", ",{"storage":"graves:main","nbt":"creation.inventory_pos_ints.y"},", ",{"storage":"graves:main","nbt":"creation.inventory_pos_ints.z"},") in ",{"storage":"graves:main","nbt":"creation.grave_listing.dimension"},", but the Graves data pack couldn't find your death information.\n\nThis may be an incompatibility or bug. We can help solve this for you in our data pack help channel:\n",{"underlined":true,"text":"https://vanillatweaks.net/discord","hoverEvent":{"action":"show_text","value":"Click to open URL."},"clickEvent":{"action":"open_url","value":"https://vanillatweaks.net/discord"}}]

View file

@ -0,0 +1,5 @@
data modify entity @s interaction set value {player:[I;0,0,0,0],timestamp:0L}
data modify entity @s interaction.player set from storage graves:main creation.target_grave_item.owner_uuid
kill @s
execute on target run function graves:creation/fail_to_find_grave_item
return 1

View file

@ -0,0 +1 @@
execute as @e[type=minecraft:item,distance=..1] if items entity @s contents *[minecraft:custom_data~{graves:{grave:1b}}] if function graves:creation/does_grave_item_match run return run function graves:creation/handle_matching_grave_item

View file

@ -0,0 +1,2 @@
function graves:creation/create_grave_maybe
return 1

View file

@ -0,0 +1,2 @@
execute if function graves:creation/find_grave_item rotated as @s run return run function graves:creation/handle_death
execute if loaded ~ ~ ~ summon minecraft:interaction run return run function graves:creation/fail_to_find_grave_item_at_death_marker

View file

@ -0,0 +1,2 @@
execute if function graves:creation/find_grave_item run return run function graves:creation/handle_death
execute if loaded ~ ~ ~ run return run function graves:creation/fail_to_find_grave_item

View file

@ -0,0 +1,6 @@
data modify storage graves:main creation.grave_item_entity set from entity @s
data modify storage graves:main creation.grave_item set from storage graves:main creation.grave_item_entity.Item.components."minecraft:custom_data".graves
execute store result storage graves:main creation.found_drops_late byte 1.0 run data get storage graves:main creation.grave_item_entity.Age
data modify storage graves:main creation.owner_name set from storage graves:main creation.grave_item_entity.Item.components."minecraft:lore"[0]
kill @s
return 1

View file

@ -0,0 +1 @@
execute store result storage graves:main tick_id int 1.0 run scoreboard players add $tick_id graves.dummy 1

View file

@ -0,0 +1,7 @@
tp @s ~ ~ ~ ~ ~
data modify entity @s data.graves.creation set from storage graves:main creation
execute store success entity @s data.graves.forceload_success byte 1.0 run forceload add ~ ~
scoreboard players add $death_marker_count graves.dummy 1
function graves:creation/check_death_markers
tag @s add graves.death_marker
advancement revoke @a only graves:check_death_markers_later_in_tick

View file

@ -0,0 +1,29 @@
data merge entity @s {Tags:["graves.grave","graves.grave.initializing"],transformation:{translation:[0.0f,0.3125f,0.0f],scale:[0.625f,0.625f,0.625f],right_rotation:[0.0f,0.0f,0.0f,1.0f],left_rotation:[0.0f,0.0f,0.0f,1.0f]},item:{id:"minecraft:stone_brick_wall",components:{"minecraft:item_name":'"Grave Model"',"minecraft:rarity":"epic","minecraft:lore":['{"italic":false,"color":"gold","text":"If you see this item, the Graves data pack didn\'t work!"}','{"italic":false,"color":"gold","text":"Please let us know in our data pack help channel:"}','{"italic":false,"color":"yellow","text":"https://vanillatweaks.net/discord"}']}},item_display:"head",teleport_duration:1}
execute if data storage graves:main creation.items[0] run data modify entity @s item.components."minecraft:bundle_contents" set from storage graves:main creation.items
item modify entity @s contents [{"function":"minecraft:set_components","components":{"!minecraft:custom_name":{}}},{"function":"minecraft:copy_custom_data","source":{"type":"storage","source":"graves:main"},"ops":[{"op":"replace","source":"creation.grave","target":"graves"},{"op":"replace","source":"creation.grave_item.owner_uuid","target":"graves.owner_uuid"},{"op":"replace","source":"creation.grave_item.pre_death_inventory","target":"graves.pre_death_inventory"},{"op":"replace","source":"creation.found_drops_late","target":"graves.found_drops_late"}]}]
tp @s ~ ~ ~ ~90 0
function graves:face_cardinal_direction
summon minecraft:interaction ~ ~ ~ {Tags:["graves.grave","graves.non_grave_repelling","graves.grave.unmounted"],width:0.75f,height:0.75f,response:1b}
ride @e[type=minecraft:interaction,tag=graves.grave.unmounted,distance=..0.01,limit=1] mount @s
execute on passengers run tag @s remove graves.grave.unmounted
function graves:placement/start
execute at @s positioned ~ ~0.75 ~ run summon minecraft:text_display ~ ~ ~ {Tags:["graves.grave","graves.grave.initializing"],billboard:"center",view_range:0.0625f,text:'{"storage":"graves:main","nbt":"creation.owner_name","interpret":true}',alignment:"center"}
execute at @s positioned ~ ~0.75 ~ as @e[type=minecraft:text_display,tag=graves.grave.initializing,distance=..0.01,limit=1] run function graves:creation/initialize_grave_name_tag
item modify entity @s contents {function:"minecraft:copy_custom_data",source:{type:"storage",source:"graves:main"},ops:[{op:"replace",source:"creation.grave.name_tag_uuid",target:"graves.name_tag_uuid"}]}
data modify storage graves:main creation.grave_entity set from entity @s
data modify storage graves:main creation.grave_listing.uuid set from storage graves:main creation.grave_entity.UUID
data modify storage graves:main creation.grave_listing.pos set from storage graves:main creation.grave_entity.Pos
execute store result storage graves:main creation.grave_listing.item_count int 1.0 run data get storage graves:main creation.items
data modify storage graves:main creation.grave_listing.xp_points set from storage graves:main creation.grave.xp_points
data remove storage graves:main creation.grave_listing.loading
data modify storage graves:main creation.macro_args set from storage graves:main creation.target_grave_item
data modify storage graves:main creation.macro_args.dimension set from storage graves:main creation.grave_listing.dimension
data modify storage graves:main creation.macro_args.x set from storage graves:main creation.grave_listing.pos[0]
data modify storage graves:main creation.macro_args.y set from storage graves:main creation.grave_listing.pos[1]
data modify storage graves:main creation.macro_args.z set from storage graves:main creation.grave_listing.pos[2]
execute store result storage graves:main creation.macro_args.x_int int 1.0 run data get storage graves:main creation.grave_listing.pos[0]
execute store result storage graves:main creation.macro_args.y_int int 1.0 run data get storage graves:main creation.grave_listing.pos[1]
execute store result storage graves:main creation.macro_args.z_int int 1.0 run data get storage graves:main creation.grave_listing.pos[2]
function graves:creation/update_grave_listing with storage graves:main creation.macro_args
execute if data storage graves:config {allow_locating:1b} summon minecraft:interaction run function graves:creation/show_new_grave_location
tag @s remove graves.grave.initializing

View file

@ -0,0 +1,2 @@
data modify storage graves:main creation.grave.name_tag_uuid set from entity @s UUID
tag @s remove graves.grave.initializing

View file

@ -0,0 +1,6 @@
execute store result score $missing_pre_death_item_count graves.dummy run data get storage graves:main creation.grave_item.pre_death_inventory
execute store result score $saved_pre_death_item_count graves.dummy run data get storage graves:main creation.items
scoreboard players operation $saved_pre_death_item_count graves.dummy -= $non_pre_death_item_count graves.dummy
scoreboard players operation $missing_pre_death_item_count graves.dummy -= $saved_pre_death_item_count graves.dummy
execute if score $missing_pre_death_item_count graves.dummy matches 0 run return fail
execute summon minecraft:interaction run function graves:creation/items/warn_of_missing_pre_death_items

View file

@ -0,0 +1,6 @@
execute unless data storage graves:main creation.item.pre_death_item_matches[-1] run return fail
data modify storage graves:main creation.item.match_value set from storage graves:main creation.item.value
execute store success storage graves:main creation.changed byte 1.0 run data modify storage graves:main creation.item.match_value set from storage graves:main creation.item.pre_death_item_matches[-1].value
execute if data storage graves:main creation{changed:0b} run return run data modify storage graves:main creation.item.pre_death_index set from storage graves:main creation.item.pre_death_item_matches[-1].index
data remove storage graves:main creation.item.pre_death_item_matches[-1]
function graves:creation/items/check_next_pre_death_item_match

View file

@ -0,0 +1 @@
$data modify storage graves:main creation.item.pre_death_item_matches append from storage graves:main creation.pre_death_items[{value: $(value)}]

View file

@ -0,0 +1,2 @@
$data modify storage graves:main creation.item.slot set from storage graves:main creation.pre_death_items[$(pre_death_index)].slot
$data remove storage graves:main creation.pre_death_items[$(pre_death_index)]

View file

@ -0,0 +1,5 @@
execute if data storage graves:config {compatibility_mode:1b} unless data storage graves:main creation.item.slot run function graves:creation/items/prepare_to_pick_up_non_pre_death_item
execute unless data storage graves:main creation.item.slot run return fail
data modify storage graves:main creation.items append from storage graves:main creation.item.value
data modify storage graves:main creation.grave.slots append from storage graves:main creation.item.slot
kill @s

View file

@ -0,0 +1,6 @@
data modify storage graves:main creation.item.value set from entity @s Item
function graves:creation/items/find_pre_death_item_matches with storage graves:main creation.item
function graves:creation/items/check_next_pre_death_item_match
function graves:creation/items/get_pre_death_item_slot with storage graves:main creation.item
function graves:creation/items/pick_up_item
data remove storage graves:main creation.item

View file

@ -0,0 +1,2 @@
execute if data storage graves:main creation{found_drops_late:0b} run return run function graves:creation/items/pick_up_items_with_age_0
execute as @e[type=minecraft:item,distance=..1,sort=nearest,nbt={Age:1s,PickupDelay:39s}] run function graves:creation/items/pick_up_item_maybe

View file

@ -0,0 +1 @@
$execute positioned $(x) $(y) $(z) run function graves:creation/items/pick_up_items

View file

@ -0,0 +1 @@
execute as @e[type=minecraft:item,distance=..0.01,nbt={Age:0s,PickupDelay:40s}] run function graves:creation/items/pick_up_item_maybe

View file

@ -0,0 +1,2 @@
data modify storage graves:main creation.item.slot set value "unknown"
scoreboard players add $non_pre_death_item_count graves.dummy 1

View file

@ -0,0 +1,8 @@
execute store result storage graves:main creation.pre_death_item_index int 1.0 run data get storage graves:main creation.pre_death_items
data modify storage graves:main creation.pre_death_items append value {slot:"unknown"}
data modify storage graves:main creation.pre_death_items[-1].index set from storage graves:main creation.pre_death_item_index
data modify storage graves:main creation.pre_death_items[-1].value set from storage graves:main creation.pre_death_inventory[-1]
data remove storage graves:main creation.pre_death_inventory[-1]
$data modify storage graves:main creation.pre_death_items[-1].slot set from storage graves:const slots.$(Slot)
data remove storage graves:main creation.pre_death_items[-1].value.Slot
function graves:creation/items/save_next_pre_death_item_slot with storage graves:main creation.pre_death_inventory[-1]

View file

@ -0,0 +1,6 @@
data modify entity @s interaction set value {player:[I;0,0,0,0],timestamp:0L}
data modify entity @s interaction.player set from storage graves:main creation.target_grave_item.owner_uuid
kill @s
execute if data storage graves:config {allow_locating:0b} on target run return run tellraw @s [{"color":"red","text":"Your inventory dropped, but due to a rare Minecraft quirk, the Graves data pack detected it couldn't pick up at most "},{"score":{"name":"$missing_pre_death_item_count","objective":"graves.dummy"}}," of your items.\n\nIf your grave is missing items, it may be an incompatibility or bug, and we can help you in our data pack help channel:\n",{"underlined":true,"text":"https://vanillatweaks.net/discord","hoverEvent":{"action":"show_text","value":"Click to open URL."},"clickEvent":{"action":"open_url","value":"https://vanillatweaks.net/discord"}}]
function graves:creation/convert_inventory_pos_to_ints
execute on target run tellraw @s [{"color":"red","text":"Your inventory dropped at ("},{"storage":"graves:main","nbt":"creation.inventory_pos_ints.x"},", ",{"storage":"graves:main","nbt":"creation.inventory_pos_ints.y"},", ",{"storage":"graves:main","nbt":"creation.inventory_pos_ints.z"},") in ",{"storage":"graves:main","nbt":"creation.grave_listing.dimension"},", but due to a rare Minecraft quirk, the Graves data pack detected it may have missed at most ",{"score":{"name":"$missing_pre_death_item_count","objective":"graves.dummy"}}," of your item slots.\n\nIf your grave is missing items, it may be an incompatibility or bug, and we can help you in our data pack help channel:\n",{"underlined":true,"text":"https://vanillatweaks.net/discord","hoverEvent":{"action":"show_text","value":"Click to open URL."},"clickEvent":{"action":"open_url","value":"https://vanillatweaks.net/discord"}}]

View file

@ -0,0 +1,2 @@
$data remove storage graves:main players[{uuid: $(owner_uuid)}].graves[{loading: {tick_id: $(tick_id)}}]
data remove storage graves:main players[{graves:[]}]

View file

@ -0,0 +1,2 @@
data modify storage graves:main creation.grave.inventory_pos set from entity @s Pos
kill @s

View file

@ -0,0 +1,4 @@
data modify entity @s interaction set value {player:[I;0,0,0,0],timestamp:0L}
data modify entity @s interaction.player set from storage graves:main creation.grave_item.owner_uuid
kill @s
execute on target run tellraw @s [{"text":"Your last grave is at ","color":"gold"},{"storage":"graves:main","nbt":"creation.grave_listing.location_text","interpret":true},". Enter ",{"color":"yellow","text":"/trigger graves","hoverEvent":{"action":"show_text","contents":"Click to run command."},"clickEvent":{"action":"run_command","value":"/trigger graves"}}," to list all your graves."]

View file

@ -0,0 +1,3 @@
execute if data entity @s data.graves{forceload_success:1b} run forceload remove ~ ~
kill @s
scoreboard players remove $death_marker_count graves.dummy 1

View file

@ -0,0 +1,4 @@
$execute if data storage graves:const dimension_names."$(dimension)" run data modify storage graves:main creation.grave_listing.location_text set value '["",{"color":"yellow","text":"($(x_int), $(y_int), $(z_int))","hoverEvent":{"action":"show_text","contents":"Click to teleport."},"clickEvent":{"action":"suggest_command","value":"/execute in $(dimension) run tp @s $(x) $(y) $(z)"}},[{"color":"gold","text":" in "},{"storage":"graves:const","nbt":"dimension_names.\'$(dimension)\'"}]]'
$execute unless data storage graves:const dimension_names."$(dimension)" run data modify storage graves:main creation.grave_listing.location_text set value '["",{"color":"yellow","text":"($(x_int), $(y_int), $(z_int))","hoverEvent":{"action":"show_text","contents":"Click to teleport."},"clickEvent":{"action":"suggest_command","value":"/execute in $(dimension) run tp @s $(x) $(y) $(z)"}},{"color":"gold","text":" in $(dimension)"}]'
$data modify storage graves:main players[{uuid: $(owner_uuid)}].graves[{loading: {tick_id: $(tick_id)}}] set from storage graves:main creation.grave_listing
$data modify storage graves:main players[{uuid: $(owner_uuid)}].name set from storage graves:main creation.owner_name

View file

@ -0,0 +1,2 @@
execute if data storage graves:main creation{found_drops_late:0b} run return run function graves:creation/xp/pick_up_xp_orb_with_age_0
execute as @e[type=minecraft:experience_orb,distance=..1,nbt={Age:1s}] run function graves:creation/xp/pick_up_xp_orb

View file

@ -0,0 +1,3 @@
execute store result score $xp_orb_value graves.dummy run data get entity @s Value
scoreboard players operation $xp_points graves.dummy += $xp_orb_value graves.dummy
kill @s

View file

@ -0,0 +1 @@
execute as @e[type=minecraft:experience_orb,distance=..0.01,nbt={Age:0s}] run function graves:creation/xp/pick_up_xp_orb

View file

@ -0,0 +1,8 @@
playsound minecraft:block.stone.break block @a
particle minecraft:poof ~ ~0.3125 ~ 0 0 0 0.05 10
execute summon minecraft:snowball run function graves:opening/kill_name_tag
execute on vehicle run kill @s
kill @s
$data remove storage graves:main players[{uuid: $(owner_uuid)}].graves[{uuid: $(grave_uuid)}]
data remove storage graves:main players[{graves:[]}]
data remove storage graves:main destruction

View file

@ -0,0 +1,6 @@
scoreboard players add @s graves.age_seconds 1
execute if score @s graves.age_seconds <= $despawn_seconds graves.config run return 1
data modify storage graves:main destruction.grave_entity set from entity @s
data modify storage graves:main destruction merge from storage graves:main destruction.grave_entity.item.components."minecraft:custom_data".graves
data modify storage graves:main destruction.grave_uuid set from storage graves:main destruction.grave_entity.UUID
execute on passengers at @s run function graves:destruction/destroy_grave with storage graves:main destruction

View file

@ -0,0 +1,4 @@
data modify storage graves:config allow_locating set value false
scoreboard players reset * graves
schedule clear graves:location/schedule_2t
function graves:config

View file

@ -0,0 +1,2 @@
data modify storage graves:config allow_robbing set value false
function graves:config

View file

@ -0,0 +1,2 @@
data modify storage graves:config compatibility_mode set value false
function graves:config

View file

@ -0,0 +1,2 @@
data modify storage graves:config pick_up_xp set value false
function graves:config

View file

@ -0,0 +1,3 @@
data modify storage graves:config allow_locating set value true
schedule function graves:location/schedule_2t 1
function graves:config

View file

@ -0,0 +1,2 @@
data modify storage graves:config allow_robbing set value true
function graves:config

View file

@ -0,0 +1,2 @@
data modify storage graves:config compatibility_mode set value true
function graves:config

View file

@ -0,0 +1,2 @@
data modify storage graves:config pick_up_xp set value true
function graves:config

View file

@ -0,0 +1,4 @@
execute if entity @s[y_rotation=-45..45] run return run tp @s ~ ~ ~ 0 0
execute if entity @s[y_rotation=45..135] run return run tp @s ~ ~ ~ 90 0
execute if entity @s[y_rotation=135..225] run return run tp @s ~ ~ ~ 180 0
tp @s ~ ~ ~ 270 0

View file

@ -0,0 +1,18 @@
schedule clear graves:schedule_1s
schedule clear graves:location/schedule_2t
schedule clear graves:creation/check_death_markers
schedule clear graves:creation/increment_tick_id
schedule clear graves:opening/animate_graves_shaking
scoreboard objectives remove graves.dummy
scoreboard objectives remove graves.deaths
scoreboard objectives remove graves.shaking_ticks_left
scoreboard objectives remove graves.age_seconds
scoreboard objectives remove graves
data remove storage graves:const slots
data remove storage graves:const dimension_names
data remove storage graves:config allow_robbing
data remove storage graves:config pick_up_xp
data remove storage graves:config allow_locating
data remove storage graves:config compatibility_mode
data remove storage graves:main tick_id
data remove storage graves:main players

View file

@ -0,0 +1 @@
return run gamerule reducedDebugInfo

View file

@ -0,0 +1 @@
give @s minecraft:tripwire_hook[minecraft:custom_data={graves:{grave_key:1b}},minecraft:item_name='"Grave Key"',minecraft:rarity="epic",minecraft:lore=['{"italic":false,"color":"gold","text":"Use this to forcibly open anyone\'s grave."}'],minecraft:enchantment_glint_override=true]

View file

@ -0,0 +1,2 @@
scoreboard players set $page_number graves.dummy 1
function graves:location/list_graves/all

View file

@ -0,0 +1,2 @@
$scoreboard players set $page_number graves.dummy $(page)
function graves:location/list_graves/all

View file

@ -0,0 +1,20 @@
scoreboard objectives add graves.config dummy
scoreboard objectives add graves.dummy dummy
scoreboard objectives add graves.deaths minecraft.custom:minecraft.deaths
scoreboard objectives add graves.shaking_ticks_left dummy
scoreboard objectives add graves.age_seconds dummy
scoreboard objectives add graves trigger "List Graves"
scoreboard players reset * graves
data modify storage graves:const slots set value {-106:"weapon.offhand",0:"container.0",1:"container.1",2:"container.2",3:"container.3",4:"container.4",5:"container.5",6:"container.6",7:"container.7",8:"container.8",9:"container.9",10:"container.10",11:"container.11",12:"container.12",13:"container.13",14:"container.14",15:"container.15",16:"container.16",17:"container.17",18:"container.18",19:"container.19",20:"container.20",21:"container.21",22:"container.22",23:"container.23",24:"container.24",25:"container.25",26:"container.26",27:"container.27",28:"container.28",29:"container.29",30:"container.30",31:"container.31",32:"container.32",33:"container.33",34:"container.34",35:"container.35",100:"armor.feet",101:"armor.legs",102:"armor.chest",103:"armor.head"}
data modify storage graves:const dimension_names set value {"minecraft:overworld":"the Overworld","minecraft:the_nether":"the Nether","minecraft:the_end":"the End"}
scoreboard players set $TICKS_PER_HOUR graves.dummy 72000
execute unless data storage graves:config allow_robbing run data modify storage graves:config allow_robbing set value false
execute unless data storage graves:config pick_up_xp run data modify storage graves:config pick_up_xp set value true
execute unless data storage graves:config allow_locating run function graves:reset_allow_locating
execute unless data storage graves:config compatibility_mode run data modify storage graves:config compatibility_mode set value false
scoreboard players add $despawn_seconds graves.config 0
scoreboard players reset * graves.deaths
execute store result score $tick_id graves.dummy store result storage graves:main tick_id int 1.0 run data get storage graves:main tick_id
execute unless data storage graves:main players run data modify storage graves:main players set value []
schedule function graves:schedule_1s 10
function graves:update_allow_locating

View file

@ -0,0 +1,14 @@
execute unless score $page_number graves.dummy matches 1.. run return run tellraw @s {"color":"red","text":"Invalid page number."}
execute unless data storage graves:main players[0].graves[0] run return run tellraw @s {"color":"red","text":"This world doesn't have any graves."}
execute store result storage graves:main location.page_number int 1.0 run scoreboard players get $page_number graves.dummy
execute store result storage graves:main location.previous_page_number int 1.0 run scoreboard players remove $page_number graves.dummy 1
execute store result storage graves:main location.next_page_number int 1.0 run scoreboard players add $page_number graves.dummy 2
execute store result score $last_listing_number graves.dummy run data get storage graves:main location.previous_page_number 5
execute store result score $first_listing_number graves.dummy store result storage graves:main location.listing_number_0 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
execute store result storage graves:main location.listing_number_1 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
execute store result storage graves:main location.listing_number_2 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
execute store result storage graves:main location.listing_number_3 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
execute store result storage graves:main location.listing_number_4 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
data modify storage graves:main location.graves append from storage graves:main players[].graves[]
function graves:location/show_graves/all with storage graves:main location
data remove storage graves:main location

View file

@ -0,0 +1,12 @@
execute store result storage graves:main location.page_number int 1.0 run scoreboard players operation $page_number graves.dummy = @s graves
execute store result storage graves:main location.previous_page_number int 1.0 run scoreboard players remove $page_number graves.dummy 1
execute store result storage graves:main location.next_page_number int 1.0 run scoreboard players add $page_number graves.dummy 2
execute store result score $last_listing_number graves.dummy run data get storage graves:main location.previous_page_number 5
execute store result score $first_listing_number graves.dummy store result storage graves:main location.listing_number_0 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
execute store result storage graves:main location.listing_number_1 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
execute store result storage graves:main location.listing_number_2 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
execute store result storage graves:main location.listing_number_3 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
execute store result storage graves:main location.listing_number_4 int 1.0 run scoreboard players add $last_listing_number graves.dummy 1
data modify storage graves:main location.player_uuid set from entity @s UUID
function graves:location/show_graves/self with storage graves:main location
data remove storage graves:main location

View file

@ -0,0 +1,4 @@
schedule function graves:location/schedule_2t 2
execute as @a[scores={graves=1..}] run function graves:location/list_graves/self
scoreboard players set @a graves 0
scoreboard players enable @a graves

View file

@ -0,0 +1,9 @@
execute store result score $death_gametime graves.dummy run data get storage graves:main location.grave_listing.death_gametime
execute store result score $ticks_since_death graves.dummy run time query gametime
execute store result storage graves:main location.hours_ago int 0.00001388888888888889 run scoreboard players operation $ticks_since_death graves.dummy -= $death_gametime graves.dummy
execute store result storage graves:main location.minutes_ago int 0.0008333333333333334 run scoreboard players operation $ticks_since_death graves.dummy %= $TICKS_PER_HOUR graves.dummy
execute unless data storage graves:main location{hours_ago:0} run data modify storage graves:main location.time_since_death_texts append value '[{"storage":"graves:main","nbt":"location.hours_ago"},"h"]'
execute unless data storage graves:main location{minutes_ago:0} run data modify storage graves:main location.time_since_death_texts append value '[{"storage":"graves:main","nbt":"location.minutes_ago"},"m"]'
execute unless data storage graves:main location.time_since_death_texts run data modify storage graves:main location.time_since_death_texts set value ["0m"]
tellraw @s [{"storage":"graves:main","nbt":"location.grave_listing_indent"},{"storage":"graves:main","nbt":"location.grave_listing.location_text","interpret":true},[{"italic":true,"color":"gray","text":" - "},[{"storage":"graves:main","nbt":"location.time_since_death_texts[]","interpret":true,"hoverEvent":{"action":"show_text","contents":{"italic":true,"text":"(excluding when world isn't open)"}}}," ago"]," ",{"color":"dark_purple","text":"(more)","hoverEvent":{"action":"show_text","contents":["",{"text":"Item slots: ","color":"gray"},{"storage":"graves:main","nbt":"location.grave_listing.item_count"},{"text":"\nXP points: ","color":"gray"},{"storage":"graves:main","nbt":"location.grave_listing.xp_points"}]}}]]
data remove storage graves:main location.time_since_death_texts

View file

@ -0,0 +1 @@
$tellraw @s [ {"color": "gray", "text": ""}, { "storage": "graves:main", "nbt": "players[{uuid: $(owner_uuid)}].name", "interpret": true }, ":" ]

View file

@ -0,0 +1,3 @@
execute store success storage graves:main location.changed byte 1.0 run data modify storage graves:main location.owner_uuid set from storage graves:main location.grave_listing.owner_uuid
execute if data storage graves:main location{changed:0b} run return fail
function graves:location/show_grave_owner with storage graves:main location.grave_listing

View file

@ -0,0 +1,32 @@
execute store result score $max_listing_number graves.dummy run data get storage graves:main location.graves
execute if score $first_listing_number graves.dummy > $max_listing_number graves.dummy run return run tellraw @s [{"color":"red","text":"Page number "},{"storage":"graves:main","nbt":"location.page_number"}," is too large."]
scoreboard players operation $last_listing_number graves.dummy < $max_listing_number graves.dummy
data modify storage graves:main location.previous_link_text set value '[" ",{"text":" ","bold":true}]'
$execute unless data storage graves:main location{previous_page_number: 0} run data modify storage graves:main location.previous_link_text set value '{"color":"gold","text":" < Previous ","hoverEvent":{"action":"show_text","contents":[{"color":"gray","text":"Click to run "},{"color":"white","text":"/function graves:list_page {page: $(previous_page_number)}"},"."]},"clickEvent":{"action":"run_command","value":"/function graves:list_page {page: $(previous_page_number)}"}}'
$execute unless score $last_listing_number graves.dummy = $max_listing_number graves.dummy run data modify storage graves:main location.next_link_text set value '[[" ",{"text":" ","bold":true}],{"color":"gold","text":" Next > ","hoverEvent":{"action":"show_text","contents":[{"color":"gray","text":"Click to run "},{"color":"white","text":"/function graves:list_page {page: $(next_page_number)}"},"."]},"clickEvent":{"action":"run_command","value":"/function graves:list_page {page: $(next_page_number)}"}}]'
tellraw @s ["",{"color":"dark_gray","strikethrough":true,"text":" "},"\n",{"storage":"graves:main","nbt":"location.previous_link_text","interpret":true},[" ",{"text":" ","bold":true}],"All Graves",[{"color":"gray","text":" ("},{"score":{"name":"$first_listing_number","objective":"graves.dummy"}},"-",{"score":{"name":"$last_listing_number","objective":"graves.dummy"}}," of ",{"score":{"name":"$max_listing_number","objective":"graves.dummy"}},")"],{"storage":"graves:main","nbt":"location.next_link_text","interpret":true},"\n",{"color":"dark_gray","strikethrough":true,"text":" "}]
data modify storage graves:main location.grave_listing_indent set value " "
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_0)]
function graves:location/show_grave_owner_maybe
function graves:location/show_grave
data remove storage graves:main location.grave_listing
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_1)]
execute unless data storage graves:main location.grave_listing run return run tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}
function graves:location/show_grave_owner_maybe
function graves:location/show_grave
data remove storage graves:main location.grave_listing
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_2)]
execute unless data storage graves:main location.grave_listing run return run tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}
function graves:location/show_grave_owner_maybe
function graves:location/show_grave
data remove storage graves:main location.grave_listing
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_3)]
execute unless data storage graves:main location.grave_listing run return run tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}
function graves:location/show_grave_owner_maybe
function graves:location/show_grave
data remove storage graves:main location.grave_listing
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_4)]
execute unless data storage graves:main location.grave_listing run return run tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}
function graves:location/show_grave_owner_maybe
function graves:location/show_grave
tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}

View file

@ -0,0 +1,28 @@
$data modify storage graves:main location.graves set from storage graves:main players[{uuid: $(player_uuid)}].graves
execute store result score $max_listing_number graves.dummy run data get storage graves:main location.graves
execute if score $max_listing_number graves.dummy matches 0 run return run tellraw @s {"color":"red","text":"You don't have any graves."}
execute if score $first_listing_number graves.dummy > $max_listing_number graves.dummy run return run tellraw @s [{"color":"red","text":"Page number "},{"storage":"graves:main","nbt":"location.page_number"}," is too large."]
scoreboard players operation $last_listing_number graves.dummy < $max_listing_number graves.dummy
data modify storage graves:main location.previous_link_text set value '[" ",{"text":" ","bold":true}]'
$execute unless data storage graves:main location{previous_page_number: 0} run data modify storage graves:main location.previous_link_text set value '{"color":"gold","text":" < Previous ","hoverEvent":{"action":"show_text","contents":[{"color":"gray","text":"Click to run "},{"color":"white","text":"/trigger graves set $(previous_page_number)"},"."]},"clickEvent":{"action":"run_command","value":"/trigger graves set $(previous_page_number)"}}'
$execute unless score $last_listing_number graves.dummy = $max_listing_number graves.dummy run data modify storage graves:main location.next_link_text set value '[" ",{"color":"gold","text":" Next > ","hoverEvent":{"action":"show_text","contents":[{"color":"gray","text":"Click to run "},{"color":"white","text":"/trigger graves set $(next_page_number)"},"."]},"clickEvent":{"action":"run_command","value":"/trigger graves set $(next_page_number)"}}]'
tellraw @s ["",{"color":"dark_gray","strikethrough":true,"text":" "},"\n",{"storage":"graves:main","nbt":"location.previous_link_text","interpret":true}," ","Your Graves",[{"color":"gray","text":" ("},{"score":{"name":"$first_listing_number","objective":"graves.dummy"}},"-",{"score":{"name":"$last_listing_number","objective":"graves.dummy"}}," of ",{"score":{"name":"$max_listing_number","objective":"graves.dummy"}},")"],{"storage":"graves:main","nbt":"location.next_link_text","interpret":true},"\n",{"color":"dark_gray","strikethrough":true,"text":" "}]
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_0)]
function graves:location/show_grave
data remove storage graves:main location.grave_listing
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_1)]
execute unless data storage graves:main location.grave_listing run return run tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}
function graves:location/show_grave
data remove storage graves:main location.grave_listing
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_2)]
execute unless data storage graves:main location.grave_listing run return run tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}
function graves:location/show_grave
data remove storage graves:main location.grave_listing
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_3)]
execute unless data storage graves:main location.grave_listing run return run tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}
function graves:location/show_grave
data remove storage graves:main location.grave_listing
$data modify storage graves:main location.grave_listing set from storage graves:main location.graves[-$(listing_number_4)]
execute unless data storage graves:main location.grave_listing run return run tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}
function graves:location/show_grave
tellraw @s {"color":"dark_gray","strikethrough":true,"text":" "}

View file

@ -0,0 +1,5 @@
execute if items entity @s weapon.mainhand *[minecraft:custom_data~{graves:{grave_key:1b}}] run return run function graves:opening/use_grave_key_in_weapon.mainhand
execute if items entity @s weapon.offhand *[minecraft:custom_data~{graves:{grave_key:1b}}] run return run function graves:opening/use_grave_key_in_weapon.offhand
data modify storage graves:main opening.owner_uuid_copy set from storage graves:main opening.owner_uuid
execute store success storage graves:main opening.changed byte 1.0 run data modify storage graves:main opening.owner_uuid_copy set from entity @s UUID
execute if data storage graves:main opening{changed:0b} run return 1

View file

@ -0,0 +1,3 @@
execute as @e[type=minecraft:item_display,tag=graves.grave.shaking] at @s run function graves:opening/animate_shaking
scoreboard players remove $max graves.shaking_ticks_left 1
execute if score $max graves.shaking_ticks_left matches 1.. run schedule function graves:opening/animate_graves_shaking 1

View file

@ -0,0 +1,7 @@
scoreboard players remove @s graves.shaking_ticks_left 1
execute if score @s graves.shaking_ticks_left matches 4 run return run tp @s ~ ~ ~ ~4 ~
execute if score @s graves.shaking_ticks_left matches 3 run return run tp @s ~ ~ ~ ~-8 ~
execute if score @s graves.shaking_ticks_left matches 2 run return run tp @s ~ ~ ~ ~8 ~
execute if score @s graves.shaking_ticks_left matches 1 run return run tp @s ~ ~ ~ ~-8 ~
tp @s ~ ~ ~ ~4 ~
tag @s remove graves.grave.shaking

View file

@ -0,0 +1,4 @@
advancement revoke @s only graves:attack_grave
tag @s add graves.opener
function graves:opening/find_attacked_grave
tag @s remove graves.opener

View file

@ -0,0 +1 @@
return run execute on attacker if entity @s[tag=graves.opener]

View file

@ -0,0 +1 @@
return run execute on target if entity @s[tag=graves.opener]

View file

@ -0,0 +1,3 @@
tellraw @s {"text":"Grave robbing is disabled.","color":"red"}
data remove storage graves:main opening
return fail

View file

@ -0,0 +1 @@
execute as @e[type=minecraft:interaction,tag=graves.grave,sort=nearest,distance=0..] if function graves:opening/did_player_attack_grave on vehicle at @s run return run function graves:opening/handle_attacked_grave

View file

@ -0,0 +1,9 @@
execute on passengers on attacker run title @s actionbar [{"color":"green","text":"Tip: Use "},{"keybind":"key.use"}," to load a grave's contents directly into your inventory."]
execute if entity @s[tag=graves.grave.shaking] on passengers if function graves:opening/open_grave run return 1
function graves:face_cardinal_direction
tag @s add graves.grave.shaking
scoreboard players set @s graves.shaking_ticks_left 5
scoreboard players set $max graves.shaking_ticks_left 5
playsound minecraft:block.stone.hit block @a
execute on passengers run data remove entity @s attack
schedule function graves:opening/animate_graves_shaking 1

View file

@ -0,0 +1,4 @@
advancement revoke @s only graves:interact_with_grave
tag @s add graves.opener
execute as @e[type=minecraft:interaction,tag=graves.grave,sort=nearest,distance=0..] if function graves:opening/did_player_interact_with_grave unless function graves:opening/open_grave_for_target run data remove entity @s interaction
tag @s remove graves.opener

View file

@ -0,0 +1,6 @@
data modify storage graves:main opening.extra_items.pools append value {rolls:1,entries:[{type:"minecraft:item",functions:[{function:"minecraft:set_count"},{function:"minecraft:set_components",components:{}},{function:"minecraft:set_custom_data",tag:{graves:{extra_item:1b}}}]}]}
data modify storage graves:main opening.extra_items.pools[-1].entries[0].name set from storage graves:main opening.extra_item.id
data modify storage graves:main opening.extra_items.pools[-1].entries[0].functions[{function:"minecraft:set_count"}].count set from storage graves:main opening.extra_item.count
data modify storage graves:main opening.extra_items.pools[-1].entries[0].functions[{function:"minecraft:set_components"}].components set from storage graves:main opening.extra_item.components
data modify storage graves:main opening.extra_items.pools[-1].entries[0].functions[{function:"minecraft:set_custom_data"}].tag.graves.initial_custom_data set from storage graves:main opening.extra_item.components."minecraft:custom_data"
data remove storage graves:main opening.extra_item

View file

@ -0,0 +1,5 @@
execute store result score $missing_pre_death_item_count graves.dummy run data get storage graves:main opening.pre_death_inventory
execute store result score $grave_item_count graves.dummy run data get storage graves:main opening.items
scoreboard players operation $missing_pre_death_item_count graves.dummy -= $grave_item_count graves.dummy
execute if score $missing_pre_death_item_count graves.dummy matches 0 run return fail
tellraw @s [{"color":"red","text":"Due to a rare Minecraft quirk, the Graves data pack detected the grave you opened couldn't pick up at most "},{"score":{"name":"$missing_pre_death_item_count","objective":"graves.dummy"}}," of the item slots originally dropped on death.\n\nIf this grave was missing items, it may be an incompatibility or bug, and we can help you in our data pack help channel:\n",{"underlined":true,"text":"https://vanillatweaks.net/discord","hoverEvent":{"action":"show_text","value":"Click to open URL."},"clickEvent":{"action":"open_url","value":"https://vanillatweaks.net/discord"}}]

View file

@ -0,0 +1 @@
$loot spawn ~ ~ ~ loot { "pools": [ { "rolls": 1, "entries": [ { "type": "minecraft:item", "name": "$(id)", "functions": [ {"function": "minecraft:set_count", "count": $(count)}, { "function": "minecraft:set_components", "components": $(components) } ] } ] } ] }

View file

@ -0,0 +1,2 @@
data remove storage graves:main opening.replaced_item
return fail

View file

@ -0,0 +1,6 @@
data merge entity @s {PickupDelay:0s,Motion:[0.0f,0.0f,0.0f]}
data modify entity @s Owner set from storage graves:main opening.player_uuid
data modify storage graves:main opening.initial_custom_data set from entity @s Item.components."minecraft:custom_data".graves.initial_custom_data
item modify entity @s contents {function:"minecraft:set_components",components:{"!minecraft:custom_data":{}}}
data modify entity @s Item.components."minecraft:custom_data" set from storage graves:main opening.initial_custom_data
data remove storage graves:main opening.initial_custom_data

View file

@ -0,0 +1,3 @@
$loot spawn ~ ~ ~ loot {"pools": $(pools)}
execute on target run data modify storage graves:main opening.player_uuid set from entity @s UUID
execute as @e[type=minecraft:item,distance=..0.01] if items entity @s contents *[minecraft:custom_data~{graves:{extra_item:1b}}] run function graves:opening/items/fix_extra_item

View file

@ -0,0 +1,6 @@
execute unless data storage graves:main opening.items[-1] run return fail
data modify storage graves:main opening.item set from storage graves:main opening.items[-1]
data remove storage graves:main opening.items[-1]
data modify storage graves:main opening.item.components merge value {}
function graves:opening/items/drop_item with storage graves:main opening.item
function graves:opening/items/loot_next_item

View file

@ -0,0 +1,8 @@
execute unless data storage graves:main opening.items[-1] run return fail
data modify storage graves:main opening.item set from storage graves:main opening.items[-1]
data remove storage graves:main opening.items[-1]
data modify storage graves:main opening.item.components merge value {}
data modify storage graves:main opening.item.slot set from storage graves:main opening.slots[-1]
data remove storage graves:main opening.slots[-1]
execute unless function graves:opening/items/replace_item run function graves:opening/items/save_as_extra_item
function graves:opening/items/loot_next_item_for_target

View file

@ -0,0 +1,2 @@
execute if data storage graves:main opening.item{slot:"unknown"} run return fail
return run function graves:opening/items/replace_item_in_known_slot with storage graves:main opening.item

View file

@ -0,0 +1,9 @@
$execute on vehicle run item replace entity @s contents from entity @a[tag=graves.opener,distance=..0.01,limit=1] $(slot)
execute on vehicle run data modify storage graves:main opening.replaced_item set from entity @s item
data modify storage graves:main opening.item.slot_prefix set string storage graves:main opening.item.slot 0 6
execute if data storage graves:main opening.item{slot_prefix:"armor."} if data storage graves:main opening.replaced_item.components."minecraft:enchantments".levels."minecraft:binding_curse" run return run function graves:opening/items/fail_to_replace_binding_curse
$execute on target run loot replace entity @s $(slot) loot { "pools": [ { "rolls": 1, "entries": [ { "type": "minecraft:item", "name": "$(id)", "functions": [ { "function": "minecraft:set_count", "count": $(count) }, { "function": "minecraft:set_components", "components": $(components) } ] } ] } ] }
data modify storage graves:main opening.extra_item set from storage graves:main opening.replaced_item
data remove storage graves:main opening.replaced_item
execute if data storage graves:main opening.extra_item run function graves:opening/items/append_extra_item_entry
return 1

View file

@ -0,0 +1,2 @@
data modify storage graves:main opening.extra_item set from storage graves:main opening.item
function graves:opening/items/append_extra_item_entry

View file

@ -0,0 +1,3 @@
data modify entity @s Owner set from storage graves:main destruction.name_tag_uuid
kill @s
execute on origin run kill @s

View file

@ -0,0 +1,13 @@
execute on vehicle run data modify storage graves:main opening.grave_entity set from entity @s
data modify storage graves:main opening merge from storage graves:main opening.grave_entity.item.components."minecraft:custom_data".graves
execute if data storage graves:config {allow_robbing:0b} on attacker unless function graves:opening/access_grave run return run function graves:opening/fail_grave_robbery
data modify storage graves:main opening.items set from storage graves:main opening.grave_entity.item.components."minecraft:bundle_contents"
execute if data storage graves:main opening{found_drops_late:1b} on attacker run function graves:opening/items/check_for_missing_pre_death_items
function graves:opening/items/loot_next_item
function graves:opening/xp/loot_xp
data modify storage graves:main destruction.owner_uuid set from storage graves:main opening.owner_uuid
data modify storage graves:main destruction.grave_uuid set from storage graves:main opening.grave_entity.UUID
data modify storage graves:main destruction.name_tag_uuid set from storage graves:main opening.name_tag_uuid
function graves:destruction/destroy_grave with storage graves:main destruction
data remove storage graves:main opening
return 1

View file

@ -0,0 +1,15 @@
execute on vehicle run data modify storage graves:main opening.grave_entity set from entity @s
data modify storage graves:main opening merge from storage graves:main opening.grave_entity.item.components."minecraft:custom_data".graves
execute if data storage graves:config {allow_robbing:0b} at @s on target unless function graves:opening/access_grave run return run function graves:opening/fail_grave_robbery
data modify storage graves:main opening.items set from storage graves:main opening.grave_entity.item.components."minecraft:bundle_contents"
execute if data storage graves:main opening{found_drops_late:1b} on target run function graves:opening/items/check_for_missing_pre_death_items
function graves:opening/items/loot_next_item_for_target
function graves:opening/items/give_extra_items with storage graves:main opening.extra_items
execute if data storage graves:main opening.item run playsound minecraft:item.armor.equip_generic player @a
function graves:opening/xp/loot_xp_for_target
data modify storage graves:main destruction.owner_uuid set from storage graves:main opening.owner_uuid
data modify storage graves:main destruction.grave_uuid set from storage graves:main opening.grave_entity.UUID
data modify storage graves:main destruction.name_tag_uuid set from storage graves:main opening.name_tag_uuid
execute at @s run function graves:destruction/destroy_grave with storage graves:main destruction
data remove storage graves:main opening
return 1

View file

@ -0,0 +1,3 @@
playsound minecraft:block.vault.insert_item block @a ~ ~ ~ 0.5
execute if entity @s[gamemode=!creative] run item modify entity @s weapon.mainhand graves:consume_item
return 1

View file

@ -0,0 +1,3 @@
playsound minecraft:block.vault.insert_item block @a ~ ~ ~ 0.5
execute if entity @s[gamemode=!creative] run item modify entity @s weapon.offhand graves:consume_item
return 1

View file

@ -0,0 +1,11 @@
execute unless score $xp_points graves.dummy matches 1.. run return fail
data modify storage graves:main opening.xp_orb.Value set value 1s
data modify storage graves:main opening.xp_orb.Motion set value [0.0d,0.0d,0.0d]
execute store result storage graves:main opening.xp_orb.Motion[0] double 0.001 run random value -200..200
execute store result storage graves:main opening.xp_orb.Motion[1] double 0.001 run random value 0..400
execute store result storage graves:main opening.xp_orb.Motion[2] double 0.001 run random value -200..200
function graves:opening/xp/summon_xp_orb with storage graves:main opening
data modify entity @s {} merge from storage graves:main opening.xp_orb
data remove storage graves:main opening.xp_orb
scoreboard players remove $xp_points graves.dummy 1
function graves:opening/xp/drop_xp_orbs_with_value/1

View file

@ -0,0 +1,11 @@
execute unless score $xp_points graves.dummy matches 1237.. run return fail
data modify storage graves:main opening.xp_orb.Value set value 1237s
data modify storage graves:main opening.xp_orb.Motion set value [0.0d,0.0d,0.0d]
execute store result storage graves:main opening.xp_orb.Motion[0] double 0.001 run random value -200..200
execute store result storage graves:main opening.xp_orb.Motion[1] double 0.001 run random value 0..400
execute store result storage graves:main opening.xp_orb.Motion[2] double 0.001 run random value -200..200
function graves:opening/xp/summon_xp_orb with storage graves:main opening
data modify entity @s {} merge from storage graves:main opening.xp_orb
data remove storage graves:main opening.xp_orb
scoreboard players remove $xp_points graves.dummy 1237
function graves:opening/xp/drop_xp_orbs_with_value/1237

View file

@ -0,0 +1,11 @@
execute unless score $xp_points graves.dummy matches 149.. run return fail
data modify storage graves:main opening.xp_orb.Value set value 149s
data modify storage graves:main opening.xp_orb.Motion set value [0.0d,0.0d,0.0d]
execute store result storage graves:main opening.xp_orb.Motion[0] double 0.001 run random value -200..200
execute store result storage graves:main opening.xp_orb.Motion[1] double 0.001 run random value 0..400
execute store result storage graves:main opening.xp_orb.Motion[2] double 0.001 run random value -200..200
function graves:opening/xp/summon_xp_orb with storage graves:main opening
data modify entity @s {} merge from storage graves:main opening.xp_orb
data remove storage graves:main opening.xp_orb
scoreboard players remove $xp_points graves.dummy 149
function graves:opening/xp/drop_xp_orbs_with_value/149

View file

@ -0,0 +1,11 @@
execute unless score $xp_points graves.dummy matches 17.. run return fail
data modify storage graves:main opening.xp_orb.Value set value 17s
data modify storage graves:main opening.xp_orb.Motion set value [0.0d,0.0d,0.0d]
execute store result storage graves:main opening.xp_orb.Motion[0] double 0.001 run random value -200..200
execute store result storage graves:main opening.xp_orb.Motion[1] double 0.001 run random value 0..400
execute store result storage graves:main opening.xp_orb.Motion[2] double 0.001 run random value -200..200
function graves:opening/xp/summon_xp_orb with storage graves:main opening
data modify entity @s {} merge from storage graves:main opening.xp_orb
data remove storage graves:main opening.xp_orb
scoreboard players remove $xp_points graves.dummy 17
function graves:opening/xp/drop_xp_orbs_with_value/17

View file

@ -0,0 +1,11 @@
execute unless score $xp_points graves.dummy matches 2477.. run return fail
data modify storage graves:main opening.xp_orb.Value set value 2477s
data modify storage graves:main opening.xp_orb.Motion set value [0.0d,0.0d,0.0d]
execute store result storage graves:main opening.xp_orb.Motion[0] double 0.001 run random value -200..200
execute store result storage graves:main opening.xp_orb.Motion[1] double 0.001 run random value 0..400
execute store result storage graves:main opening.xp_orb.Motion[2] double 0.001 run random value -200..200
function graves:opening/xp/summon_xp_orb with storage graves:main opening
data modify entity @s {} merge from storage graves:main opening.xp_orb
data remove storage graves:main opening.xp_orb
scoreboard players remove $xp_points graves.dummy 2477
function graves:opening/xp/drop_xp_orbs_with_value/2477

Some files were not shown because too many files have changed in this diff Show more