華_资 发表于 2025-9-3 17:36:20

【1.21-1.21.1】时刻检测生物生命值变化的保姆级数据包教程(可白嫖)

准备工作:
在一个函数中输入以下指令添加到load.json中:
scoreboard objectives add a_hp dummy
scoreboard objectives add hurt dummy
scoreboard objectives add tick_1 dummy
scoreboard objectives add health dummy

static/image/hrline/line8.png


核心部分:
在一个函数(假设为A函数)中输入以下指令(顺序不可颠倒):
execute store result score @s health run data get entity @s Health
execute store result score @s hurt run scoreboard players operation @s a_hp -= @s health

scoreboard players reset @s tick_1


在一个函数中输入以下指令添加到tick.json中(顺序不可颠倒):
scoreboard players add @e tick_1 1
execute as @e store result score @s a_hp run data get entity @s Health

execute as @e run function (A函数的位置)

static/image/hrline/line8.png


食用方式:生物生命值变化量会储存在“hurt”计分板内,可直接调用,每2刻更新一次

static/image/hrline/line8.png


思路:在第一刻检测一次生物生命值,第二刻测一次,二者作差即可

static/image/hrline/line8.png


什么,你还是不会?真拿你没办法
版权公开,拿走不谢:(注:oh_hurt即为输出结果的计分板,直接使用)

页: [1]
查看完整版本: 【1.21-1.21.1】时刻检测生物生命值变化的保姆级数据包教程(可白嫖)