The bug report regarding the post_attack
enchantment effect has been updated to clarify the core issue. The problem is not a malfunction of the attribute_to_user
property within an explode
effect, but rather a broader issue where the post_attack
effect does not trigger when an entity receives damage from any explosion.
While effects attributed to the player, such as those triggering execute on attacker
, and advancements like player_hurt_entity
function correctly with explosion damage, the post_attack
enchantment remains inert. This issue is consistent regardless of whether the enchantment is placed on the attacker's weapon or the victim's armor.
The effect fails to trigger from a variety of explosion sources, including TNT, Creeper explosions, Fireball explosions, and explosions generated by the explode
enchantment effect. It has been observed that direct hits from projectiles like fireballs can trigger the post_attack
effect, but the subsequent blast damage does not. This indicates a specific issue with how the post_attack
trigger processes damage originating from an explosion.
Here is the updated summary for the bug report:
The post_attack enchantment effect fails to trigger when an entity receives indirect damage, such as from an explosion. This issue occurs even when the "damage_type" within the explode effect's JSON is set to "minecraft:player_attack", "minecraft:explosion", or others, indicating that it is independent of the specific damage type configuration.
Conversely, other mechanics like the execute on attacker command and advancements such as player_hurt_entity correctly recognize the attacker and function properly with the same explosion damage.
This bug consistently occurs for both configurations: when the enchantment is on the attacker's weapon ("enchanted": "attacker") and when it is on the victim's armor ("enchanted": "victim").
Steps to Reproduce:
Define the following two enchantments:
A weapon enchantment that creates an explosion on attack. Set "attribute_to_user": true in the explode effect.
An armor enchantment with a post_attack effect that executes a function when the wearer is damaged ("enchanted": "victim"). The function should contain a simple command, such as displaying a message in chat.Equip a target entity (e.g., a Husk) with the armor that has the post_attack enchantment.
Using the weapon with the explosion effect, strike a block near the target to damage it with the resulting explosion.
Observed Results:
The target takes damage from the explosion, and other mechanics like advancements trigger correctly. However, the post_attack enchantment on the target's armor does not trigger, and its associated function does not execute. No message appears in the chat.
Expected Results:
When a target is damaged by a player-attributed explosion, the post_attack enchantment on its armor should trigger correctly, regardless of whether the damage is direct or indirect, and irrespective of the damage_type configuration. This should cause the specified function to execute and the corresponding message to be displayed in the chat.
When attribute_to_user is enabled, execute on attacker, advancements, and kill logs work correctly, but post_attack does not function.
Additionally, for non-Enchantment explosion-based attacks, such as fireballs launched by a player, post_attack works correctly.
Steps to Reproduce:
1.Define an Enchantment with explode Effects and post_attack (with enchanted set to victim).
enchantemnt: explode effects
{
"description": "explode",
"supported_items": "minecraft:stick",
"weight": 1,
"max_level": 1,
"min_cost": {
"base": 0,
"per_level_above_first": 0
},
"max_cost": {
"base": 0,
"per_level_above_first": 0
},
"anvil_cost": 0,
"slots": [
"mainhand"
],
"effects": {
"minecraft:hit_block": [
{
"effect": {
"type": "minecraft:explode",
"attribute_to_user": true,
"damage_type": "minecraft:player_attack",
"knockback_multiplier": 0.5,
"radius": 3,
"block_interaction": "none",
"small_particle": {
"type": "minecraft:explosion"
},
"large_particle": {
"type": "minecraft:explosion"
},
"block_particles": [],
"sound": {
"sound_id": "",
"range": 0
}
}
},
{
"effect": {
"type": "minecraft:run_function",
"function": "after_explode"
}
}
]
}
}
enchantment: post_attack
{
"description": "post_attack",
"supported_items": "minecraft:chainmail_chestplate",
"weight": 1,
"max_level": 1,
"min_cost": {
"base": 0,
"per_level_above_first": 0
},
"max_cost": {
"base": 0,
"per_level_above_first": 0
},
"anvil_cost": 0,
"slots": [
"armor"
],
"effects": {
"minecraft:post_attack": [
{
"effect": {
"type": "minecraft:run_function",
"function": "post_attack"
},
"enchanted": "victim",
"affected": "victim"
}
]
}
}
2.Trigger explode Effects.
3.post_attack does not function.
Expected Behavior
When the victim takes damage from the player-attributed explosion, the post_attack enchantment on the victim's armor should activate. The specified function (post_attack.mcfunction) should execute, causing the message "Hi from Post Attack (Enchantment)" to appear in the chat.
Actual Behavior
The post_attack enchantment does not activate when the victim is damaged by the explosion. The message "Hi from Post Attack (Enchantment)" does not appear in the chat.
Additional Information
Mechanics That Work Correctly:
execute on
(You can verify that execute on is working by executing the following command “execute on”)
execute as @e[type=husk] on attacker run say Hi from After Explode (Execute On)
advancement player_hurt_entity
(By defining the advancement “player_hurt_entity,” you can confirm that player_hurt_entity is functioning)
{
"criteria": {
"player_hurt": {
"trigger": "minecraft:player_hurt_entity",
"conditions": {
"damage": {
"type": {
"tags": [
{
"id": "minecraft:is_player_attack",
"expected": true
}
]
}
}
}
}
},
"rewards": {
"function": "player_hurt_entity"
}
}
#function player_hurt_entity
say Hi from Player Hurt Entity (Advancement)
Mechanisms that do not work:
enchantment post_attack
(It can be confirmed that the function contained in “post_attack” is not being executed.)
#function post_attack
say Hi from Post Attack (Enchantment) ←This does not activate
Attachments
Comments 0
No comments.