热门角色不仅是灵感来源,更是你的效率助手。通过精挑细选的角色提示词,你可以快速生成高质量内容、提升创作灵感,并找到最契合你需求的解决方案。让创作更轻松,让价值更直接!
我们根据不同用户需求,持续更新角色库,让你总能找到合适的灵感入口。
本提示词专为我的世界游戏开发者和教育工作者设计,能够根据用户需求生成高质量的指令方块脚本。通过智能分析游戏功能需求、目标实体类型和执行条件,自动构建完整的命令序列。该工具支持复杂游戏机制创建、任务自动化实现和游戏体验增强,具备深度逻辑推理能力和多场景适配性,能够处理从简单物品生成到复杂红石系统的各类指令需求,输出格式规范、注释清晰的可执行代码,大幅提升游戏开发和教学效率。
## 功能概述 设计一套“遗迹关卡”指令链:当玩家进入指定入口区域且持有“古钥”时,弹出入场解说;随后按时序启动陷阱,倒计时结束后自动开门并刷新“遗迹守卫”;当守卫被击败(区域内无守卫实体)时,系统自动结算并向达成条件的玩家发放“钥石”。方案采用分阶段状态与计时器控制,避免重复触发,兼容多人环境的基本使用。 建议版本:Java Edition 1.19+(1.20.x均可) ## 指令配置 - 命令方块类型: - 初始化方块:脉冲(一次性执行) - 主检测逻辑:循环(始终激活) - 阶段执行链:连锁(条件执行) - 计时与胜利检测:循环+连锁 - 红石控制需求:不需要(全部设置为始终激活/条件连锁) - 执行优先级:中(三组循环方块,配合状态分支,性能安全) ## 核心指令 ```mcfunction # ========================= # 初始化(脉冲,一次性执行) # 放置并执行一次 # ========================= scoreboard objectives add ruins_state dummy # 玩家关卡状态:0未激活,1解说,2陷阱中,3开门刷新守卫中,4守卫存活,5已结算 scoreboard objectives add ruins_timer dummy # 玩家阶段计时器(tick) # ========================= # 主检测链(循环 + 连锁) # 循环方块1:始终激活(无条件) # 其后所有连锁方块:设为“条件”以利用上一条成功判断 # ========================= # [R] 清理临时标签,每tick重置 tag @a remove ruins_haskey # [C] 在入口区域内,手持主手古钥则标记 # 入口区域起点坐标和尺寸请替换:x=<ENTR_X>, y=<ENTR_Y>, z=<ENTR_Z>, dx=<ENTR_DX>, dy=<ENTR_DY>, dz=<ENTR_DZ> execute as @a[x=<ENTR_X>,y=<ENTR_Y>,z=<ENTR_Z>,dx=<ENTR_DX>,dy=<ENTR_DY>,dz=<ENTR_DZ>] if entity @s[nbt={SelectedItem:{id:"minecraft:tripwire_hook",tag:{RuinsKey:1b}}}] run tag @s add ruins_haskey # [C] 在入口区域内,背包任意槽含古钥也标记(兼容不在主手的情况) execute as @a[x=<ENTR_X>,y=<ENTR_Y>,z=<ENTR_Z>,dx=<ENTR_DX>,dy=<ENTR_DY>,dz=<ENTR_DZ>] if entity @s[nbt={Inventory:[{id:"minecraft:tripwire_hook",tag:{RuinsKey:1b}}]}] run tag @s add ruins_haskey # [C] 首次进入条件达成的玩家激活关卡标签 execute as @a[tag=ruins_haskey] unless entity @s[tag=ruins_active] run tag @s add ruins_active # [C] 初始状态的激活玩家,设置状态=1(入场解说) execute as @a[tag=ruins_active,scores={ruins_state=0}] run scoreboard players set @s ruins_state 1 # [C] 阶段1:入场弹窗与音效(只对状态=1的玩家执行) execute as @a[tag=ruins_active,scores={ruins_state=1}] run title @s title {"text":"遗迹探索:序幕","color":"gold","bold":true} execute as @a[tag=ruins_active,scores={ruins_state=1}] run title @s subtitle {"text":"小心前方机关,击败守卫领取钥石","color":"yellow"} execute as @a[tag=ruins_active,scores={ruins_state=1}] run playsound minecraft:block.note_block.pling master @s ~ ~ ~ 1 1 # [C] 切换到阶段2(陷阱启动),并将个人计时器置0 execute as @a[tag=ruins_active,scores={ruins_state=1}] run scoreboard players set @s ruins_state 2 execute as @a[tag=ruins_active,scores={ruins_state=2}] run scoreboard players set @s ruins_timer 0 # [C] 启动陷阱(将指定坐标置为红石块供红石/发射器等使用) # 多个陷阱触发点示例:请按需要增删行 execute if entity @a[tag=ruins_active,scores={ruins_state=2}] run setblock <TRAP1_X> <TRAP1_Y> <TRAP1_Z> minecraft:redstone_block execute if entity @a[tag=ruins_active,scores={ruins_state=2}] run setblock <TRAP2_X> <TRAP2_Y> <TRAP2_Z> minecraft:redstone_block # 如使用红石线/中继器自行布线,红石块维持至倒计时结束 # ========================= # 陷阱计时与开门、守卫刷新(循环 + 连锁) # 循环方块2:始终激活 # 其后连锁方块设为“条件” # ========================= # [R] 阶段2计时:每tick为状态=2的玩家计时器+1 execute as @a[tag=ruins_active,scores={ruins_state=2}] run scoreboard players add @s ruins_timer 1 # [C] 当计时器达到门控阈值(示例100tick≈5秒)进入阶段3 execute as @a[tag=ruins_active,scores={ruins_state=2,ruins_timer=100..}] run scoreboard players set @s ruins_state 3 # [C] 关闭陷阱电源(移除红石块) execute if entity @a[tag=ruins_active,scores={ruins_state=3}] run setblock <TRAP1_X> <TRAP1_Y> <TRAP1_Z> air execute if entity @a[tag=ruins_active,scores={ruins_state=3}] run setblock <TRAP2_X> <TRAP2_Y> <TRAP2_Z> air # [C] 开门(将门/栅栏/封堵方块替换为空气;如需仅替换指定方块,可加上replace) # 例:fill 范围开门 execute if entity @a[tag=ruins_active,scores={ruins_state=3}] run fill <DOOR_X1> <DOOR_Y1> <DOOR_Z1> <DOOR_X2> <DOOR_Y2> <DOOR_Z2> minecraft:air # [C] 刷新遗迹守卫(示例3名卫斧卫道;位置为刷新点中心,按需增删) # 注意:加入标签"ruins_guard"便于胜利检测 execute if entity @a[tag=ruins_active,scores={ruins_state=3}] positioned <GUARD_X> <GUARD_Y> <GUARD_Z> run summon minecraft:vindicator ~ ~ ~ {CustomName:'{"text":"遗迹守卫"}',Tags:["ruins_guard"],PersistenceRequired:1b,HandItems:[{id:"minecraft:iron_axe",Count:1b},{}]} execute if entity @a[tag=ruins_active,scores={ruins_state=3}] positioned <GUARD_X> <GUARD_Y> <GUARD_Z> run summon minecraft:vindicator ~ ~ ~ {CustomName:'{"text":"遗迹守卫"}',Tags:["ruins_guard"],PersistenceRequired:1b,HandItems:[{id:"minecraft:iron_axe",Count:1b},{}]} execute if entity @a[tag=ruins_active,scores={ruins_state=3}] positioned <GUARD_X> <GUARD_Y> <GUARD_Z> run summon minecraft:vindicator ~ ~ ~ {CustomName:'{"text":"遗迹守卫"}',Tags:["ruins_guard"],PersistenceRequired:1b,HandItems:[{id:"minecraft:iron_axe",Count:1b},{}]} # [C] 进入阶段4(守卫存活阶段) execute as @a[tag=ruins_active,scores={ruins_state=3}] run scoreboard players set @s ruins_state 4 # ========================= # 胜利检测与结算发奖(循环 + 连锁) # 循环方块3:始终激活 # 其后连锁方块设为“条件” # ========================= # [R] 胜利条件:状态=4的玩家周围无守卫(以刷新点为参照或以玩家为参照) # 这里以“玩家视角”检测:在玩家位置半径R内无守卫即胜利;R请替换 execute as @a[tag=ruins_active,scores={ruins_state=4}] at @s unless entity @e[tag=ruins_guard,distance=.. <RADIUS>] run scoreboard players set @s ruins_state 5 # [C] 发放奖励“钥石”,并弹出结算提示(仅对状态=5的玩家) execute as @a[tag=ruins_active,scores={ruins_state=5}] run give @s minecraft:nether_star{Keystone:1b,display:{Name:'{"text":"钥石","color":"aqua","bold":true}'}} 1 execute as @a[tag=ruins_active,scores={ruins_state=5}] run title @s title {"text":"挑战成功!","color":"green","bold":true} execute as @a[tag=ruins_active,scores={ruins_state=5}] run title @s subtitle {"text":"已发放:钥石","color":"white"} # [C] 清理玩家状态,允许后续重复游玩(或根据需要改为一次性) execute as @a[tag=ruins_active,scores={ruins_state=5}] run scoreboard players reset @s ruins_state execute as @a[tag=ruins_active,scores={ruins_state=5}] run scoreboard players reset @s ruins_timer execute as @a[tag=ruins_active,scores={ruins_state=5}] run tag @s remove ruins_active ``` ## 参数说明 - 入口区域参数 - ENTR_X/ENTR_Y/ENTR_Z:入口检测区域的起始坐标(最小角) - ENTR_DX/ENTR_DY/ENTR_DZ:区域尺寸(x宽、y高、z深),与起始坐标共同确定AABB - 古钥判定 - 使用tripwire_hook作为载体,需带自定义NBT:tag:{RuinsKey:1b} - 检测同时支持主手 SelectedItem 和 Inventory 任意槽 - 陷阱触发点 - TRAP*_X/Y/Z:在这些坐标处临时放置红石块,用于为预先布好的红石/发射器/命令链供电 - 开门区域 - DOOR_X1/Y1/Z1 ~ DOOR_X2/Y2/Z2:填充为空气的门体范围;如需只替换特定方块,可改为 fill ... air replace minecraft:iron_bars(或你实际用作门的方块) - 守卫刷新点 - GUARD_X/Y/Z:守卫生成的中心位置;可按需要增加或替换为不同Mob - 守卫带有 Tags:["ruins_guard"] 以便胜利检测 - 胜利检测半径 - RADIUS:玩家位置为中心的检测半径;当该半径内无tag=ruins_guard实体时视为击败守卫 - 关卡状态(score ruins_state) - 0 未激活;1 入场解说;2 陷阱中(计时);3 开门+刷新守卫;4 守卫存活;5 结算发奖 - 计时器(score ruins_timer) - 阶段2中每tick递增,用于决定陷阱持续时间与开门时机;示例为100tick≈5秒,可调整 ## 使用说明 1. 准备物品 - 古钥:/give @p minecraft:tripwire_hook{RuinsKey:1b,display:{Name:'{"text":"古钥","color":"gold","bold":true}'}} 1 - 钥石奖励已在脚本中为nether_star带标签Keystone:1b,可按需要改材质或自定义模型。 2. 布置命令方块 - 安装1个“初始化”脉冲命令方块(需要红石,触发一次)执行初始化两条scoreboard命令。 - 安装3组“循环命令方块”(始终激活),每组后挂一条或多条“连锁命令方块”,并将这些连锁方块设置为“条件”。 - 组1:主检测链(从“清理临时标签”开始,到“陷阱启动”结束) - 组2:陷阱计时与开门/刷新守卫 - 组3:胜利检测与结算发奖 - 将占位坐标替换为你的实际坐标(入口、陷阱、门、守卫)。 3. 红石与场景 - 在TRAP坐标附近布置发射器/红石线路,由红石块供电触发。倒计时结束后脚本会自动将红石块恢复为空气。 - 门的方块可选择铁栅栏、石砖墙等,应与fill命令匹配。 4. 调试与优化 - 首次测试建议仅保留一个TRAP触发点与1名守卫,确认流程后再扩展。 - 若多人同时进入,以上方案为“各玩家独立状态”。如需“全局一次性事件”,可改为使用假玩家scoreboard(例如scoreboard players set $ruins flags ...)记录全局阶段,并在执行时用limit=1限制执行者。 - 胜利判定半径RADIUS根据场景大小调整,避免远处残余守卫导致无法结算。 5. 安全与性能 - 全流程仅3个循环方块,状态与条件分支避免无意义执行,性能安全。 - 不包含作弊类增益,不会破坏游戏平衡。 - 避免设计无限刷怪;守卫刷新发生在阶段3且不循环。 如需我将坐标、方块类型和陷阱/门机制替换为你的具体场地,请提供实际坐标与方块清单,我会为你生成已填好的完整脚本。
## 功能概述 实现一个“每日任务系统”,按日统计玩家登录与击杀得分,自动在每日20:00(游戏内日间时间 daytime=20000)结算,全服排名并发放奖励;包含挂机检测(超时挂机不计分)与在线时长条件(当日在线≥10分钟才参与结算)。 设计要点: - 当天首次登录获得登录积分 - 击杀积分仅在玩家非AFK时累加 - AFK判定基于每秒移动统计,超过阈值自动标记为AFK - 每日20:00结算:筛选当日在线≥10分钟的玩家,按积分排名并发奖,随后重置当日数据 - 指令以每秒执行的逻辑为主,减少性能负担,兼容多人 建议版本:Java版 1.20+(使用 execute store、scoreboard 新语法与 minecraft.custom 统计项) ## 指令配置 - 命令方块类型:循环(主时钟与每秒更新)+ 连锁(条件链执行) - 红石控制需求:不需要(全部设置为“始终活动”) - 执行优先级:高(主时钟块置于加载区块的高优先级位置,如出生点区块) ## 核心指令 ```mcfunction # ========= 一次性初始化(在聊天栏或单次脉冲命令方块执行) ========= # 记分板目标(当日积分、登录标记、杀敌统计等) scoreboard objectives add pts dummy "每日积分" scoreboard objectives add lg dummy "今日登录标记" scoreboard objectives add pk minecraft.custom:minecraft.player_kills scoreboard objectives add kill_prev dummy scoreboard objectives add kill_delta dummy scoreboard objectives add tmp dummy # 当日在线与活跃/挂机统计(秒) scoreboard objectives add online_s dummy "当日在线秒" scoreboard objectives add active_s dummy "当日活跃秒" scoreboard objectives add afk_s dummy "AFK累计秒" # 移动统计(来自 minecraft.custom 的厘米计数) scoreboard objectives add mv_walk minecraft.custom:minecraft.walk_one_cm scoreboard objectives add mv_sprint minecraft.custom:minecraft.sprint_one_cm scoreboard objectives add mv_swim minecraft.custom:minecraft.swim_one_cm scoreboard objectives add mv_fly minecraft.custom:minecraft.fly_one_cm scoreboard objectives add mv_climb minecraft.custom:minecraft.climb_one_cm scoreboard objectives add mv_boat minecraft.custom:minecraft.boat_one_cm scoreboard objectives add mv_minecart minecraft.custom:minecraft.minecart_one_cm scoreboard objectives add mv_horse minecraft.custom:minecraft.horse_one_cm scoreboard objectives add mv_pig minecraft.custom:minecraft.pig_one_cm scoreboard objectives add mv_strider minecraft.custom:minecraft.strider_one_cm scoreboard objectives add move dummy scoreboard objectives add move_prev dummy scoreboard objectives add move_delta dummy # 计时与结算锁 scoreboard objectives add sec dummy "每秒节拍" scoreboard objectives add clock dummy "白天时间" scoreboard objectives add lock dummy "结算锁" scoreboard objectives add flag dummy "条件触发标志" # 常量仓(权重、阈值) scoreboard objectives add const dummy "常量" # 常量设置:可根据需要调整 scoreboard players set #LOGIN_POINTS const 10 # 每日首次登录积分 scoreboard players set #KILL_POINTS const 5 # 每次有效击杀积分 scoreboard players set #AFK_THRESHOLD const 60 # AFK阈值(秒),超过则判定AFK scoreboard players set #REWARD_XP_TOP1 const 200 # 结算奖励:经验(示例) scoreboard players set #REWARD_XP_TOP2 const 100 scoreboard players set #REWARD_XP_TOP3 const 50 scoreboard players set #REWARD_XP_OTH const 10 scoreboard players set #ONLINE_NEED const 600 # 参赛所需当日在线秒=600秒=10分钟 # 初始锁与计时器 scoreboard players set #t sec 0 scoreboard players set #lock lock 0 # ========= 主时钟循环(命令方块1:循环,始终活动) ========= # A1: 每tick存储白天时间到clock execute store result score #dt clock run time query daytime # A2: 若当前不是结算刻(20000),解锁结算锁 execute unless score #dt clock matches 20000 run scoreboard players set #lock lock 0 # A3: 每tick更新“每秒节拍”(20tick=1秒) scoreboard players add #t sec 1 execute if score #t sec matches 20.. run scoreboard players set #t sec 0 # ========= 每秒逻辑链(命令方块2~N:连锁,条件=上一步成功) ========= # B0: 仅当 #t sec 为0(刚重置)时继续整条链 execute if score #t sec matches 0 run scoreboard players set #ok flag 1 # B1: 统计当秒所有玩家的“当日在线秒” execute as @a run scoreboard players add @s online_s 1 # B2: 汇总移动统计为 move(厘米总量) execute as @a run scoreboard players operation @s move = @s mv_walk execute as @a run scoreboard players operation @s move += @s mv_sprint execute as @a run scoreboard players operation @s move += @s mv_swim execute as @a run scoreboard players operation @s move += @s mv_fly execute as @a run scoreboard players operation @s move += @s mv_climb execute as @a run scoreboard players operation @s move += @s mv_boat execute as @a run scoreboard players operation @s move += @s mv_minecart execute as @a run scoreboard players operation @s move += @s mv_horse execute as @a run scoreboard players operation @s move += @s mv_pig execute as @a run scoreboard players operation @s move += @s mv_strider # B3: 当秒移动差值 = move - move_prev (>0视为活跃) execute as @a run scoreboard players operation @s move_delta = @s move execute as @a run scoreboard players operation @s move_delta -= @s move_prev # B4: 移动差>0则视为非AFK,重置afk_s,并+1活跃秒;否则afk_s+1 # 非AFK分支 execute as @a if score @s move_delta matches 1.. run scoreboard players set @s afk_s 0 execute as @a if score @s move_delta matches 1.. run scoreboard players add @s active_s 1 # AFK累计分支 execute as @a unless score @s move_delta matches 1.. run scoreboard players add @s afk_s 1 # B5: 超过AFK阈值则打上afk标签;一旦活跃则去除afk标签 tag @a remove afk execute as @a if score @s afk_s >= #AFK_THRESHOLD const run tag @s add afk # B6: 首次登录积分(当天仅发一次) # 条件:lg==0 的玩家获得登录积分,并将 lg 置为 1 execute as @a if score @s lg matches 0 run scoreboard players operation @s pts += #LOGIN_POINTS const execute as @a if score @s lg matches 0 run scoreboard players set @s lg 1 # B7: 计算击杀差值并按权重计入积分(仅非AFK) execute as @a run scoreboard players operation @s kill_delta = @s pk execute as @a run scoreboard players operation @s kill_delta -= @s kill_prev # 仅对 kill_delta>0 且未AFK的玩家加分: pts += kill_delta * KILL_POINTS execute as @a[tag=!afk] if score @s kill_delta matches 1.. run scoreboard players operation @s tmp = @s kill_delta execute as @a[tag=!afk] if score @s kill_delta matches 1.. run scoreboard players operation @s tmp *= #KILL_POINTS const execute as @a[tag=!afk] if score @s kill_delta matches 1.. run scoreboard players operation @s pts += @s tmp # 更新上一击杀计数 execute as @a run scoreboard players operation @s kill_prev = @s pk # B8: 滚动更新 move_prev execute as @a run scoreboard players operation @s move_prev = @s move # ========= 每日结算触发链(命令方块N+:连锁,条件=上一步成功) ========= # C0: 当 daytime==20000 且 lock==0 时,置触发标志 -> 后续链执行一次 execute if score #dt clock matches 20000 if score #lock lock matches 0 run scoreboard players set #do flag 1 # C1: 若触发标志存在,则立即锁定(防重复) execute if score #do flag matches 1.. run scoreboard players set #lock lock 1 # C2: 选出参赛玩家(当日在线≥10分钟=600秒) # 先清理标签 tag @a remove eligible tag @a remove top1 tag @a remove top2 tag @a remove top3 # 打上eligible标签 execute as @a if score @s online_s >= #ONLINE_NEED const run tag @s add eligible # C3: 计算第一名(允许并列) # 先将 #top1score 设为极小 scoreboard players set #top1 const -999999 # 扫描eligible玩家,滚动维护最大值 execute as @a[tag=eligible] if score @s pts > #top1 const run scoreboard players operation #top1 const = @s pts # 将等于最大值的eligible玩家标记为top1 execute as @a[tag=eligible] if score @s pts = #top1 const run tag @s add top1 # 从eligible中移除top1,准备计算第二名 tag @a[tag=eligible,tag=top1] remove eligible # C4: 计算第二名 scoreboard players set #top2 const -999999 execute as @a[tag=eligible] if score @s pts > #top2 const run scoreboard players operation #top2 const = @s pts execute as @a[tag=eligible] if score @s pts = #top2 const run tag @s add top2 tag @a[tag=eligible,tag=top2] remove eligible # C5: 计算第三名 scoreboard players set #top3 const -999999 execute as @a[tag=eligible] if score @s pts > #top3 const run scoreboard players operation #top3 const = @s pts execute as @a[tag=eligible] if score @s pts = #top3 const run tag @s add top3 # C6: 发放奖励(示例:经验值 + 物品) # 注意:请根据服务器平衡自行调整奖励内容 # 第一名奖励 execute as @a[tag=top1] run xp add @s #REWARD_XP_TOP1 const points execute as @a[tag=top1] run give @s diamond 3 # 第二名奖励 execute as @a[tag=top2] run xp add @s #REWARD_XP_TOP2 const points execute as @a[tag=top2] run give @s diamond 2 # 第三名奖励 execute as @a[tag=top3] run xp add @s #REWARD_XP_TOP3 const points execute as @a[tag=top3] run give @s diamond 1 # 其他完成在线门槛但未进前三的玩家,发基础奖励 execute as @a[tag=eligible,tag=!top1,tag=!top2,tag=!top3] run xp add @s #REWARD_XP_OTH const points # C7: 公告(含并列情况) tellraw @a {"text":"[每日任务] 结算完成!恭喜获奖玩家:","color":"gold"} tellraw @a {"text":"• 第一名:","color":"yellow","extra":[{"selector":"@a[tag=top1]"}]} tellraw @a {"text":"• 第二名:","color":"yellow","extra":[{"selector":"@a[tag=top2]"}]} tellraw @a {"text":"• 第三名:","color":"yellow","extra":[{"selector":"@a[tag=top3]"}]} # C8: 重置当日数据(次日重新累积) # 清除标签 tag @a remove eligible tag @a remove top1 tag @a remove top2 tag @a remove top3 tag @a remove afk # 置零记分项(保留pk累计以便计算差值) scoreboard players set @a pts 0 scoreboard players set @a lg 0 scoreboard players set @a online_s 0 scoreboard players set @a active_s 0 scoreboard players set @a afk_s 0 scoreboard players set @a move_prev 0 scoreboard players set @a move_delta 0 scoreboard players set @a kill_delta 0 # 结算标志复位 scoreboard players set #do flag 0 ``` ## 参数说明 - 记分板与常量 - pts:玩家当日积分(登录与有效击杀累加) - lg:当日登录标记(0=未领取登录积分,1=已领取) - pk:总玩家击杀次数(minecraft.custom:minecraft.player_kills) - kill_prev/kill_delta:用于计算当日新增击杀数(差值) - online_s:当日在线秒数(每秒+1) - active_s:当日活跃秒(每秒移动则+1) - afk_s:AFK累计秒(每秒无移动则+1;达到阈值判定为AFK) - move / move_prev / move_delta:当秒移动总量与差值(厘米) - clock:存储 time query daytime 的结果(0~23999) - lock:结算锁(避免一天内重复结算) - const:常量仓(LOGIN_POINTS、KILL_POINTS、AFK_THRESHOLD、ONLINE_NEED 等) - 选择器标签 - afk:标记玩家为AFK(达到 AFK_THRESHOLD 秒无移动) - eligible:符合在线≥10分钟的参赛玩家 - top1/top2/top3:结算时的前三名(支持并列) - 可调整变量 - #LOGIN_POINTS:每日首次登录积分(默认10) - #KILL_POINTS:每次有效击杀积分(默认5) - #AFK_THRESHOLD:AFK判定秒数(默认60秒) - #ONLINE_NEED:结算门槛(默认600秒=10分钟) - 奖励内容(经验与物品):根据服务器平衡自由调整 ## 使用说明 1. 安装步骤 - 在出生点或常加载区块放置命令方块: - 命令方块A:循环、始终活动;输入“主时钟循环”中 A1~A3 三条指令与接续的每秒逻辑和结算链,按顺序串成“连锁命令方块”(从上到下依次,除第一个为循环外,其余均为“连锁-条件”)。 - 先执行“一次性初始化”指令块,或将其放在脉冲命令方块并激活一次。 - 确保 gamerule doDaylightCycle 为 true(默认),以便 daytime 正常推进;若需与现实20:00对应,仅能通过服务端外部调度或数据包/插件实现,纯命令无法读取真实时间。本方案按游戏内每天 20:00(daytime=20000)结算。 2. 使用注意 - AFK判定基于移动统计(厘米)。如玩家仅旋转视角或聊天可能被视为AFK,可适当降低 #AFK_THRESHOLD 或增加更多移动来源(如骑乘等已包含)。 - 登录积分策略:结算重置后,在线玩家也会在次秒获得“当日首次登录”积分,视为“进入新的一天”。若需严格“重新加入服务器”才给分,需配合进出事件检测(原版命令无法直接获知玩家连接事件)。 - 排名支持并列;并列会全部发放对应档位奖励。若需打破并列,可在奖励前对并列组做随机筛选或增加次级指标(需要更复杂的指令链)。 - 性能优化:重计算移动总量与AFK判定仅每秒执行一次,适用于中等规模服务器。若在线人数特别多,建议减少统计项或改用数据包函数管理。 3. 版本兼容 - 以上命令使用 1.13+ 新语法与 1.20+ execute store;若为更旧版本请调整 scoreboard 目标与 execute 语法。 4. 测试建议 - 先将 #ONLINE_NEED 调小(如60秒)快速验证结算与排名逻辑;观察 AFK 标记变化与积分是否正确累加。 - 在非生产环境测试奖励内容,确保不破坏游戏平衡。
## 功能概述 实现“课堂测验流程”:玩家按下答题按钮后立即判分,发送提示与反馈;答对的玩家被传送到实验区开始操作。方案采用就近玩家绑定、记分板判定与标签防重复传送的机制,支持多人同时答题,避免串扰与重复执行。 设计要点: - 每个选项按钮后接一组命令方块链,按下按钮即将“最近玩家”标记并记录其所选答案。 - 使用记分板比较玩家作答与题目正确选项,分别给出正确/错误反馈。 - 合格玩家仅传送一次(标签防重复),未合格玩家获得提示与音效反馈。 - 执行条件以记分板变量“quiz_cond”为门控,便于根据你的#{execution_condition}进行外部赋值控制。 兼容范围:Java版 1.13+(使用新版 /execute 语法) ## 指令配置 - 命令方块类型:按钮后为脉冲(需要红石),其后为连锁(始终有效),不使用循环 - 红石控制需求:脉冲方块需要红石(按钮信号),连锁方块不需要 - 执行优先级:高(玩家交互即刻响应) ## 核心指令 ```mcfunction # ====== 一次性初始化(在后台或管理区执行) ====== # 记分板目标 scoreboard objectives add quiz_answer dummy # 玩家选择的答案编号(1/2/3/4) scoreboard objectives add quiz_status dummy # 判定状态:1=正确,-1=错误,0/未设置=未判定 scoreboard objectives add quiz_attempts dummy # 尝试次数统计 scoreboard objectives add quiz_cond dummy # 执行条件开关:1=允许执行(由你的 #{execution_condition} 外部设定) scoreboard objectives add quiz_key dummy # 用于存储题目的正确答案编号(虚拟玩家持有) # 设置题目1的正确答案(示例:选项2为正确) scoreboard players set Q1_KEY quiz_key 2 # 允许参与答题的玩家标记(示例,根据你实际课堂区域或名单设定) # 例如:将教室区域内玩家标记为 quizReady(请替换坐标与范围) # tag @a[x=0,y=64,z=0,dx=20,dy=10,dz=20] add quizReady # ====== 按钮A(选项1)后方命令方块链 ====== # [方块1] 脉冲命令方块(需要红石,按钮直接驱动) # 绑定最近玩家(半径4格)、检查执行条件,打上“本次触发”标记 execute as @p[distance=..4,tag=quizReady] if score @s quiz_cond matches 1 run tag @s add quiz_recent # [方块2] 连锁命令方块(始终有效) # 记录该玩家所选答案为 1 execute as @a[tag=quiz_recent] run scoreboard players set @s quiz_answer 1 # [方块3] 连锁 # 增加尝试次数 execute as @a[tag=quiz_recent] run scoreboard players add @s quiz_attempts 1 # [方块4] 连锁 # 判断是否正确,正确则写入状态=1 execute as @a[tag=quiz_recent] if score @s quiz_answer = Q1_KEY quiz_key run scoreboard players set @s quiz_status 1 # [方块5] 连锁 # 判断是否错误,错误则写入状态=-1 execute as @a[tag=quiz_recent] unless score @s quiz_answer = Q1_KEY quiz_key run scoreboard players set @s quiz_status -1 # [方块6] 连锁 # 正确反馈(大标题) execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 run title @s title {"text":"答案正确!前往实验区开始操作","color":"green","bold":true} # [方块7] 连锁 # 正确音效 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 run playsound minecraft:entity.player.levelup master @s ~ ~ ~ 1 1 # [方块8] 连锁 # 正确传送(仅一次,如果尚未传送过) # 请将下方坐标替换为实验区传送点,例如 100 64 100 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 unless entity @s[tag=quizTeleported] run tp @s 100 64 100 # [方块9] 连锁 # 标记已传送,防重复 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 unless entity @s[tag=quizTeleported] run tag @s add quizTeleported # [方块10] 连锁 # 错误反馈(大标题) execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run title @s title {"text":"答错啦!","color":"red","bold":true} # [方块11] 连锁 # 错误提示(示例提示语,请根据课程内容修改) execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run tellraw @s [{"text":"提示:","color":"yellow"},{"text":"请回忆实验步骤中的关键概念(例如单位换算)。","color":"gold"}] # [方块12] 连锁 # 错误音效 execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run playsound minecraft:block.note_block.bass master @s ~ ~ ~ 1 0.7 # [方块13] 连锁 # 清理本次触发标记 execute as @a[tag=quiz_recent] run tag @s remove quiz_recent # ====== 按钮B(选项2)后方命令方块链 ====== # [方块1] 脉冲(需要红石) execute as @p[distance=..4,tag=quizReady] if score @s quiz_cond matches 1 run tag @s add quiz_recent # [方块2] ~ [方块13] 与上面一致,但将“记录所选答案”改为 2 execute as @a[tag=quiz_recent] run scoreboard players set @s quiz_answer 2 execute as @a[tag=quiz_recent] run scoreboard players add @s quiz_attempts 1 execute as @a[tag=quiz_recent] if score @s quiz_answer = Q1_KEY quiz_key run scoreboard players set @s quiz_status 1 execute as @a[tag=quiz_recent] unless score @s quiz_answer = Q1_KEY quiz_key run scoreboard players set @s quiz_status -1 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 run title @s title {"text":"答案正确!前往实验区开始操作","color":"green","bold":true} execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 run playsound minecraft:entity.player.levelup master @s ~ ~ ~ 1 1 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 unless entity @s[tag=quizTeleported] run tp @s 100 64 100 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 unless entity @s[tag=quizTeleported] run tag @s add quizTeleported execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run title @s title {"text":"答错啦!","color":"red","bold":true} execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run tellraw @s [{"text":"提示:","color":"yellow"},{"text":"请回忆实验步骤中的关键概念(例如单位换算)。","color":"gold"}] execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run playsound minecraft:block.note_block.bass master @s ~ ~ ~ 1 0.7 execute as @a[tag=quiz_recent] run tag @s remove quiz_recent # ====== 按钮C(选项3)后方命令方块链 ====== execute as @p[distance=..4,tag=quizReady] if score @s quiz_cond matches 1 run tag @s add quiz_recent execute as @a[tag=quiz_recent] run scoreboard players set @s quiz_answer 3 execute as @a[tag=quiz_recent] run scoreboard players add @s quiz_attempts 1 execute as @a[tag=quiz_recent] if score @s quiz_answer = Q1_KEY quiz_key run scoreboard players set @s quiz_status 1 execute as @a[tag=quiz_recent] unless score @s quiz_answer = Q1_KEY quiz_key run scoreboard players set @s quiz_status -1 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 run title @s title {"text":"答案正确!前往实验区开始操作","color":"green","bold":true} execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 run playsound minecraft:entity.player.levelup master @s ~ ~ ~ 1 1 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 unless entity @s[tag=quizTeleported] run tp @s 100 64 100 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 unless entity @s[tag=quizTeleported] run tag @s add quizTeleported execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run title @s title {"text":"答错啦!","color":"red","bold":true} execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run tellraw @s [{"text":"提示:","color":"yellow"},{"text":"请回忆实验步骤中的关键概念(例如单位换算)。","color":"gold"}] execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run playsound minecraft:block.note_block.bass master @s ~ ~ ~ 1 0.7 execute as @a[tag=quiz_recent] run tag @s remove quiz_recent # ====== 按钮D(选项4)后方命令方块链 ====== execute as @p[distance=..4,tag=quizReady] if score @s quiz_cond matches 1 run tag @s add quiz_recent execute as @a[tag=quiz_recent] run scoreboard players set @s quiz_answer 4 execute as @a[tag=quiz_recent] run scoreboard players add @s quiz_attempts 1 execute as @a[tag=quiz_recent] if score @s quiz_answer = Q1_KEY quiz_key run scoreboard players set @s quiz_status 1 execute as @a[tag=quiz_recent] unless score @s quiz_answer = Q1_KEY quiz_key run scoreboard players set @s quiz_status -1 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 run title @s title {"text":"答案正确!前往实验区开始操作","color":"green","bold":true} execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 run playsound minecraft:entity.player.levelup master @s ~ ~ ~ 1 1 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 unless entity @s[tag=quizTeleported] run tp @s 100 64 100 execute as @a[tag=quiz_recent] if score @s quiz_status matches 1 unless entity @s[tag=quizTeleported] run tag @s add quizTeleported execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run title @s title {"text":"答错啦!","color":"red","bold":true} execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run tellraw @s [{"text":"提示:","color":"yellow"},{"text":"请回忆实验步骤中的关键概念(例如单位换算)。","color":"gold"}] execute as @a[tag=quiz_recent] if score @s quiz_status matches -1 run playsound minecraft:block.note_block.bass master @s ~ ~ ~ 1 0.7 execute as @a[tag=quiz_recent] run tag @s remove quiz_recent ``` ## 参数说明 - 记分板目标 - quiz_answer:玩家当前选择的答案编号(1~4) - quiz_status:判定状态(1=正确,-1=错误,未设置或0=未判定) - quiz_attempts:玩家累计答题次数 - quiz_cond:执行条件门控;当玩家满足你的执行条件时,将其值设为1即可生效 - quiz_key:用于保存题目的正确答案编号(由虚拟玩家 Q1_KEY 持有) - 标签用法 - quizReady:允许参与本题答题的玩家标记(你可以在进入考区时为玩家添加) - quiz_recent:本次按钮触发绑定的“最近玩家”临时标记,保证链上命令一致作用于该玩家 - quizTeleported:防止合格玩家被多次传送的标记 - 选择器与范围 - @p[distance=..4]:以按钮为中心选择半径4格的最近玩家,适用于面对面答题台 - 可根据设备布局调大或缩小该半径 - 可调整变量 - 题目正确选项:scoreboard players set Q1_KEY quiz_key <1~4> - 实验区坐标:tp @s X Y Z 替换为你的实验区传送点 - 错误提示文本:tellraw 命令中替换为课程相应提示内容 - 执行条件:通过为满足 #{execution_condition} 的玩家设置 quiz_cond=1 来控制是否允许答题 ## 使用说明 1. 前期准备 - 在后台执行初始化命令,创建记分板并设置题目正确答案。 - 将参与本题的玩家添加标签 quizReady(可在进入考区或签到时添加)。 - 根据你的 #{execution_condition},为满足条件的玩家设置 quiz_cond=1。 - 例如:scoreboard players set @a[tag=quizReady] quiz_cond 1 - 不满足条件的玩家保持为0或未设置。 2. 安装命令方块 - 每个选项按钮后放置一个“脉冲(需要红石)”命令方块,并输入对应的第一条命令。 - 紧接其后按顺序连接“连锁(始终有效)”命令方块,依次填入链上命令。 - 连锁方块均保持“条件:关闭”(不需要条件执行),以保证按下按钮后整条链都会触发。 3. 多题扩展 - 不同题目使用不同的虚拟玩家键,例如 Q2_KEY、Q3_KEY,并设置各自的正确答案: - scoreboard players set Q2_KEY quiz_key 3 - 每个题目对应自己的按钮与命令链;@p[distance] 的范围按题台布局微调。 4. 运行与验证 - 玩家进入答题区并满足执行条件(quiz_cond=1)后,按下按钮将即时判分。 - 正确者获得标题、音效并传送到实验区;错误者获得提示与音效且无需传送。 - 已传送玩家持有 quizTeleported 标签,防止重复传送。 5. 维护与重置 - 开启下一轮测验前,可重置状态: - scoreboard players set @a[tag=quizReady] quiz_status 0 - scoreboard players reset @a[tag=quizReady] quiz_answer - tag @a remove quizTeleported(若需要允许再次传送) - 根据课程安排更新不同题目的 Qx_KEY 值与提示文本。 注意事项: - 保持命令链紧凑,避免循环或常驻检测以降低性能开销。 - 当没有玩家在按钮附近时,@p 选择器不匹配,链上命令不会对任何人生效,这是预期行为。
用自然语言描述关卡需求,即可生成连贯的指令方块链路,迅速实现机关、剧情触发与结算,缩短制作周期。
一键搭建活动与每日任务,自动计分与发放奖励,内置安全边界避免滥用,保持服务器稳定与公平。
轻松创建课堂互动、测验与实验流程,自动生成提示与反馈,学生操作即有结果,提升课堂参与度与效果。
面向开发者、地图作者与教育工作者,帮助用自然语言快速产出专业、可直接部署的指令方块方案;自动补全命令链路、执行顺序与清晰注释,覆盖从基础物品生成、计分与触发,到复杂红石逻辑、多人玩法与教学互动等全场景;降低反复调试与踩坑成本,确保性能稳定与版本兼容,标准化团队协作与教学示例沉淀;3步即可上手:描述功能、选定对象、设定条件,立即获得可落地方案与使用指引,显著缩短从创意到上线的周期,提升玩法质量与玩家留存,助力试用转化与长期复购。
将模板生成的提示词复制粘贴到您常用的 Chat 应用(如 ChatGPT、Claude 等),即可直接对话使用,无需额外开发。适合个人快速体验和轻量使用场景。
把提示词模板转化为 API,您的程序可任意修改模板参数,通过接口直接调用,轻松实现自动化与批量处理。适合开发者集成与业务系统嵌入。
在 MCP client 中配置对应的 server 地址,让您的 AI 应用自动调用提示词模板。适合高级用户和团队协作,让提示词在不同 AI 工具间无缝衔接。
免费获取高级提示词-优惠即将到期