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,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:true} run tellraw @s [{text:'[ \u2714 ]',color:'green',click_event:{action:'run_command',command:'function graves:disable_allow_robbing'},hover_event:{action:'show_text',value:['',{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:true} run tellraw @s ['',{text:'[ \u274c ]',color:'red',click_event:{action:'run_command',command:'function graves:enable_allow_robbing'},hover_event:{action:'show_text',value:['',{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:true} run tellraw @s ['',{text:'[ \u2714 ]',color:'green',click_event:{action:'run_command',command:'function graves:disable_pick_up_xp'},hover_event:{action:'show_text',value:['',{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:true} run tellraw @s ['',{text:'[ \u274c ]',color:'red',click_event:{action:'run_command',command:'function graves:enable_pick_up_xp'},hover_event:{action:'show_text',value:['',{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:true} run tellraw @s ['',{text:'[ \u2714 ]',color:'green',click_event:{action:'run_command',command:'function graves:disable_allow_locating'},hover_event:{action:'show_text',value:['',{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:true} run tellraw @s ['',{text:'[ \u274c ]',color:'red',click_event:{action:'run_command',command:'function graves:enable_allow_locating'},hover_event:{action:'show_text',value:['',{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:true} run tellraw @s ['',{text:'[ \u2714 ]',color:'green',click_event:{action:'run_command',command:'function graves:disable_compatibility_mode'},hover_event:{action:'show_text',value:['',{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:true} run tellraw @s ['',{text:'[ \u274c ]',color:'red',click_event:{action:'run_command',command:'function graves:enable_compatibility_mode'},hover_event:{action:'show_text',value:['',{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',click_event:{action:'suggest_command',command:'/scoreboard players set $despawn_seconds graves.config '},hover_event:{action:'show_text',value:['',{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 ]',click_event:{action:'run_command',command:'function graves:list'},hover_event:{action:'show_text',value:[{text:'Click to run ',color:'gray'},{text:'/function graves:list',color:'white'},'.']}}]
tellraw @s ['',{text:'>> ',color:'gold'},{text:'[ Receive Grave Key ]',click_event:{action:'run_command',command:'function graves:give_grave_key'},hover_event:{action:'show_text',value:{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,20 @@
data modify storage graves:main creation.pre_death_inventory set from storage graves:main creation.grave_item.pre_death_inventory
data modify storage graves:main creation.pre_death_equipment set from storage graves:main creation.grave_item.pre_death_equipment
execute if data storage graves:main creation.pre_death_equipment.offhand run function graves:creation/items/save_pre_death_equipment_item_slot/offhand
execute if data storage graves:main creation.pre_death_equipment.feet run function graves:creation/items/save_pre_death_equipment_item_slot/feet
execute if data storage graves:main creation.pre_death_equipment.legs run function graves:creation/items/save_pre_death_equipment_item_slot/legs
execute if data storage graves:main creation.pre_death_equipment.chest run function graves:creation/items/save_pre_death_equipment_item_slot/chest
execute if data storage graves:main creation.pre_death_equipment.head run function graves:creation/items/save_pre_death_equipment_item_slot/head
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.)","hover_event":{"action":"show_text","value":["",{"color":"gray","text":"Click to open URL:\\n"},"https://namemc.com/$(owner_uuid_0),$(owner_uuid_1),$(owner_uuid_2),$(owner_uuid_3)"]},"click_event":{"action":"open_url","url":"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,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:"The Graves data pack detected that your inventory dropped (if there was anything to drop) at an unknown location, but your loot table data wasn't found.\n\nThis is likely an incompatibility. We can help solve this for you in our data pack help channel:\n"},{underlined:true,text:'https://vanillatweaks.net/discord',hover_event:{action:'show_text',value:'Click to open URL.'},click_event:{action:'open_url',url:'https://vanillatweaks.net/discord'}}]
execute if data storage graves:config {allow_locating:0b} run return run tellraw @s [{color:'red',text:"The Graves data pack detected that your inventory dropped (if there was anything to drop), but your loot table data wasn't found.\n\nThis is likely an incompatibility. We can help solve this for you in our data pack help channel:\n"},{underlined:true,text:'https://vanillatweaks.net/discord',hover_event:{action:'show_text',value:'Click to open URL.'},click_event:{action:'open_url',url:'https://vanillatweaks.net/discord'}}]
function graves:creation/convert_inventory_pos_to_ints
return run tellraw @s [{color:'red',text:'The Graves data pack detected that 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 your loot table data wasn't found.\n\nThis is likely an incompatibility. We can help solve this for you in our data pack help channel:\n",{underlined:true,text:'https://vanillatweaks.net/discord',hover_event:{action:'show_text',value:'Click to open URL.'},click_event:{action:'open_url',url:'https://vanillatweaks.net/discord'}}]

View file

@ -0,0 +1,27 @@
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 isn't working properly!"},{italic:false,color:'gold',text:'This is likely an incompatibility. We can help solve this for you 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.grave_item.pre_death_equipment","target":"graves.pre_death_equipment"},{"op":"replace","source":"creation.found_drops_late","target":"graves.found_drops_late"}]}]
rotate @s ~90 0
function graves:face_cardinal_direction
summon minecraft:interaction ~ ~ ~ {Tags:['graves.grave','graves.non_grave_repelling','graves.grave.initializing'],width:0.75f,height:0.75f,response:1b}
execute summon minecraft:text_display run function graves:creation/initialize_grave_name_tag
ride @e[type=minecraft:interaction,tag=graves.grave.initializing,distance=..0.01,limit=1] mount @s
execute on passengers run tag @s remove graves.grave.initializing
function graves:placement/start
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,3 @@
data modify entity @s text set value {storage:'graves:main',nbt:'creation.owner_name',interpret:true}
data modify entity @e[type=minecraft:interaction,tag=graves.grave.initializing,distance=..0.01,limit=1] CustomName set from entity @s text
kill @s

View file

@ -0,0 +1,8 @@
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 $missing_pre_death_equipment_count graves.dummy run data get storage graves:main creation.grave_item.pre_death_equipment
scoreboard players operation $missing_pre_death_item_count graves.dummy += $missing_pre_death_equipment_count graves.dummy
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
execute store result storage graves:main creation.grave.missing_pre_death_item_count int 1.0 run 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,2 @@
$data modify storage graves:main creation.item.slot set from storage graves:main creation.pre_death_items[{index: $(pre_death_index)}].slot
$data remove storage graves:main creation.pre_death_items[{index: $(pre_death_index)}]

View file

@ -0,0 +1,4 @@
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:'armor.chest'}
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_equipment.chest

View file

@ -0,0 +1,4 @@
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:'armor.feet'}
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_equipment.feet

View file

@ -0,0 +1,4 @@
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:'armor.head'}
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_equipment.head

View file

@ -0,0 +1,4 @@
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:'armor.legs'}
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_equipment.legs

View file

@ -0,0 +1,4 @@
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:'weapon.offhand'}
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_equipment.offhand

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, there may be an incompatibility, and we can help you in our data pack help channel:\n',{underlined:true,text:'https://vanillatweaks.net/discord',hover_event:{action:'show_text',value:'Click to open URL.'},click_event:{action:'open_url',url:'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, there may be an incompatibility, and we can help you in our data pack help channel:\n',{underlined:true,text:'https://vanillatweaks.net/discord',hover_event:{action:'show_text',value:'Click to open URL.'},click_event:{action:'open_url',url:'https://vanillatweaks.net/discord'}}]

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',hover_event:{action:'show_text',value:'Click to run command.'},click_event:{action:'run_command',command:'trigger graves'}},' to list all your graves.']

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))","hover_event":{"action":"show_text","value":"Click to teleport."},"click_event":{"action":"suggest_command","command":"/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))","hover_event":{"action":"show_text","value":"Click to teleport."},"click_event":{"action":"suggest_command","command":"/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,8 @@
playsound minecraft:block.stone.break block @a
particle minecraft:poof ~ ~0.3125 ~ 0 0 0 0.05 10
execute if data storage graves:main destruction.name_tag_uuid 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 @@
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,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 {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'}
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,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,hover_event:{action:'show_text',value:{italic:true,text:"(excluding when world isn't open)"}}},' ago'],' ',{color:'dark_purple',text:'(more)',hover_event:{action:'show_text',value:['',{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,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 ","hover_event":{"action":"show_text","value":[{"color":"gray","text":"Click to run "},{"color":"white","text":"function graves:list_page {page: $(previous_page_number)}"},"."]},"click_event":{"action":"run_command","command":"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 > ","hover_event":{"action":"show_text","value":[{"color":"gray","text":"Click to run "},{"color":"white","text":"function graves:list_page {page: $(next_page_number)}"},"."]},"click_event":{"action":"run_command","command":"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 ","hover_event":{"action":"show_text","value":[{"color":"gray","text":"Click to run "},{"color":"white","text":"trigger graves set $(previous_page_number)"},"."]},"click_event":{"action":"run_command","command":"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 > ","hover_event":{"action":"show_text","value":[{"color":"gray","text":"Click to run "},{"color":"white","text":"trigger graves set $(next_page_number)"},"."]},"click_event":{"action":"run_command","command":"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,3 @@
execute unless data storage graves:main opening.missing_pre_death_item_count run return fail
execute if data storage graves:main opening{missing_pre_death_item_count: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 "},{storage:'graves:main',nbt:'opening.missing_pre_death_item_count'},' of the item slots originally dropped on death.\n\nIf this grave was missing items, there may be an incompatibility, and we can help you in our data pack help channel:\n',{underlined:true,text:'https://vanillatweaks.net/discord',hover_event:{action:'show_text',value:'Click to open URL.'},click_event:{action:'open_url',url:'https://vanillatweaks.net/discord'}}]

View file

@ -0,0 +1 @@
{"pools":[{"rolls":1,"entries":[{"type":"minecraft:item","name":"minecraft:stone_brick_wall","functions":[{"function":"minecraft:set_components","components":{"minecraft:custom_data":{"graves":{"grave":true}},"minecraft:item_name":"Grave","minecraft:rarity":"epic","minecraft:damage_resistant":{"types":"#minecraft:is_fire"}}},{"function":"minecraft:set_lore","mode":"replace_all","entity":"this","lore":[{"selector":"@s"},"",{"italic":false,"color":"gold","text":"If you see this item, the Graves data pack couldn't detect your death properly!"},{"italic":false,"color":"gold","text":"This is likely an incompatibility."},{"italic":false,"color":"gold","text":"We can help solve this for you in our data pack help channel:"},{"italic":false,"color":"yellow","text":"https://vanillatweaks.net/discord"}]},{"function":"minecraft:copy_custom_data","source":"this","ops":[{"op":"replace","target":"graves.owner_uuid","source":"UUID"},{"op":"replace","target":"graves.pre_death_inventory","source":"Inventory"},{"op":"replace","target":"graves.pre_death_equipment","source":"equipment"}]},{"function":"minecraft:copy_custom_data","source":{"type":"storage","source":"graves:main"},"ops":[{"op":"replace","source":"tick_id","target":"graves.tick_id"}]}]}]}]}

View file

@ -0,0 +1 @@
{"values":["#graves:grave_stopping_on_top","#graves:grave_stopping_on_bottom","#minecraft:banners","#minecraft:buttons","#minecraft:cave_vines","#minecraft:ceiling_hanging_signs","#minecraft:climbable","#minecraft:corals","#minecraft:crops","#minecraft:doors","#minecraft:fence_gates","#minecraft:maintains_farmland","#minecraft:pressure_plates","#minecraft:rails","#minecraft:replaceable","#minecraft:saplings","#minecraft:signs","#minecraft:small_flowers","#minecraft:wall_corals","minecraft:amethyst_cluster","minecraft:bamboo_sapling","minecraft:big_dripleaf","minecraft:big_dripleaf_stem","minecraft:brown_mushroom","minecraft:cactus_flower","minecraft:cobweb","minecraft:comparator","minecraft:crimson_fungus","minecraft:dead_brain_coral","minecraft:dead_brain_coral_fan","minecraft:dead_brain_coral_wall_fan","minecraft:dead_bubble_coral","minecraft:dead_bubble_coral_fan","minecraft:dead_bubble_coral_wall_fan","minecraft:dead_fire_coral","minecraft:dead_fire_coral_fan","minecraft:dead_fire_coral_wall_fan","minecraft:dead_horn_coral","minecraft:dead_horn_coral_fan","minecraft:dead_horn_coral_wall_fan","minecraft:dead_tube_coral","minecraft:dead_tube_coral_fan","minecraft:dead_tube_coral_wall_fan","minecraft:firefly_bush","minecraft:frogspawn","minecraft:kelp","minecraft:kelp_plant","minecraft:large_amethyst_bud","minecraft:lever","minecraft:lilac","minecraft:medium_amethyst_bud","minecraft:nether_portal","minecraft:nether_wart","minecraft:pale_hanging_moss","minecraft:peony","minecraft:pink_petals","minecraft:pitcher_plant","minecraft:powder_snow","minecraft:red_mushroom","minecraft:redstone_torch","minecraft:redstone_wall_torch","minecraft:redstone_wire","minecraft:repeater","minecraft:rose_bush","minecraft:sculk_vein","minecraft:small_amethyst_bud","minecraft:small_dripleaf","minecraft:soul_torch","minecraft:soul_wall_torch","minecraft:spore_blossom","minecraft:sugar_cane","minecraft:sunflower","minecraft:torch","minecraft:tripwire","minecraft:tripwire_hook","minecraft:wall_torch","minecraft:wildflowers"]}

View file

@ -0,0 +1,38 @@
{
"display": {
"icon": {
"id": "minecraft:player_head",
"components": {
"profile": {
"properties": [
{
"name": "textures",
"value": "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTg1YzMzNWM1MjVjZGFkY2Q4MmU4MDA4MzU1N2M2OTYzMGRmYjlhMWVkZjU5OTc0YzdmNjU4ZGI1MWEwYTFkOSJ9fX0="
}
]
}
}
},
"title": "Vanilla Tweaks",
"frame": "challenge",
"description": [
"",
{
"text": "All loaded Vanilla Tweaks data packs\n",
"color": "gold"
},
{
"text": "vanillatweaks.net",
"color": "yellow"
}
],
"background": "minecraft:block/black_concrete",
"show_toast": false,
"announce_to_chat": false
},
"criteria": {
"tick": {
"trigger": "minecraft:tick"
}
}
}