├── .gitattributes ├── hit-match-dp ├── pack.png ├── data │ ├── hit_match │ │ ├── tags │ │ │ ├── entity_type │ │ │ │ └── targets.json │ │ │ └── function │ │ │ │ ├── player_hurts_entity.json │ │ │ │ └── player_is_hurt_by_entity.json │ │ ├── function │ │ │ ├── _detection │ │ │ │ ├── enable │ │ │ │ │ ├── _.mcfunction │ │ │ │ │ └── _1.mcfunction │ │ │ │ └── disable │ │ │ │ │ ├── _.mcfunction │ │ │ │ │ └── _1.mcfunction │ │ │ ├── _id │ │ │ │ ├── assign_all │ │ │ │ │ ├── next_bit │ │ │ │ │ │ └── _.mcfunction │ │ │ │ │ ├── _.mcfunction │ │ │ │ │ ├── _1.mcfunction │ │ │ │ │ └── _11.mcfunction │ │ │ │ └── reset_all │ │ │ │ │ └── _.mcfunction │ │ │ ├── load │ │ │ │ ├── _.mcfunction │ │ │ │ └── _1.mcfunction │ │ │ ├── tick │ │ │ │ └── _.mcfunction │ │ │ └── _advancement │ │ │ │ ├── _entity_hurt_player │ │ │ │ └── reward │ │ │ │ │ ├── _.mcfunction │ │ │ │ │ └── _1.mcfunction │ │ │ │ └── _player_hurt_entity │ │ │ │ └── reward │ │ │ │ ├── _.mcfunction │ │ │ │ ├── _1.mcfunction │ │ │ │ └── _2.mcfunction │ │ ├── predicate │ │ │ ├── has_id.json │ │ │ ├── has_uid.json │ │ │ ├── is_direct.json │ │ │ └── is_victim.json │ │ └── advancement │ │ │ ├── entity_hurt_player.json │ │ │ └── player_hurt_entity.json │ └── minecraft │ │ └── tags │ │ └── function │ │ ├── load.json │ │ └── tick.json ├── info.txt ├── pack.mcmeta └── mit_license.txt ├── CHANGELOG.md ├── LICENSE.md └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=crlf 2 | -------------------------------------------------------------------------------- /hit-match-dp/pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/picarrow/hit-match/HEAD/hit-match-dp/pack.png -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/tags/entity_type/targets.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [] 4 | } 5 | -------------------------------------------------------------------------------- /hit-match-dp/info.txt: -------------------------------------------------------------------------------- 1 | PROJ: Hit Match v1.7.0 2 | AUTH: Picarrow 3 | REFE: https://github.com/picarrow/hit-match 4 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/tags/function/player_hurts_entity.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [] 4 | } 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## v1.7.0 2 | 3 | ### Features 4 | 5 | #### General 6 | - Updated to MC 1.21 (not backwards compatible). 7 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/tags/function/player_is_hurt_by_entity.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [] 4 | } 5 | -------------------------------------------------------------------------------- /hit-match-dp/data/minecraft/tags/function/load.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "hit_match:load/_" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /hit-match-dp/data/minecraft/tags/function/tick.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "hit_match:tick/_" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_detection/enable/_.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | scoreboard players set $detection ehm._ 1 4 | execute as @a[tag=ehm.detection_off] run function hit_match:_detection/enable/_1 5 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_detection/disable/_.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | scoreboard players set $detection ehm._ 0 4 | execute as @a[tag=!ehm.detection_off] run function hit_match:_detection/disable/_1 5 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/predicate/has_id.json: -------------------------------------------------------------------------------- 1 | { 2 | "condition": "minecraft:entity_scores", 3 | "entity": "this", 4 | "scores": { 5 | "ehm.id": { 6 | "min": -1, 7 | "max": 19682 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/predicate/has_uid.json: -------------------------------------------------------------------------------- 1 | { 2 | "condition": "minecraft:entity_scores", 3 | "entity": "this", 4 | "scores": { 5 | "ehm.id": { 6 | "min": 0, 7 | "max": 19682 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_detection/disable/_1.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | advancement grant @s only hit_match:player_hurt_entity 4 | advancement grant @s only hit_match:entity_hurt_player 5 | 6 | tag @s add ehm.detection_off 7 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_detection/enable/_1.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | advancement revoke @s only hit_match:player_hurt_entity 4 | advancement revoke @s only hit_match:entity_hurt_player 5 | 6 | tag @s remove ehm.detection_off 7 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_id/assign_all/next_bit/_.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | scoreboard players operation #_bit ehm._ = #_temp_id ehm._ 4 | scoreboard players operation #_bit ehm._ %= #3 ehm._ 5 | scoreboard players operation #_temp_id ehm._ /= #3 ehm._ 6 | -------------------------------------------------------------------------------- /hit-match-dp/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "\u00A7aHit Match v1.7.0 \u00A77by \u00A7fPicarrow", 4 | "pack_format": 70, 5 | "supported_formats": { 6 | "min_inclusive": 48, 7 | "max_inclusive": 70 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_id/reset_all/_.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | # Reset IDs 4 | scoreboard players reset * ehm.id 5 | 6 | # Set the next UID to be assigned back to 1 7 | # Set to 0 once MC-229018 is resolved 8 | scoreboard players set #next_uid ehm._ 1 9 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/load/_.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | # Initialize the namespace 4 | execute unless data storage hit_match:data _.loaded run function hit_match:load/_1 5 | 6 | # Reset IDs to respect any changes to the 'targets' entity-type tag 7 | function hit_match:_id/reset_all/_ 8 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/tick/_.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | # Assign IDs to the entities that need them 4 | function hit_match:_id/assign_all/_ 5 | 6 | # Enforce detection state 7 | execute if score $detection ehm._ matches 0 run function hit_match:_detection/disable/_ 8 | execute if score $detection ehm._ matches 1 run function hit_match:_detection/enable/_ 9 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_id/assign_all/_.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | execute store result score #_entities_to_check ehm._ if entity @e[predicate=!hit_match:has_id] 4 | scoreboard players set #_uids_left ehm._ 19683 5 | scoreboard players operation #_uids_left ehm._ -= #next_uid ehm._ 6 | execute if score #_entities_to_check ehm._ > #_uids_left ehm._ run function hit_match:_id/reset_all/_ 7 | execute as @e[predicate=!hit_match:has_id] run function hit_match:_id/assign_all/_1 8 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/predicate/is_direct.json: -------------------------------------------------------------------------------- 1 | { 2 | "condition": "minecraft:entity_scores", 3 | "entity": "this", 4 | "scores": { 5 | "ehm.id": { 6 | "min": { 7 | "type": "minecraft:score", 8 | "target": { 9 | "type": "minecraft:fixed", 10 | "name": "$direct" 11 | }, 12 | "score": "ehm._" 13 | }, 14 | "max": { 15 | "type": "minecraft:score", 16 | "target": { 17 | "type": "minecraft:fixed", 18 | "name": "$direct" 19 | }, 20 | "score": "ehm._" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/predicate/is_victim.json: -------------------------------------------------------------------------------- 1 | { 2 | "condition": "minecraft:entity_scores", 3 | "entity": "this", 4 | "scores": { 5 | "ehm.id": { 6 | "min": { 7 | "type": "minecraft:score", 8 | "target": { 9 | "type": "minecraft:fixed", 10 | "name": "$victim" 11 | }, 12 | "score": "ehm._" 13 | }, 14 | "max": { 15 | "type": "minecraft:score", 16 | "target": { 17 | "type": "minecraft:fixed", 18 | "name": "$victim" 19 | }, 20 | "score": "ehm._" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_advancement/_entity_hurt_player/reward/_.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | # Escape if detection is off 4 | execute if score $detection ehm._ matches 0 run return 0 5 | 6 | # Determine the UID of the entity inflicting damage 7 | scoreboard players reset $direct ehm._ 8 | execute if entity @s[advancements={hit_match:entity_hurt_player={direct_has_no_uid=false}}] run function hit_match:_advancement/_entity_hurt_player/reward/_1 9 | 10 | # Determine the UID of the entity receiving damage 11 | scoreboard players reset $victim ehm._ 12 | execute if predicate hit_match:has_uid run scoreboard players operation $victim ehm._ = @s ehm.id 13 | 14 | # Revoke the advancement, so it can be triggered again 15 | advancement revoke @s only hit_match:entity_hurt_player 16 | 17 | # Run the provided functions that work off of this reward function 18 | function #hit_match:player_is_hurt_by_entity 19 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_advancement/_player_hurt_entity/reward/_.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | # Escape if detection is off 4 | execute if score $detection ehm._ matches 0 run return 0 5 | 6 | # Determine the UID of the entity inflicting damage 7 | scoreboard players reset $direct ehm._ 8 | execute if entity @s[advancements={hit_match:player_hurt_entity={direct_has_no_uid=false}}] run function hit_match:_advancement/_player_hurt_entity/reward/_1 9 | 10 | # Determine the UID of the entity receiving damage 11 | scoreboard players reset $victim ehm._ 12 | execute if entity @s[advancements={hit_match:player_hurt_entity={victim_has_no_uid=false}}] run function hit_match:_advancement/_player_hurt_entity/reward/_2 13 | 14 | # Revoke the advancement, so it can be triggered again 15 | advancement revoke @s only hit_match:player_hurt_entity 16 | 17 | # Run the provided functions that work off of this reward function 18 | function #hit_match:player_hurts_entity 19 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/load/_1.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | # Track variables and constants 4 | scoreboard objectives add ehm._ dummy 5 | scoreboard players set $detection ehm._ 1 6 | scoreboard players set #3 ehm._ 3 7 | 8 | # Set to 0 once MC-229018 is resolved 9 | scoreboard players set #next_uid ehm._ 1 10 | 11 | # Track entity IDs 12 | scoreboard objectives add ehm.id dummy 13 | 14 | # Track each bit of entity IDs 15 | scoreboard objectives add ehm.id.0 dummy 16 | scoreboard objectives add ehm.id.1 dummy 17 | scoreboard objectives add ehm.id.2 dummy 18 | scoreboard objectives add ehm.id.3 dummy 19 | scoreboard objectives add ehm.id.4 dummy 20 | scoreboard objectives add ehm.id.5 dummy 21 | scoreboard objectives add ehm.id.6 dummy 22 | scoreboard objectives add ehm.id.7 dummy 23 | scoreboard objectives add ehm.id.8 dummy 24 | 25 | # Indicate the namespace has been initialized 26 | data modify storage hit_match:data _.loaded set value {} 27 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Picarrow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /hit-match-dp/mit_license.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Picarrow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_id/assign_all/_1.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | # Remove leftover ID data 4 | scoreboard players reset @s ehm.id.0 5 | scoreboard players reset @s ehm.id.1 6 | scoreboard players reset @s ehm.id.2 7 | scoreboard players reset @s ehm.id.3 8 | scoreboard players reset @s ehm.id.4 9 | scoreboard players reset @s ehm.id.5 10 | scoreboard players reset @s ehm.id.6 11 | scoreboard players reset @s ehm.id.7 12 | scoreboard players reset @s ehm.id.8 13 | 14 | tag @s[tag=ehm.0_0] remove ehm.0_0 15 | tag @s[tag=ehm.0_1] remove ehm.0_1 16 | tag @s[tag=ehm.0_2] remove ehm.0_2 17 | tag @s[tag=ehm.1_0] remove ehm.1_0 18 | tag @s[tag=ehm.1_1] remove ehm.1_1 19 | tag @s[tag=ehm.1_2] remove ehm.1_2 20 | tag @s[tag=ehm.2_0] remove ehm.2_0 21 | tag @s[tag=ehm.2_1] remove ehm.2_1 22 | tag @s[tag=ehm.2_2] remove ehm.2_2 23 | tag @s[tag=ehm.3_0] remove ehm.3_0 24 | tag @s[tag=ehm.3_1] remove ehm.3_1 25 | tag @s[tag=ehm.3_2] remove ehm.3_2 26 | tag @s[tag=ehm.4_0] remove ehm.4_0 27 | tag @s[tag=ehm.4_1] remove ehm.4_1 28 | tag @s[tag=ehm.4_2] remove ehm.4_2 29 | tag @s[tag=ehm.5_0] remove ehm.5_0 30 | tag @s[tag=ehm.5_1] remove ehm.5_1 31 | tag @s[tag=ehm.5_2] remove ehm.5_2 32 | tag @s[tag=ehm.6_0] remove ehm.6_0 33 | tag @s[tag=ehm.6_1] remove ehm.6_1 34 | tag @s[tag=ehm.6_2] remove ehm.6_2 35 | tag @s[tag=ehm.7_0] remove ehm.7_0 36 | tag @s[tag=ehm.7_1] remove ehm.7_1 37 | tag @s[tag=ehm.7_2] remove ehm.7_2 38 | tag @s[tag=ehm.8_0] remove ehm.8_0 39 | tag @s[tag=ehm.8_1] remove ehm.8_1 40 | tag @s[tag=ehm.8_2] remove ehm.8_2 41 | 42 | tag @s[tag=ehm.no_uid] remove ehm.no_uid 43 | 44 | # Return after the assignment of a UID if the entity is a target 45 | execute if entity @s[type=#hit_match:targets] run return run function hit_match:_id/assign_all/_11 46 | 47 | # Assign an ID to know not to check the non-target again 48 | scoreboard players set @s ehm.id -1 49 | tag @s add ehm.no_uid 50 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_advancement/_entity_hurt_player/reward/_1.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | scoreboard players set $direct ehm._ 0 4 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_0_1=true}}] run scoreboard players add $direct ehm._ 1 5 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_0_2=true}}] run scoreboard players add $direct ehm._ 2 6 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_1_1=true}}] run scoreboard players add $direct ehm._ 3 7 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_1_2=true}}] run scoreboard players add $direct ehm._ 6 8 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_2_1=true}}] run scoreboard players add $direct ehm._ 9 9 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_2_2=true}}] run scoreboard players add $direct ehm._ 18 10 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_3_1=true}}] run scoreboard players add $direct ehm._ 27 11 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_3_2=true}}] run scoreboard players add $direct ehm._ 54 12 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_4_1=true}}] run scoreboard players add $direct ehm._ 81 13 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_4_2=true}}] run scoreboard players add $direct ehm._ 162 14 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_5_1=true}}] run scoreboard players add $direct ehm._ 243 15 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_5_2=true}}] run scoreboard players add $direct ehm._ 486 16 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_6_1=true}}] run scoreboard players add $direct ehm._ 729 17 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_6_2=true}}] run scoreboard players add $direct ehm._ 1458 18 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_7_1=true}}] run scoreboard players add $direct ehm._ 2187 19 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_7_2=true}}] run scoreboard players add $direct ehm._ 4374 20 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_8_1=true}}] run scoreboard players add $direct ehm._ 6561 21 | execute if entity @s[advancements={hit_match:entity_hurt_player={drt_bit_8_2=true}}] run scoreboard players add $direct ehm._ 13122 22 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_advancement/_player_hurt_entity/reward/_1.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | scoreboard players set $direct ehm._ 0 4 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_0_1=true}}] run scoreboard players add $direct ehm._ 1 5 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_0_2=true}}] run scoreboard players add $direct ehm._ 2 6 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_1_1=true}}] run scoreboard players add $direct ehm._ 3 7 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_1_2=true}}] run scoreboard players add $direct ehm._ 6 8 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_2_1=true}}] run scoreboard players add $direct ehm._ 9 9 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_2_2=true}}] run scoreboard players add $direct ehm._ 18 10 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_3_1=true}}] run scoreboard players add $direct ehm._ 27 11 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_3_2=true}}] run scoreboard players add $direct ehm._ 54 12 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_4_1=true}}] run scoreboard players add $direct ehm._ 81 13 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_4_2=true}}] run scoreboard players add $direct ehm._ 162 14 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_5_1=true}}] run scoreboard players add $direct ehm._ 243 15 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_5_2=true}}] run scoreboard players add $direct ehm._ 486 16 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_6_1=true}}] run scoreboard players add $direct ehm._ 729 17 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_6_2=true}}] run scoreboard players add $direct ehm._ 1458 18 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_7_1=true}}] run scoreboard players add $direct ehm._ 2187 19 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_7_2=true}}] run scoreboard players add $direct ehm._ 4374 20 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_8_1=true}}] run scoreboard players add $direct ehm._ 6561 21 | execute if entity @s[advancements={hit_match:player_hurt_entity={drt_bit_8_2=true}}] run scoreboard players add $direct ehm._ 13122 22 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_advancement/_player_hurt_entity/reward/_2.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | scoreboard players set $victim ehm._ 0 4 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_0_1=true}}] run scoreboard players add $victim ehm._ 1 5 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_0_2=true}}] run scoreboard players add $victim ehm._ 2 6 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_1_1=true}}] run scoreboard players add $victim ehm._ 3 7 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_1_2=true}}] run scoreboard players add $victim ehm._ 6 8 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_2_1=true}}] run scoreboard players add $victim ehm._ 9 9 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_2_2=true}}] run scoreboard players add $victim ehm._ 18 10 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_3_1=true}}] run scoreboard players add $victim ehm._ 27 11 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_3_2=true}}] run scoreboard players add $victim ehm._ 54 12 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_4_1=true}}] run scoreboard players add $victim ehm._ 81 13 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_4_2=true}}] run scoreboard players add $victim ehm._ 162 14 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_5_1=true}}] run scoreboard players add $victim ehm._ 243 15 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_5_2=true}}] run scoreboard players add $victim ehm._ 486 16 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_6_1=true}}] run scoreboard players add $victim ehm._ 729 17 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_6_2=true}}] run scoreboard players add $victim ehm._ 1458 18 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_7_1=true}}] run scoreboard players add $victim ehm._ 2187 19 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_7_2=true}}] run scoreboard players add $victim ehm._ 4374 20 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_8_1=true}}] run scoreboard players add $victim ehm._ 6561 21 | execute if entity @s[advancements={hit_match:player_hurt_entity={vtm_bit_8_2=true}}] run scoreboard players add $victim ehm._ 13122 22 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/function/_id/assign_all/_11.mcfunction: -------------------------------------------------------------------------------- 1 | ## AUTHOR : Picarrow 2 | 3 | # Assign a UID 4 | scoreboard players operation @s ehm.id = #next_uid ehm._ 5 | scoreboard players add #next_uid ehm._ 1 6 | 7 | # Associate the base-3 UID 8 | scoreboard players operation #_temp_id ehm._ = @s ehm.id 9 | 10 | function hit_match:_id/assign_all/next_bit/_ 11 | scoreboard players operation @s ehm.id.0 = #_bit ehm._ 12 | 13 | function hit_match:_id/assign_all/next_bit/_ 14 | scoreboard players operation @s ehm.id.1 = #_bit ehm._ 15 | 16 | function hit_match:_id/assign_all/next_bit/_ 17 | scoreboard players operation @s ehm.id.2 = #_bit ehm._ 18 | 19 | function hit_match:_id/assign_all/next_bit/_ 20 | scoreboard players operation @s ehm.id.3 = #_bit ehm._ 21 | 22 | function hit_match:_id/assign_all/next_bit/_ 23 | scoreboard players operation @s ehm.id.4 = #_bit ehm._ 24 | 25 | function hit_match:_id/assign_all/next_bit/_ 26 | scoreboard players operation @s ehm.id.5 = #_bit ehm._ 27 | 28 | function hit_match:_id/assign_all/next_bit/_ 29 | scoreboard players operation @s ehm.id.6 = #_bit ehm._ 30 | 31 | function hit_match:_id/assign_all/next_bit/_ 32 | scoreboard players operation @s ehm.id.7 = #_bit ehm._ 33 | 34 | function hit_match:_id/assign_all/next_bit/_ 35 | scoreboard players operation @s ehm.id.8 = #_bit ehm._ 36 | 37 | # Append command tags that reflect the base-3 UID 38 | tag @s[scores={ehm.id.0=0}] add ehm.0_0 39 | tag @s[scores={ehm.id.0=1}] add ehm.0_1 40 | tag @s[scores={ehm.id.0=2}] add ehm.0_2 41 | tag @s[scores={ehm.id.1=0}] add ehm.1_0 42 | tag @s[scores={ehm.id.1=1}] add ehm.1_1 43 | tag @s[scores={ehm.id.1=2}] add ehm.1_2 44 | tag @s[scores={ehm.id.2=0}] add ehm.2_0 45 | tag @s[scores={ehm.id.2=1}] add ehm.2_1 46 | tag @s[scores={ehm.id.2=2}] add ehm.2_2 47 | tag @s[scores={ehm.id.3=0}] add ehm.3_0 48 | tag @s[scores={ehm.id.3=1}] add ehm.3_1 49 | tag @s[scores={ehm.id.3=2}] add ehm.3_2 50 | tag @s[scores={ehm.id.4=0}] add ehm.4_0 51 | tag @s[scores={ehm.id.4=1}] add ehm.4_1 52 | tag @s[scores={ehm.id.4=2}] add ehm.4_2 53 | tag @s[scores={ehm.id.5=0}] add ehm.5_0 54 | tag @s[scores={ehm.id.5=1}] add ehm.5_1 55 | tag @s[scores={ehm.id.5=2}] add ehm.5_2 56 | tag @s[scores={ehm.id.6=0}] add ehm.6_0 57 | tag @s[scores={ehm.id.6=1}] add ehm.6_1 58 | tag @s[scores={ehm.id.6=2}] add ehm.6_2 59 | tag @s[scores={ehm.id.7=0}] add ehm.7_0 60 | tag @s[scores={ehm.id.7=1}] add ehm.7_1 61 | tag @s[scores={ehm.id.7=2}] add ehm.7_2 62 | tag @s[scores={ehm.id.8=0}] add ehm.8_0 63 | tag @s[scores={ehm.id.8=1}] add ehm.8_1 64 | tag @s[scores={ehm.id.8=2}] add ehm.8_2 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hit Match v1.7.0 2 | ## 🟧 About 3 |     Hit Match is a Minecraft data pack library that facilitates the selection of entities that have exchanged damage with players. 4 | For example, it can make poisoning a mob a player hurt trivial, where often selecting the correct mob to poison is difficult. 5 | It can even trivialize the application of an arrow's custom effects to a pierced mob. 6 | As Hit Match is built on the advancement system, and advancements are inherent to strictly players, it cannot process damage exchanges that do not involve a player. 7 | That includes situations where a mob has hurt another mob. 8 | ## 🟧 Installation 9 | ***It is recommended that a stable version from [Releases](https://github.com/picarrow/hit-match/releases) is installed.*** 10 | 11 |     For the more recent releases, the Hit Match data pack should be placed beside the data packs that use it. 12 | That entails dragging the entire pack (the ZIP) into the `datapacks` folder of a world. 13 | Hit Match is a discreet data pack and makes no discernable impact on a world unless other packs leverage it to do so. 14 | ## 🟧 How To Use 15 | ***Tampering with the files of Hit Match in any way that is not described in the following section can jeopardize compatibility between packs.*** 16 | 17 |     Hit Match contains one entity-type tag and two function tags that may be overridden. 18 | For a data pack to override these tags, it must create these function tags within itself, keeping the namespace as `hit_match`. 19 | In the overrides for these tags, it is crucial that the JSON key `replace` is set to `false`. 20 | This ensures that the members of these overrides are appended beside, rather than replacing, existing members that have been added by other packs. 21 | ### Targets 22 |     One of the tags intended to be overridden is the entity-type tag `hit_match:targets`. 23 | The entity types included in this tag are used to ID entities into a scoreboard ID system. 24 | ID'd entities are referred to as *targets*. 25 | Targets benefit from the tools in Hit Match that can make selection easier, but more target types than necessary will result in greater performance costs. 26 | ### Detection of Targets 27 |     Hit Match registers two advancements pertaining to the detection of targets. 28 | They are designed to behave as event listeners that can pick up on the IDs of essential targets in an event. 29 | One advancement handles the event of a player hurting another entity, and the other handles an entity hurting a player. 30 | When the event they are listening for happens, they invoke a function tag of the same name. 31 | 32 | Function Tag: 33 | - `hit_match:player_hurts_entity` is called when a player damages an entity. 34 | - `hit_match:player_is_hurt_by_entity` is called when a player is damaged by an entity. 35 | 36 | Like the `hit_match:targets` entity-type tag, the described function tags are intended to be overridden by a dependent data pack. 37 | The functions that are appended to these tags are where it can become easier to select the *actors* of a damage exchange. 38 | The entities that produce a damage exchange are referred to as actors. 39 | ### Selection of Targets 40 |     In regards to the member functions of the aforementioned function tags, the player earning the advancement becomes the executor. 41 | The execution position, rotation, and dimension also become that of the same player. 42 | To understand the role of the player in each event, the following terminology is important. 43 |
44 | Actors of a Damage Exchange 45 | 46 | **Victim Entity** - The entity that was dealt the damage. 47 | **Direct Entity** - The entity that dealt the damage. 48 | **Source Entity** - The entity that did not deal but is responsible for the damage. 49 |
50 | 51 | So in the event of a player hurting another entity, the player can become either the direct or source entity. 52 | For example, if a player hurts a mob by punching it, they'll become the direct entity. 53 | And if they hurt a mob by firing an arrow at it, they'll become the source entity; the arrow will become the direct entity instead. 54 | In the other event of an entity hurting a player, the player can only ever be the victim entity. 55 | 56 | Hit Match makes it trivial to select the victim and direct entity if they are targets. 57 | Here's how to select them. 58 | ```mcfunction 59 | # Victim Entity 60 | execute as @e if score @s ehm.id = $victim ehm._ run say Victim Entity, selected by method 1. 61 | execute as @e[predicate=hit_match:is_victim] run say Victim Entity, selected by method 2. 62 | execute if score $victim ehm._ = $victim ehm._ as @e[predicate=hit_match:is_victim,limit=1] run say Victim Entity, selected efficiently. 63 | 64 | # Direct Entity 65 | execute as @e if score @s ehm.id = $direct ehm._ run say Direct Entity, selected by method 1. 66 | execute as @e[predicate=hit_match:is_direct] run say Direct Entity, selected by method 2. 67 | execute if score $direct ehm._ = $direct ehm._ as @e[predicate=hit_match:is_direct,limit=1] run say Direct Entity, selected efficiently. 68 | ``` 69 | Unfortunately, it is not always possible to select the source entity with Hit Match, and the way to select it varies depending on the actors. 70 | To select it: 71 | - The `execute` subcommand `on attacker` can be used when the source entity is a living entity and must be executed by the victim entity. 72 | - The `execute` subcommand `on origin` can be used when the direct entity has an origin and must be executed by the direct entity. 73 | 74 | `on attacker` should be used wherever else it applies as it is extremely efficient. 75 | ## 🟧 Caveat of `/damage` 76 |     When the `/damage` command is used to exchange damage between a player and another entity, it invokes an unnecessary performance cost. 77 | This is because the command can trigger the `player_hurt_entity` and `entity_hurt_player` advancement triggers, which fire expensive criteria checks within Hit Match. 78 | It is highly recommended that Hit Match's detection be disabled while running `/damage`-related commands. 79 | The following code sample demonstrates how to do this: 80 | ```mcfunction 81 | function hit_match:_/detection/disable 82 | damage PersonA 5 minecraft:generic by PersonB from PersonC 83 | function hit_match:_/detection/enable 84 | ``` 85 | ## 🟧 Credit 86 | Thanks to [@nphhpn](https://github.com/nphhpn), who theorized the general concept and implementation. 87 | Thanks to [@CloudWolfYT](https://github.com/CloudWolfYT), who adapted the implementation to make intelligent use of command tags. 88 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/advancement/entity_hurt_player.json: -------------------------------------------------------------------------------- 1 | { 2 | "criteria": { 3 | "direct_has_no_uid": { 4 | "trigger": "minecraft:entity_hurt_player", 5 | "conditions": { 6 | "damage": { 7 | "type": { 8 | "direct_entity": { 9 | "nbt": "{Tags:[\"ehm.no_uid\"]}" 10 | } 11 | } 12 | } 13 | } 14 | }, 15 | "drt_bit_0_0": { 16 | "trigger": "minecraft:entity_hurt_player", 17 | "conditions": { 18 | "damage": { 19 | "type": { 20 | "direct_entity": { 21 | "nbt": "{Tags:[\"ehm.0_0\"]}" 22 | } 23 | } 24 | } 25 | } 26 | }, 27 | "drt_bit_0_1": { 28 | "trigger": "minecraft:entity_hurt_player", 29 | "conditions": { 30 | "damage": { 31 | "type": { 32 | "direct_entity": { 33 | "nbt": "{Tags:[\"ehm.0_1\"]}" 34 | } 35 | } 36 | } 37 | } 38 | }, 39 | "drt_bit_0_2": { 40 | "trigger": "minecraft:entity_hurt_player", 41 | "conditions": { 42 | "damage": { 43 | "type": { 44 | "direct_entity": { 45 | "nbt": "{Tags:[\"ehm.0_2\"]}" 46 | } 47 | } 48 | } 49 | } 50 | }, 51 | "drt_bit_1_0": { 52 | "trigger": "minecraft:entity_hurt_player", 53 | "conditions": { 54 | "damage": { 55 | "type": { 56 | "direct_entity": { 57 | "nbt": "{Tags:[\"ehm.1_0\"]}" 58 | } 59 | } 60 | } 61 | } 62 | }, 63 | "drt_bit_1_1": { 64 | "trigger": "minecraft:entity_hurt_player", 65 | "conditions": { 66 | "damage": { 67 | "type": { 68 | "direct_entity": { 69 | "nbt": "{Tags:[\"ehm.1_1\"]}" 70 | } 71 | } 72 | } 73 | } 74 | }, 75 | "drt_bit_1_2": { 76 | "trigger": "minecraft:entity_hurt_player", 77 | "conditions": { 78 | "damage": { 79 | "type": { 80 | "direct_entity": { 81 | "nbt": "{Tags:[\"ehm.1_2\"]}" 82 | } 83 | } 84 | } 85 | } 86 | }, 87 | "drt_bit_2_0": { 88 | "trigger": "minecraft:entity_hurt_player", 89 | "conditions": { 90 | "damage": { 91 | "type": { 92 | "direct_entity": { 93 | "nbt": "{Tags:[\"ehm.2_0\"]}" 94 | } 95 | } 96 | } 97 | } 98 | }, 99 | "drt_bit_2_1": { 100 | "trigger": "minecraft:entity_hurt_player", 101 | "conditions": { 102 | "damage": { 103 | "type": { 104 | "direct_entity": { 105 | "nbt": "{Tags:[\"ehm.2_1\"]}" 106 | } 107 | } 108 | } 109 | } 110 | }, 111 | "drt_bit_2_2": { 112 | "trigger": "minecraft:entity_hurt_player", 113 | "conditions": { 114 | "damage": { 115 | "type": { 116 | "direct_entity": { 117 | "nbt": "{Tags:[\"ehm.2_2\"]}" 118 | } 119 | } 120 | } 121 | } 122 | }, 123 | "drt_bit_3_0": { 124 | "trigger": "minecraft:entity_hurt_player", 125 | "conditions": { 126 | "damage": { 127 | "type": { 128 | "direct_entity": { 129 | "nbt": "{Tags:[\"ehm.3_0\"]}" 130 | } 131 | } 132 | } 133 | } 134 | }, 135 | "drt_bit_3_1": { 136 | "trigger": "minecraft:entity_hurt_player", 137 | "conditions": { 138 | "damage": { 139 | "type": { 140 | "direct_entity": { 141 | "nbt": "{Tags:[\"ehm.3_1\"]}" 142 | } 143 | } 144 | } 145 | } 146 | }, 147 | "drt_bit_3_2": { 148 | "trigger": "minecraft:entity_hurt_player", 149 | "conditions": { 150 | "damage": { 151 | "type": { 152 | "direct_entity": { 153 | "nbt": "{Tags:[\"ehm.3_2\"]}" 154 | } 155 | } 156 | } 157 | } 158 | }, 159 | "drt_bit_4_0": { 160 | "trigger": "minecraft:entity_hurt_player", 161 | "conditions": { 162 | "damage": { 163 | "type": { 164 | "direct_entity": { 165 | "nbt": "{Tags:[\"ehm.4_0\"]}" 166 | } 167 | } 168 | } 169 | } 170 | }, 171 | "drt_bit_4_1": { 172 | "trigger": "minecraft:entity_hurt_player", 173 | "conditions": { 174 | "damage": { 175 | "type": { 176 | "direct_entity": { 177 | "nbt": "{Tags:[\"ehm.4_1\"]}" 178 | } 179 | } 180 | } 181 | } 182 | }, 183 | "drt_bit_4_2": { 184 | "trigger": "minecraft:entity_hurt_player", 185 | "conditions": { 186 | "damage": { 187 | "type": { 188 | "direct_entity": { 189 | "nbt": "{Tags:[\"ehm.4_2\"]}" 190 | } 191 | } 192 | } 193 | } 194 | }, 195 | "drt_bit_5_0": { 196 | "trigger": "minecraft:entity_hurt_player", 197 | "conditions": { 198 | "damage": { 199 | "type": { 200 | "direct_entity": { 201 | "nbt": "{Tags:[\"ehm.5_0\"]}" 202 | } 203 | } 204 | } 205 | } 206 | }, 207 | "drt_bit_5_1": { 208 | "trigger": "minecraft:entity_hurt_player", 209 | "conditions": { 210 | "damage": { 211 | "type": { 212 | "direct_entity": { 213 | "nbt": "{Tags:[\"ehm.5_1\"]}" 214 | } 215 | } 216 | } 217 | } 218 | }, 219 | "drt_bit_5_2": { 220 | "trigger": "minecraft:entity_hurt_player", 221 | "conditions": { 222 | "damage": { 223 | "type": { 224 | "direct_entity": { 225 | "nbt": "{Tags:[\"ehm.5_2\"]}" 226 | } 227 | } 228 | } 229 | } 230 | }, 231 | "drt_bit_6_0": { 232 | "trigger": "minecraft:entity_hurt_player", 233 | "conditions": { 234 | "damage": { 235 | "type": { 236 | "direct_entity": { 237 | "nbt": "{Tags:[\"ehm.6_0\"]}" 238 | } 239 | } 240 | } 241 | } 242 | }, 243 | "drt_bit_6_1": { 244 | "trigger": "minecraft:entity_hurt_player", 245 | "conditions": { 246 | "damage": { 247 | "type": { 248 | "direct_entity": { 249 | "nbt": "{Tags:[\"ehm.6_1\"]}" 250 | } 251 | } 252 | } 253 | } 254 | }, 255 | "drt_bit_6_2": { 256 | "trigger": "minecraft:entity_hurt_player", 257 | "conditions": { 258 | "damage": { 259 | "type": { 260 | "direct_entity": { 261 | "nbt": "{Tags:[\"ehm.6_2\"]}" 262 | } 263 | } 264 | } 265 | } 266 | }, 267 | "drt_bit_7_0": { 268 | "trigger": "minecraft:entity_hurt_player", 269 | "conditions": { 270 | "damage": { 271 | "type": { 272 | "direct_entity": { 273 | "nbt": "{Tags:[\"ehm.7_0\"]}" 274 | } 275 | } 276 | } 277 | } 278 | }, 279 | "drt_bit_7_1": { 280 | "trigger": "minecraft:entity_hurt_player", 281 | "conditions": { 282 | "damage": { 283 | "type": { 284 | "direct_entity": { 285 | "nbt": "{Tags:[\"ehm.7_1\"]}" 286 | } 287 | } 288 | } 289 | } 290 | }, 291 | "drt_bit_7_2": { 292 | "trigger": "minecraft:entity_hurt_player", 293 | "conditions": { 294 | "damage": { 295 | "type": { 296 | "direct_entity": { 297 | "nbt": "{Tags:[\"ehm.7_2\"]}" 298 | } 299 | } 300 | } 301 | } 302 | }, 303 | "drt_bit_8_0": { 304 | "trigger": "minecraft:entity_hurt_player", 305 | "conditions": { 306 | "damage": { 307 | "type": { 308 | "direct_entity": { 309 | "nbt": "{Tags:[\"ehm.8_0\"]}" 310 | } 311 | } 312 | } 313 | } 314 | }, 315 | "drt_bit_8_1": { 316 | "trigger": "minecraft:entity_hurt_player", 317 | "conditions": { 318 | "damage": { 319 | "type": { 320 | "direct_entity": { 321 | "nbt": "{Tags:[\"ehm.8_1\"]}" 322 | } 323 | } 324 | } 325 | } 326 | }, 327 | "drt_bit_8_2": { 328 | "trigger": "minecraft:entity_hurt_player", 329 | "conditions": { 330 | "damage": { 331 | "type": { 332 | "direct_entity": { 333 | "nbt": "{Tags:[\"ehm.8_2\"]}" 334 | } 335 | } 336 | } 337 | } 338 | } 339 | }, 340 | "requirements": [ 341 | [ 342 | "drt_bit_0_0", 343 | "drt_bit_0_1", 344 | "drt_bit_0_2", 345 | "direct_has_no_uid" 346 | ], 347 | [ 348 | "drt_bit_1_0", 349 | "drt_bit_1_1", 350 | "drt_bit_1_2", 351 | "direct_has_no_uid" 352 | ], 353 | [ 354 | "drt_bit_2_0", 355 | "drt_bit_2_1", 356 | "drt_bit_2_2", 357 | "direct_has_no_uid" 358 | ], 359 | [ 360 | "drt_bit_3_0", 361 | "drt_bit_3_1", 362 | "drt_bit_3_2", 363 | "direct_has_no_uid" 364 | ], 365 | [ 366 | "drt_bit_4_0", 367 | "drt_bit_4_1", 368 | "drt_bit_4_2", 369 | "direct_has_no_uid" 370 | ], 371 | [ 372 | "drt_bit_5_0", 373 | "drt_bit_5_1", 374 | "drt_bit_5_2", 375 | "direct_has_no_uid" 376 | ], 377 | [ 378 | "drt_bit_6_0", 379 | "drt_bit_6_1", 380 | "drt_bit_6_2", 381 | "direct_has_no_uid" 382 | ], 383 | [ 384 | "drt_bit_7_0", 385 | "drt_bit_7_1", 386 | "drt_bit_7_2", 387 | "direct_has_no_uid" 388 | ], 389 | [ 390 | "drt_bit_8_0", 391 | "drt_bit_8_1", 392 | "drt_bit_8_2", 393 | "direct_has_no_uid" 394 | ] 395 | ], 396 | "rewards": { 397 | "function": "hit_match:_advancement/_entity_hurt_player/reward/_" 398 | } 399 | } 400 | -------------------------------------------------------------------------------- /hit-match-dp/data/hit_match/advancement/player_hurt_entity.json: -------------------------------------------------------------------------------- 1 | { 2 | "criteria": { 3 | "direct_has_no_uid": { 4 | "trigger": "minecraft:player_hurt_entity", 5 | "conditions": { 6 | "damage": { 7 | "type": { 8 | "direct_entity": { 9 | "nbt": "{Tags:[\"ehm.no_uid\"]}" 10 | } 11 | } 12 | } 13 | } 14 | }, 15 | "victim_has_no_uid": { 16 | "trigger": "minecraft:player_hurt_entity", 17 | "conditions": { 18 | "entity": [ 19 | { 20 | "condition": "minecraft:inverted", 21 | "term": { 22 | "condition": "minecraft:reference", 23 | "name": "hit_match:has_uid" 24 | } 25 | } 26 | ] 27 | } 28 | }, 29 | "drt_bit_0_0": { 30 | "trigger": "minecraft:player_hurt_entity", 31 | "conditions": { 32 | "damage": { 33 | "type": { 34 | "direct_entity": { 35 | "nbt": "{Tags:[\"ehm.0_0\"]}" 36 | } 37 | } 38 | } 39 | } 40 | }, 41 | "drt_bit_0_1": { 42 | "trigger": "minecraft:player_hurt_entity", 43 | "conditions": { 44 | "damage": { 45 | "type": { 46 | "direct_entity": { 47 | "nbt": "{Tags:[\"ehm.0_1\"]}" 48 | } 49 | } 50 | } 51 | } 52 | }, 53 | "drt_bit_0_2": { 54 | "trigger": "minecraft:player_hurt_entity", 55 | "conditions": { 56 | "damage": { 57 | "type": { 58 | "direct_entity": { 59 | "nbt": "{Tags:[\"ehm.0_2\"]}" 60 | } 61 | } 62 | } 63 | } 64 | }, 65 | "drt_bit_1_0": { 66 | "trigger": "minecraft:player_hurt_entity", 67 | "conditions": { 68 | "damage": { 69 | "type": { 70 | "direct_entity": { 71 | "nbt": "{Tags:[\"ehm.1_0\"]}" 72 | } 73 | } 74 | } 75 | } 76 | }, 77 | "drt_bit_1_1": { 78 | "trigger": "minecraft:player_hurt_entity", 79 | "conditions": { 80 | "damage": { 81 | "type": { 82 | "direct_entity": { 83 | "nbt": "{Tags:[\"ehm.1_1\"]}" 84 | } 85 | } 86 | } 87 | } 88 | }, 89 | "drt_bit_1_2": { 90 | "trigger": "minecraft:player_hurt_entity", 91 | "conditions": { 92 | "damage": { 93 | "type": { 94 | "direct_entity": { 95 | "nbt": "{Tags:[\"ehm.1_2\"]}" 96 | } 97 | } 98 | } 99 | } 100 | }, 101 | "drt_bit_2_0": { 102 | "trigger": "minecraft:player_hurt_entity", 103 | "conditions": { 104 | "damage": { 105 | "type": { 106 | "direct_entity": { 107 | "nbt": "{Tags:[\"ehm.2_0\"]}" 108 | } 109 | } 110 | } 111 | } 112 | }, 113 | "drt_bit_2_1": { 114 | "trigger": "minecraft:player_hurt_entity", 115 | "conditions": { 116 | "damage": { 117 | "type": { 118 | "direct_entity": { 119 | "nbt": "{Tags:[\"ehm.2_1\"]}" 120 | } 121 | } 122 | } 123 | } 124 | }, 125 | "drt_bit_2_2": { 126 | "trigger": "minecraft:player_hurt_entity", 127 | "conditions": { 128 | "damage": { 129 | "type": { 130 | "direct_entity": { 131 | "nbt": "{Tags:[\"ehm.2_2\"]}" 132 | } 133 | } 134 | } 135 | } 136 | }, 137 | "drt_bit_3_0": { 138 | "trigger": "minecraft:player_hurt_entity", 139 | "conditions": { 140 | "damage": { 141 | "type": { 142 | "direct_entity": { 143 | "nbt": "{Tags:[\"ehm.3_0\"]}" 144 | } 145 | } 146 | } 147 | } 148 | }, 149 | "drt_bit_3_1": { 150 | "trigger": "minecraft:player_hurt_entity", 151 | "conditions": { 152 | "damage": { 153 | "type": { 154 | "direct_entity": { 155 | "nbt": "{Tags:[\"ehm.3_1\"]}" 156 | } 157 | } 158 | } 159 | } 160 | }, 161 | "drt_bit_3_2": { 162 | "trigger": "minecraft:player_hurt_entity", 163 | "conditions": { 164 | "damage": { 165 | "type": { 166 | "direct_entity": { 167 | "nbt": "{Tags:[\"ehm.3_2\"]}" 168 | } 169 | } 170 | } 171 | } 172 | }, 173 | "drt_bit_4_0": { 174 | "trigger": "minecraft:player_hurt_entity", 175 | "conditions": { 176 | "damage": { 177 | "type": { 178 | "direct_entity": { 179 | "nbt": "{Tags:[\"ehm.4_0\"]}" 180 | } 181 | } 182 | } 183 | } 184 | }, 185 | "drt_bit_4_1": { 186 | "trigger": "minecraft:player_hurt_entity", 187 | "conditions": { 188 | "damage": { 189 | "type": { 190 | "direct_entity": { 191 | "nbt": "{Tags:[\"ehm.4_1\"]}" 192 | } 193 | } 194 | } 195 | } 196 | }, 197 | "drt_bit_4_2": { 198 | "trigger": "minecraft:player_hurt_entity", 199 | "conditions": { 200 | "damage": { 201 | "type": { 202 | "direct_entity": { 203 | "nbt": "{Tags:[\"ehm.4_2\"]}" 204 | } 205 | } 206 | } 207 | } 208 | }, 209 | "drt_bit_5_0": { 210 | "trigger": "minecraft:player_hurt_entity", 211 | "conditions": { 212 | "damage": { 213 | "type": { 214 | "direct_entity": { 215 | "nbt": "{Tags:[\"ehm.5_0\"]}" 216 | } 217 | } 218 | } 219 | } 220 | }, 221 | "drt_bit_5_1": { 222 | "trigger": "minecraft:player_hurt_entity", 223 | "conditions": { 224 | "damage": { 225 | "type": { 226 | "direct_entity": { 227 | "nbt": "{Tags:[\"ehm.5_1\"]}" 228 | } 229 | } 230 | } 231 | } 232 | }, 233 | "drt_bit_5_2": { 234 | "trigger": "minecraft:player_hurt_entity", 235 | "conditions": { 236 | "damage": { 237 | "type": { 238 | "direct_entity": { 239 | "nbt": "{Tags:[\"ehm.5_2\"]}" 240 | } 241 | } 242 | } 243 | } 244 | }, 245 | "drt_bit_6_0": { 246 | "trigger": "minecraft:player_hurt_entity", 247 | "conditions": { 248 | "damage": { 249 | "type": { 250 | "direct_entity": { 251 | "nbt": "{Tags:[\"ehm.6_0\"]}" 252 | } 253 | } 254 | } 255 | } 256 | }, 257 | "drt_bit_6_1": { 258 | "trigger": "minecraft:player_hurt_entity", 259 | "conditions": { 260 | "damage": { 261 | "type": { 262 | "direct_entity": { 263 | "nbt": "{Tags:[\"ehm.6_1\"]}" 264 | } 265 | } 266 | } 267 | } 268 | }, 269 | "drt_bit_6_2": { 270 | "trigger": "minecraft:player_hurt_entity", 271 | "conditions": { 272 | "damage": { 273 | "type": { 274 | "direct_entity": { 275 | "nbt": "{Tags:[\"ehm.6_2\"]}" 276 | } 277 | } 278 | } 279 | } 280 | }, 281 | "drt_bit_7_0": { 282 | "trigger": "minecraft:player_hurt_entity", 283 | "conditions": { 284 | "damage": { 285 | "type": { 286 | "direct_entity": { 287 | "nbt": "{Tags:[\"ehm.7_0\"]}" 288 | } 289 | } 290 | } 291 | } 292 | }, 293 | "drt_bit_7_1": { 294 | "trigger": "minecraft:player_hurt_entity", 295 | "conditions": { 296 | "damage": { 297 | "type": { 298 | "direct_entity": { 299 | "nbt": "{Tags:[\"ehm.7_1\"]}" 300 | } 301 | } 302 | } 303 | } 304 | }, 305 | "drt_bit_7_2": { 306 | "trigger": "minecraft:player_hurt_entity", 307 | "conditions": { 308 | "damage": { 309 | "type": { 310 | "direct_entity": { 311 | "nbt": "{Tags:[\"ehm.7_2\"]}" 312 | } 313 | } 314 | } 315 | } 316 | }, 317 | "drt_bit_8_0": { 318 | "trigger": "minecraft:player_hurt_entity", 319 | "conditions": { 320 | "damage": { 321 | "type": { 322 | "direct_entity": { 323 | "nbt": "{Tags:[\"ehm.8_0\"]}" 324 | } 325 | } 326 | } 327 | } 328 | }, 329 | "drt_bit_8_1": { 330 | "trigger": "minecraft:player_hurt_entity", 331 | "conditions": { 332 | "damage": { 333 | "type": { 334 | "direct_entity": { 335 | "nbt": "{Tags:[\"ehm.8_1\"]}" 336 | } 337 | } 338 | } 339 | } 340 | }, 341 | "drt_bit_8_2": { 342 | "trigger": "minecraft:player_hurt_entity", 343 | "conditions": { 344 | "damage": { 345 | "type": { 346 | "direct_entity": { 347 | "nbt": "{Tags:[\"ehm.8_2\"]}" 348 | } 349 | } 350 | } 351 | } 352 | }, 353 | "vtm_bit_0_0": { 354 | "trigger": "minecraft:player_hurt_entity", 355 | "conditions": { 356 | "entity": [ 357 | { 358 | "condition": "minecraft:entity_scores", 359 | "entity": "this", 360 | "scores": { 361 | "ehm.id.0": 0 362 | } 363 | } 364 | ] 365 | } 366 | }, 367 | "vtm_bit_0_1": { 368 | "trigger": "minecraft:player_hurt_entity", 369 | "conditions": { 370 | "entity": [ 371 | { 372 | "condition": "minecraft:entity_scores", 373 | "entity": "this", 374 | "scores": { 375 | "ehm.id.0": 1 376 | } 377 | } 378 | ] 379 | } 380 | }, 381 | "vtm_bit_0_2": { 382 | "trigger": "minecraft:player_hurt_entity", 383 | "conditions": { 384 | "entity": [ 385 | { 386 | "condition": "minecraft:entity_scores", 387 | "entity": "this", 388 | "scores": { 389 | "ehm.id.0": 2 390 | } 391 | } 392 | ] 393 | } 394 | }, 395 | "vtm_bit_1_0": { 396 | "trigger": "minecraft:player_hurt_entity", 397 | "conditions": { 398 | "entity": [ 399 | { 400 | "condition": "minecraft:entity_scores", 401 | "entity": "this", 402 | "scores": { 403 | "ehm.id.1": 0 404 | } 405 | } 406 | ] 407 | } 408 | }, 409 | "vtm_bit_1_1": { 410 | "trigger": "minecraft:player_hurt_entity", 411 | "conditions": { 412 | "entity": [ 413 | { 414 | "condition": "minecraft:entity_scores", 415 | "entity": "this", 416 | "scores": { 417 | "ehm.id.1": 1 418 | } 419 | } 420 | ] 421 | } 422 | }, 423 | "vtm_bit_1_2": { 424 | "trigger": "minecraft:player_hurt_entity", 425 | "conditions": { 426 | "entity": [ 427 | { 428 | "condition": "minecraft:entity_scores", 429 | "entity": "this", 430 | "scores": { 431 | "ehm.id.1": 2 432 | } 433 | } 434 | ] 435 | } 436 | }, 437 | "vtm_bit_2_0": { 438 | "trigger": "minecraft:player_hurt_entity", 439 | "conditions": { 440 | "entity": [ 441 | { 442 | "condition": "minecraft:entity_scores", 443 | "entity": "this", 444 | "scores": { 445 | "ehm.id.2": 0 446 | } 447 | } 448 | ] 449 | } 450 | }, 451 | "vtm_bit_2_1": { 452 | "trigger": "minecraft:player_hurt_entity", 453 | "conditions": { 454 | "entity": [ 455 | { 456 | "condition": "minecraft:entity_scores", 457 | "entity": "this", 458 | "scores": { 459 | "ehm.id.2": 1 460 | } 461 | } 462 | ] 463 | } 464 | }, 465 | "vtm_bit_2_2": { 466 | "trigger": "minecraft:player_hurt_entity", 467 | "conditions": { 468 | "entity": [ 469 | { 470 | "condition": "minecraft:entity_scores", 471 | "entity": "this", 472 | "scores": { 473 | "ehm.id.2": 2 474 | } 475 | } 476 | ] 477 | } 478 | }, 479 | "vtm_bit_3_0": { 480 | "trigger": "minecraft:player_hurt_entity", 481 | "conditions": { 482 | "entity": [ 483 | { 484 | "condition": "minecraft:entity_scores", 485 | "entity": "this", 486 | "scores": { 487 | "ehm.id.3": 0 488 | } 489 | } 490 | ] 491 | } 492 | }, 493 | "vtm_bit_3_1": { 494 | "trigger": "minecraft:player_hurt_entity", 495 | "conditions": { 496 | "entity": [ 497 | { 498 | "condition": "minecraft:entity_scores", 499 | "entity": "this", 500 | "scores": { 501 | "ehm.id.3": 1 502 | } 503 | } 504 | ] 505 | } 506 | }, 507 | "vtm_bit_3_2": { 508 | "trigger": "minecraft:player_hurt_entity", 509 | "conditions": { 510 | "entity": [ 511 | { 512 | "condition": "minecraft:entity_scores", 513 | "entity": "this", 514 | "scores": { 515 | "ehm.id.3": 2 516 | } 517 | } 518 | ] 519 | } 520 | }, 521 | "vtm_bit_4_0": { 522 | "trigger": "minecraft:player_hurt_entity", 523 | "conditions": { 524 | "entity": [ 525 | { 526 | "condition": "minecraft:entity_scores", 527 | "entity": "this", 528 | "scores": { 529 | "ehm.id.4": 0 530 | } 531 | } 532 | ] 533 | } 534 | }, 535 | "vtm_bit_4_1": { 536 | "trigger": "minecraft:player_hurt_entity", 537 | "conditions": { 538 | "entity": [ 539 | { 540 | "condition": "minecraft:entity_scores", 541 | "entity": "this", 542 | "scores": { 543 | "ehm.id.4": 1 544 | } 545 | } 546 | ] 547 | } 548 | }, 549 | "vtm_bit_4_2": { 550 | "trigger": "minecraft:player_hurt_entity", 551 | "conditions": { 552 | "entity": [ 553 | { 554 | "condition": "minecraft:entity_scores", 555 | "entity": "this", 556 | "scores": { 557 | "ehm.id.4": 2 558 | } 559 | } 560 | ] 561 | } 562 | }, 563 | "vtm_bit_5_0": { 564 | "trigger": "minecraft:player_hurt_entity", 565 | "conditions": { 566 | "entity": [ 567 | { 568 | "condition": "minecraft:entity_scores", 569 | "entity": "this", 570 | "scores": { 571 | "ehm.id.5": 0 572 | } 573 | } 574 | ] 575 | } 576 | }, 577 | "vtm_bit_5_1": { 578 | "trigger": "minecraft:player_hurt_entity", 579 | "conditions": { 580 | "entity": [ 581 | { 582 | "condition": "minecraft:entity_scores", 583 | "entity": "this", 584 | "scores": { 585 | "ehm.id.5": 1 586 | } 587 | } 588 | ] 589 | } 590 | }, 591 | "vtm_bit_5_2": { 592 | "trigger": "minecraft:player_hurt_entity", 593 | "conditions": { 594 | "entity": [ 595 | { 596 | "condition": "minecraft:entity_scores", 597 | "entity": "this", 598 | "scores": { 599 | "ehm.id.5": 2 600 | } 601 | } 602 | ] 603 | } 604 | }, 605 | "vtm_bit_6_0": { 606 | "trigger": "minecraft:player_hurt_entity", 607 | "conditions": { 608 | "entity": [ 609 | { 610 | "condition": "minecraft:entity_scores", 611 | "entity": "this", 612 | "scores": { 613 | "ehm.id.6": 0 614 | } 615 | } 616 | ] 617 | } 618 | }, 619 | "vtm_bit_6_1": { 620 | "trigger": "minecraft:player_hurt_entity", 621 | "conditions": { 622 | "entity": [ 623 | { 624 | "condition": "minecraft:entity_scores", 625 | "entity": "this", 626 | "scores": { 627 | "ehm.id.6": 1 628 | } 629 | } 630 | ] 631 | } 632 | }, 633 | "vtm_bit_6_2": { 634 | "trigger": "minecraft:player_hurt_entity", 635 | "conditions": { 636 | "entity": [ 637 | { 638 | "condition": "minecraft:entity_scores", 639 | "entity": "this", 640 | "scores": { 641 | "ehm.id.6": 2 642 | } 643 | } 644 | ] 645 | } 646 | }, 647 | "vtm_bit_7_0": { 648 | "trigger": "minecraft:player_hurt_entity", 649 | "conditions": { 650 | "entity": [ 651 | { 652 | "condition": "minecraft:entity_scores", 653 | "entity": "this", 654 | "scores": { 655 | "ehm.id.7": 0 656 | } 657 | } 658 | ] 659 | } 660 | }, 661 | "vtm_bit_7_1": { 662 | "trigger": "minecraft:player_hurt_entity", 663 | "conditions": { 664 | "entity": [ 665 | { 666 | "condition": "minecraft:entity_scores", 667 | "entity": "this", 668 | "scores": { 669 | "ehm.id.7": 1 670 | } 671 | } 672 | ] 673 | } 674 | }, 675 | "vtm_bit_7_2": { 676 | "trigger": "minecraft:player_hurt_entity", 677 | "conditions": { 678 | "entity": [ 679 | { 680 | "condition": "minecraft:entity_scores", 681 | "entity": "this", 682 | "scores": { 683 | "ehm.id.7": 2 684 | } 685 | } 686 | ] 687 | } 688 | }, 689 | "vtm_bit_8_0": { 690 | "trigger": "minecraft:player_hurt_entity", 691 | "conditions": { 692 | "entity": [ 693 | { 694 | "condition": "minecraft:entity_scores", 695 | "entity": "this", 696 | "scores": { 697 | "ehm.id.8": 0 698 | } 699 | } 700 | ] 701 | } 702 | }, 703 | "vtm_bit_8_1": { 704 | "trigger": "minecraft:player_hurt_entity", 705 | "conditions": { 706 | "entity": [ 707 | { 708 | "condition": "minecraft:entity_scores", 709 | "entity": "this", 710 | "scores": { 711 | "ehm.id.8": 1 712 | } 713 | } 714 | ] 715 | } 716 | }, 717 | "vtm_bit_8_2": { 718 | "trigger": "minecraft:player_hurt_entity", 719 | "conditions": { 720 | "entity": [ 721 | { 722 | "condition": "minecraft:entity_scores", 723 | "entity": "this", 724 | "scores": { 725 | "ehm.id.8": 2 726 | } 727 | } 728 | ] 729 | } 730 | } 731 | }, 732 | "requirements": [ 733 | [ 734 | "drt_bit_0_0", 735 | "drt_bit_0_1", 736 | "drt_bit_0_2", 737 | "direct_has_no_uid" 738 | ], 739 | [ 740 | "drt_bit_1_0", 741 | "drt_bit_1_1", 742 | "drt_bit_1_2", 743 | "direct_has_no_uid" 744 | ], 745 | [ 746 | "drt_bit_2_0", 747 | "drt_bit_2_1", 748 | "drt_bit_2_2", 749 | "direct_has_no_uid" 750 | ], 751 | [ 752 | "drt_bit_3_0", 753 | "drt_bit_3_1", 754 | "drt_bit_3_2", 755 | "direct_has_no_uid" 756 | ], 757 | [ 758 | "drt_bit_4_0", 759 | "drt_bit_4_1", 760 | "drt_bit_4_2", 761 | "direct_has_no_uid" 762 | ], 763 | [ 764 | "drt_bit_5_0", 765 | "drt_bit_5_1", 766 | "drt_bit_5_2", 767 | "direct_has_no_uid" 768 | ], 769 | [ 770 | "drt_bit_6_0", 771 | "drt_bit_6_1", 772 | "drt_bit_6_2", 773 | "direct_has_no_uid" 774 | ], 775 | [ 776 | "drt_bit_7_0", 777 | "drt_bit_7_1", 778 | "drt_bit_7_2", 779 | "direct_has_no_uid" 780 | ], 781 | [ 782 | "drt_bit_8_0", 783 | "drt_bit_8_1", 784 | "drt_bit_8_2", 785 | "direct_has_no_uid" 786 | ], 787 | [ 788 | "vtm_bit_0_0", 789 | "vtm_bit_0_1", 790 | "vtm_bit_0_2", 791 | "victim_has_no_uid" 792 | ], 793 | [ 794 | "vtm_bit_1_0", 795 | "vtm_bit_1_1", 796 | "vtm_bit_1_2", 797 | "victim_has_no_uid" 798 | ], 799 | [ 800 | "vtm_bit_2_0", 801 | "vtm_bit_2_1", 802 | "vtm_bit_2_2", 803 | "victim_has_no_uid" 804 | ], 805 | [ 806 | "vtm_bit_3_0", 807 | "vtm_bit_3_1", 808 | "vtm_bit_3_2", 809 | "victim_has_no_uid" 810 | ], 811 | [ 812 | "vtm_bit_4_0", 813 | "vtm_bit_4_1", 814 | "vtm_bit_4_2", 815 | "victim_has_no_uid" 816 | ], 817 | [ 818 | "vtm_bit_5_0", 819 | "vtm_bit_5_1", 820 | "vtm_bit_5_2", 821 | "victim_has_no_uid" 822 | ], 823 | [ 824 | "vtm_bit_6_0", 825 | "vtm_bit_6_1", 826 | "vtm_bit_6_2", 827 | "victim_has_no_uid" 828 | ], 829 | [ 830 | "vtm_bit_7_0", 831 | "vtm_bit_7_1", 832 | "vtm_bit_7_2", 833 | "victim_has_no_uid" 834 | ], 835 | [ 836 | "vtm_bit_8_0", 837 | "vtm_bit_8_1", 838 | "vtm_bit_8_2", 839 | "victim_has_no_uid" 840 | ] 841 | ], 842 | "rewards": { 843 | "function": "hit_match:_advancement/_player_hurt_entity/reward/_" 844 | } 845 | } 846 | --------------------------------------------------------------------------------