/execute

作弊/op 2Java 版 26.3

以其他實體的身分、在其他位置或僅在條件成立時執行另一個指令。基本格式是 /execute if biome <pos> <biome>;共有 17 種語法格式與 27 個參數。權限:作弊/op 2。

誰可以使用
作弊/op 2
語法格式
17
參數
27

/execute 語法

遊戲資料

遊戲接受的所有格式。<尖括號> 中的字是你要填入的參數;其他部分照原樣輸入。

/execute if biome <pos> <biome>
/execute if block <pos> <block>
/execute if blocks <start> <end> <destination> all
/execute if blocks <start> <end> <destination> masked
/execute if data block <source> <path>
/execute if data entity <source> <path>
/execute if data storage <source> <path>
/execute if dimension <dimension>
/execute if entity <entities>
/execute if items block <source> <slots> <item_predicate>
/execute if items entity <source> <slots> <item_predicate>
/execute if loaded <pos>
/execute if predicate <predicate>
/execute if score <target> <targetObjective> < <source> <sourceObjective>
/execute if score <target> <targetObjective> <= <source> <sourceObjective>
/execute if score <target> <targetObjective> = <source> <sourceObjective>
/execute if score <target> <targetObjective> > <source> <sourceObjective>

有些分支會接續到另一個指令的語法(以 … 表示),例如 /execute 的 run。

/execute 範例

可直接貼上的範例(需開啟作弊)。@s 是你自己,@p 是最近的玩家,@a 是所有玩家,@e 是所有實體。

/execute as @a at @s run summon minecraft:firework_rocket ~ ~1 ~
在每位玩家上方發射煙火。
/execute if block ~ ~-1 ~ minecraft:gold_block run say Gold!
如果你站在金方塊上就說「Gold!」。

/execute 參數

每個參數接受的內容,以及遊戲強制的限制。

/execute 參數
參數接受限制
<axes>座標軸(x、y、z 任意組合)—
<anchor>eyes 或 feet—
<targets>目標選擇器或玩家名稱(@s、@p、@a、@e、@r)一個或多個
<pos>位置(x y z,可用小數)—
<biome>遊戲 ID 或 #標籤worldgen/biome
<block>方塊 ID 或 #標籤,可附 [狀態]—
<start>方塊座標(x y z,~ 相對、^ 局部)—
<end>方塊座標(x y z,~ 相對、^ 局部)—
<destination>方塊座標(x y z,~ 相對、^ 局部)—
<source>方塊座標(x y z,~ 相對、^ 局部)—
<path>NBT 路徑—
<dimension>維度(minecraft:overworld、the_nether、the_end)—
<entities>目標選擇器或玩家名稱(@s、@p、@a、@e、@r)一個或多個
<name>函數 ID 或 #標籤—
<slots>欄位來源—
<item_predicate>物品 ID 或 #標籤,可附元件—
<predicate>判定條件 ID—
<target>分數持有者(選擇器、名稱或 *)單一目標
<targetObjective>計分板目標名稱—
<sourceObjective>計分板目標名稱—
<range>數字範圍(例如 1..5)—
<id>帶命名空間的 ID(minecraft:…)—
<heightmap>高度圖類型—
<rot>旋轉角度(yaw pitch)—
<scale>數字—
<objective>計分板目標名稱—
<entity>註冊表中的遊戲 IDentity_type

相關指令

資料來源:Minecraft Java 版 26.3 遊戲檔案。 資料來源說明

以其他實體的身分、在其他位置或僅在條件成立時執行另一個指令。 它有 17 種語法格式,可由以下對象執行:作弊/op 2。

另請參閱

🔍

幫助我們保持準確性! 如果您發現不正確的統計資料、缺失的資料或任何問題,您的回饋將直接幫助我們提高整個社羣的資料品質。

報告問題

/execute 常見問題(Java 26.3)

/execute 在 Minecraft 中有什麼作用?

以其他實體的身分、在其他位置或僅在條件成立時執行另一個指令。

/execute 的語法是什麼?

基本格式是 /execute if biome <pos> <biome>。所有格式都列在上方。

/execute 有什麼範例?

/execute as @a at @s run summon minecraft:firework_rocket ~ ~1 ~ — 在每位玩家上方發射煙火。

使用 /execute 需要作弊嗎?

需要:作弊/op 2。在單人遊戲中請開啟「允許作弊」(或以允許作弊的方式開放區域網路)。