From ffdca2edeaf3d8c7e0c25eda36642065e5b06ba2 Mon Sep 17 00:00:00 2001 From: Sergeant Acoustic Date: Sat, 2 May 2026 21:55:52 +0100 Subject: [PATCH] Fix various issues with BKI customisations --- CHANGELOG.md | 3 ++ .../data/bki/function/died.mcfunction | 50 +++++++++++++++++++ .../data/bki/function/reset_safe.mcfunction | 4 ++ ....mcfunction => xp_calculations.mcfunction} | 0 4 files changed, 57 insertions(+) create mode 100644 overrides/resources/datapack/required/bki_override/data/bki/function/died.mcfunction rename overrides/resources/datapack/required/bki_override/data/bki/function/{drop/xp.mcfunction => xp_calculations.mcfunction} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3074e62..59a2ca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,9 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed compass requirement for the player locater bar when using the Player Locater Bar Plus mod - Added keybind (I) to toggle immersive overlays - Clocks are now crafted with copper instead of gold, and the texture has been changed to reflect this (thanks to veechair on discord for the textures!) +- Players no longer make an explosion sound on death ### Fixed - The paxel recipes are now correctly unlocked when finding (most of) their relevant resources +- XP is no longer reset on death +- Added missing tools to the keep on death list ## [2.3.0] diff --git a/overrides/resources/datapack/required/bki_override/data/bki/function/died.mcfunction b/overrides/resources/datapack/required/bki_override/data/bki/function/died.mcfunction new file mode 100644 index 0000000..b863569 --- /dev/null +++ b/overrides/resources/datapack/required/bki_override/data/bki/function/died.mcfunction @@ -0,0 +1,50 @@ +# Main function + +# Reset for the future +advancement revoke @s only bki:player_death + +# Remove everything that has a curse +clear @s *[enchantments~[{enchantments: "vanishing_curse"}]] + + +# Drop xp +# All the XP is dropped and percentage that remains at the place of death depends on the adjustable value (see load or reset function) +function bki:xp_calculations + +# Items before doing something with them to know what is missing after +function bki:get_list_before + +# Clear items with: components:{"minecraft:custom_data":{always_drop:1b}} +clear @s *[minecraft:custom_data~{always_drop:1b}] + +# Items left after previous operation +function bki:get_list_after + +# Subtract the lists to know what items have to be summon +# Before - after +# Make copy of list after as it will be deleted during the recursion and is necessary later +data modify storage bki:bki items.after_copy set from storage bki:bki items.after +# Execute if list not empty +execute if data storage bki:bki items.after_copy[0] run function bki:recursive/sl_b-a + +# Remove from future checking items with this tag +data remove storage bki:bki items.after[{components:{"minecraft:custom_data":{never_drop:1b}}}] + + +# Make copy of list after as it will be deleted during the recursion and is necessary later +data modify storage bki:bki safe.list_copy set from storage bki:bki safe.list +# Execute if list not empty +execute if data storage bki:bki items.after[0] run function bki:recursive/sl_a-safe + +# Summon items that were already cleared +execute if data storage bki:bki items.before[0] run function bki:recursive/summon_cleared + +# Now we are left with the list items.after which contains items which dropped amount is based on #items_dropped value (see load or reset function) +# The last step is to clear them from the inventory and summon the items +execute if data storage bki:bki items.after[0] run function bki:recursive/drop_rest + +# Clean up the data +data remove storage bki:bki drop +data remove storage bki:bki operation +data remove storage bki:bki items +data remove storage bki:bki safe.list_copy diff --git a/overrides/resources/datapack/required/bki_override/data/bki/function/reset_safe.mcfunction b/overrides/resources/datapack/required/bki_override/data/bki/function/reset_safe.mcfunction index a5e1f6f..d5ff925 100644 --- a/overrides/resources/datapack/required/bki_override/data/bki/function/reset_safe.mcfunction +++ b/overrides/resources/datapack/required/bki_override/data/bki/function/reset_safe.mcfunction @@ -6,6 +6,10 @@ data modify storage bki:bki safe.list set value [\ "minecraft:elytra",\ "minecraft:turtle_helmet",\ + "minecraft:bow",\ + "minecraft:crossbow",\ + "minecraft:trident",\ + "minecraft:mace",\ "minecraft:wooden_shovel",\ "minecraft:wooden_pickaxe",\ "minecraft:wooden_axe",\ diff --git a/overrides/resources/datapack/required/bki_override/data/bki/function/drop/xp.mcfunction b/overrides/resources/datapack/required/bki_override/data/bki/function/xp_calculations.mcfunction similarity index 100% rename from overrides/resources/datapack/required/bki_override/data/bki/function/drop/xp.mcfunction rename to overrides/resources/datapack/required/bki_override/data/bki/function/xp_calculations.mcfunction