Targeting ?
在真正触发命令的玩家身上执行命令。
概述
Targeting 引入了一个新的选择器 @t,旨在解决 Minecraft 长期存在的一个限制:可靠地识别激活红石触发命令的玩家。
在原版行为中,由按钮、压力板或其他红石输入触发的命令方块缺乏关于是谁导致激活的直接上下文信息。此模组通过将触发玩家动态绑定到命令执行来弥补这一空白。
关键特性:
@t 选择器
定位负责触发命令方块的玩家,无论是通过以下方式:
- 按下按钮
- 切换拉杆
- 踩踏压力板
- 任何与命令方块关联的红石交互
为什么这很重要?
如果没有 Targeting,地图制作者和服务器开发者通常依赖于:
这些方法不可靠、效率低下或过于复杂。
@t 在一个选择器中提供了精确性、简单性和性能。
使用示例
场景:传送按下按钮的玩家
命令方块命令:
/tp @t 100 100 100
发生的情况:
- 玩家按下连接到命令方块的按钮
- 命令执行
- 只有该特定玩家被传送到 (100, 100, 100)
对比
| 选择器 |
行为 |
@p |
最近的玩家(可能不正确) |
@a |
所有玩家 |
@s |
命令执行者(在红石上下文中无用) |
@t |
✅ 触发命令的玩家 |
Targeting ?
Execute commands on the actual player who triggered them.
Overview
Targeting introduces a new selector, @t, designed to solve one of Minecraft’s long-standing limitations: reliably identifying the player who activated a redstone-triggered command.
In vanilla behavior, command blocks triggered by buttons, pressure plates, or other redstone inputs lack direct context about who caused the activation. This mod bridges that gap by dynamically binding the triggering player to command execution.
Key Feature:
@t Selector
Targets the player responsible for triggering the command block, whether via:
Button press
Lever toggle
Pressure plate
Any redstone interaction linked to a command block
Why This Matters?
Without Targeting, mapmakers and server developers often rely on:
- Proximity-based selectors (@p)
- Complex scoreboards
- Detection loops
These approaches are unreliable, inefficient, or unnecessarily complex.
@t provides precision, simplicity, and performance in a single selector.
Example Usage
Scenario: Teleport the player who pressed a button
Command Block Command:
/tp @t 100 100 100
What Happens:
Player presses a button connected to the command block
The command executes
Only that specific player is teleported to (100, 100, 100)
Comparison
Selector Behavior
@p Nearest player (can be incorrect)
@a All players
@s Command executor (not useful in redstone context)
@t ✅ Player who triggered the command
评论 0
登录后参与评分
还没有评论,来抢沙发吧