mojira.dev
MC-261395

When in mcfunction files, the /damage command does not trigger player_hurt_entity and player_killed_entity advancements the correct number of times

Datapacks that use the advancement player_hurt_entity or player_killed_entity in combination with the command:

execute as @e run damage @s <amount> [<damageType>] by <PLAYER_entity>

do not trigger those advancements the correct amount of times.

For example, a mcfunction file that contains the command:

execute as @e run damage @s 10000 minecraft:generic by @p

will trigger the player_killed_entity advancement only once, instead of X times (X = number of entities killed).

 

 

Steps to Reproduce:

 

  [Step 1]Download and load the datapack:

[media]

  [Step 2]Run either of these commands in game using the chatbox:

/function bug:perform/damage_entities
/function bug:perform/kill_entities

 

Observed Results:

 

If "/function bug:perform/damage_entities{}" is run, the scoreboard value [
$player_hurt_entity.count advancement_trigger_tracking] will increase by 1.

If "/function bug:perform/kill_entities{}" is run, the scoreboard value [
$player_killed_entity.count advancement_trigger_tracking] will increase by 1.

 

Expected Results:

 

If "/function bug:perform/damage_entities{}" is run, the scoreboard value [
$player_hurt_entity.count advancement_trigger_tracking] SHOULD increase by the number of entities hurt.

If "/function bug:perform/kill_entities{}" is run, the scoreboard value [
$player_killed_entity.count advancement_trigger_tracking] SHOULD increase by the number of entities killed.
 

Screenshots/Videos:

[media]

 

Notes:

 

The entity_hurt_player and entity_killed_player advancements work properly with the /damage command, and are included in the datapack as a comparison.

 

 

When running the command:

execute as @e run damage @s <value> minecraft:generic by @p

in game using the chatbox, the advancements will trigger the correct amount of times properly. 

 

 

While:

execute as @e run damage @s <value> [<damageType>] by @p

does not trigger advancements properly in a function file, the following command will work properly even when in a function file, triggering advancements the correct number of times:

execute as @e run function namespace:damage
#namespace:damage.mcfunction 
damage @s <value> [<damageType>] by @p

However, doing it like this causes large tps spikes. The overall issue may be related to how the /damage command is threaded.

Attachments

Comments 1

RedSyven

(Unassigned)

Confirmed

(Unassigned)

1.19.4

23w41a

Retrieved