Yes, there is an NBT tag in Minecraft called HurtByTimestamp that can help you find the attack source in the game.

When an entity takes damage, its HurtByTimestamp tag is updated with the current game tick. By comparing this timestamp with the current game tick, you can determine if the entity was recently attacked and potentially find the source of the attack.

Here's an example of how you can use this NBT tag to find the attack source:

/execute as @e[type=minecraft:creeper] store result score @s attack_source run data get entity @s HurtByTimestamp
/execute as @e[type=minecraft:creeper,scores={attack_source=..20}] run say I was attacked within the last 20 ticks!

In this example, we are targeting all creepers (@e[type=minecraft:creeper]) and storing their HurtByTimestamp value in a scoreboard objective called attack_source. Then, we execute another command as the creepers with a scores condition that checks if their attack_source score is less than or equal to 20 (within the last 20 ticks). If the condition is met, we print a message indicating that the creeper was attacked recently.

You can modify this example to suit your specific needs and target different entities or adjust the timeframe for finding the attack source

any nbt that can find the attack source in minecraft

原文地址: https://www.cveoy.top/t/topic/h6kv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录