Minecraft không chỉ là một trò chơi xây dựng và sinh tồn; nó là một nền tảng sandbox mạnh mẽ nơi người chơi có thể thao túng logic trò chơi, thay đổi môi trường, quản lý người chơi và tự động hóa các quy trình thông qua hệ thống Command (Lệnh). Với tư cách là một công cụ “Informational” (cung cấp thông tin) và “Administrative” (quản trị), việc nắm vững danh sách lệnh Minecraft là chìa khóa để mở ra trải nghiệm chơi game ở cấp độ cao nhất: từ Creative mode không giới hạn, chế độ Adventure map phức tạp, cho đến quản trị Server chuyên nghiệp.

Xem Nội Dung Bài Viết

Bài viết này sẽ cung cấp một danh sách toàn diện, được phân loại khoa học tất cả các lệnh hiện có trong Minecraft (Java Edition và Bedrock Edition), kèm theo cú pháp chuẩn, giải thích tham số, ví dụ thực tế và các lưu ý quan trọng. Dù bạn là người mới bắt đầu học cách /give mỏ kim cương, hay là Admin server cần cấu hình /execute phức tạp cho datapack, tài liệu này sẽ là tài liệu tham khảo tra cứu điển hình.

1. Cơ Chế Lệnh Cơ Bản & Điều Kiện Tiên Quyết

Trước khi đi vào danh sách chi tiết, bạn bắt buộc hiểu các khái niệm cốt lõi sau, nếu không các lệnh sẽ không hoạt động hoặc báo lỗi syntax.

1.1. Quyền Hạn (Permission Level / Op Level)

  • Java Edition: Có 4 cấp độ Operator (Op 1 đến Op 4). Lệnh cơ bản (/gamemode, /tp) thường cần Op 2. Lệnh quản trị nặng (/ban, /op, /stop, /function) cần Op 3-4.
  • Bedrock Edition: Phân quyền đơn giản hơn: Member, Operator, Admin. Cần bật “Cheats” trong cài đặt thế giới (World Settings).

1.2. Target Selectors (Bộ Chọn Đối Tượng) – Quan Trọng Nhất

Thay vì gõ tên người chơi cụ thể, bạn dùng các biến chọn động:
@p: Người chơi gần nhất (Nearest player).
@a: Tất cả người chơi (All players).
@r: Người chơi ngẫu nhiên (Random player).
@e: Tất cả thực thể (Entities – mob, item drop, minecart, armor stand…).
@s: Thực thể đang thực thi lệnh (Self – dùng trong function/command block chuỗi).

Bộ lọc (Arguments) trong ngoặc vuông :
distance=..10 (gần 10 block), distance=5.. (xa 5 block).
type=minecraft:zombie (chỉ zombie), type=!player (trừ player).
tag=boss (có tag “boss”), scores={kills=10..} (điểm kills >= 10).
nbt={Item:{id:"minecraft:diamond"}} (chỉ entity cầm kim cương – Chỉ Java).

Ví dụ: @etype=minecraft:creeper,distance=..20,tag=charged chọn Creeper sạc điện trong bán kính 20 block.

1.3. Tọa Độ & Hệ Thống Tọa Độ

  • Tuyệt đối: 100 64 -200 (Khối cụ thể).
  • Tương đối (Tilde ~): ~ ~1 ~ (Đứng y nguyên X, Z, cao hơn 1 block so với vị trí hiện tại).
  • Cục bộ (Caret ^): ^ ^ ^5 (5 block phía trước mặt entity, xoay theo góc nhìn).

1.4. NBT Data (Named Binary Tag) – Chỉ Java Edition

Dùng để chỉnh sửa dữ liệu sâu của Item/Entity/Block: {display:{Name:'{"text":"Kiếm Thần","color":"gold"}'}, Enchantments:{id:"minecraft:sharpness",lvl:10s}}.

2. Nhóm Lệnh Quản Trị Server & Người Chơi (Admin/Op Commands)

Đây là nhóm lệnh bắt buộc cho chủ Server/Realm.

Lệnh Cú Pháp Chính Chức Năng & Ví Dụ
/op / /deop /op <targets>
/deop <targets>
Cấp/Thu hồi quyền Operator.
/op Steve
/ban / /pardon /ban <targets> reason
/pardon <targets>
Ban vĩnh viễn/IP ban. /ban Hacker "X-ray detected"
/kick /kick <targets> reason Kick người chơi đang online. /kick @a "Server restarting"
/whitelist /whitelist <on\|off\|list\|add\|remove> player Quản lý danh sách trắng. /whitelist add Alex
/ban-ip / /pardon-ip /ban-ip <ip> reason Ban theo địa chỉ IP.
/stop /stop Tắt server an toàn (lưu world).
/save-all / /save-off / /save-on /save-all flush Buộc lưu world, tắt/bật tự động lưu. Dùng trước khi backup.
/setidletimeout /setidletimeout <minutes> Thời gian AFK trước khi kick (mặc định 0 = không kick).
/list /list uuids Xem danh sách player online.
/permission (Bedrock) /permission <player> <level> Set quyền Visitor/Member/Operator (Bedrock).

3. Nhóm Lệnh Chế Độ & Trạng Thái Người Chơi (Gameplay Commands)

3.1. Chế Độ Trò Chơi (Gamemode)

/gamemode <mode> target
Mode: survival (0), creative (1), adventure (2), spectator (3 – Chỉ Java).
Ví dụ: /gamemode creative @atag=builder -> Chuyển tất cả builder sang Creative.

3.2. Độ Khó (Difficulty)

/difficulty <level>
peaceful (0), easy (1), normal (2), hard (3).
Lưu ý: Peaceful xóa mọi hostile mob ngay lập tức.

3.3. Hiệu Quả Trạng Thái (Effect)

/effect give <targets> <effect> seconds amplifier hideParticles
/effect clear <targets> effect
Effect ID: speed, strength, jump_boost, regeneration, invisibility, glowing, levitation, wither, poison, blindness, night_vision, fire_resistance, water_breathing, dolphins_grace, conduit_power, hero_of_the_village, darkness, trial_omen, raid_omen, wind_charged, weaving, oozing, infested…
Ví dụ: /effect give @p minecraft:speed 60 1 true (Speed II 60s, ẩn particle).
Ví dụ Clear: /effect clear @a minecraft:poison (Chữa độc cho all).

Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế
Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế

3.4. Sát Thương & Chữa Lành (Damage/Heal)

  • /damage <target> <amount> source (Java 1.20.5+): Gây damage bỏ qua giáp. Source: magic, fire, lightning, player:{name:"Steve"}.
  • /heal <targets> amount: Chữa máu (không chữa голод).

3.5. Điểm Sinh (Spawn/Respawn)

  • /setworldspawn pos angle: Đặt spawn thế giới.
  • /spawnpoint <targets> pos angle: Đặt spawn cá nhân (giống ngủ giường).
  • /setdefaultspawnpoint (Bedrock): Đặt spawn mặc định.

4. Nhóm Lệnh Thao Túng Vật Thể & Inventory (Item/Inventory Commands)

4.1. /give – Cho Vật Phẩm (Cơ Bản & Nâng Cao)

/give <targets> <item> count dataTag

Cú pháp NBT cơ bản (Java):
{Enchantments:{id:"minecraft:sharpness",lvl:5s},{id:"minecraft:unbreaking",lvl:3s}, display:{Name:'{"text":"Kiếm Rồng","italic":false,"color":"dark_red"}'}, Damage:0, CustomModelData:1001}

Ví dụ thực chiến:
1. Stack 64 Diamond: /give @p diamond 64
2. Kiếm Netherite Sharpness 10, Unbreaking 3, Mending, tên tùy chỉnh:
/give @p netherite_sword{Enchantments:{id:"minecraft:sharpness",lvl:10s},{id:"minecraft:unbreaking",lvl:3s},{id:"minecraft:mending",lvl:1s}, display:{Name:'{"text":"§c§lThần Kiếm","italic":false}'}} 1
3. Hộp Shulker đã chứa sẵn item (Nested NBT):
/give @p shulker_box{BlockEntityTag:{Items:{Slot:0b,id:"minecraft:diamond",Count:64b},{Slot:1b,id:"minecraft:emerald",Count:32b}}} 1

Bedrock Edition: Không hỗ trợ NBT phức tạp. Dùng /give @p diamond_sword 1 0 {"minecraft:item_lock":{}} (khóa item) hoặc CanPlaceOn/CanDestroy cho Adventure mode.

4.2. /clear – Xóa Inventory

/clear <targets> item maxCount
/clear @p (Xóa toàn bộ túi).
/clear @a minecraft:dirt 64 (Xóa tối đa 64 dirt của all player).

4.3. /replaceitem – Thay Đổi Slot Cụ Thể

Java (Cũ, thay bằng /item 1.17+): /replaceitem entity <target> <slot> <item> count dataTag
Slot: weapon.mainhand, weapon.offhand, armor.head, armor.chest, armor.legs, armor.feet, hotbar.0…hotbar.8, inventory.0…inventory.26.
Ví dụ: /replaceitem entity @p weapon.mainhand netherite_sword{Enchantments:{id:"sharpness",lvl:5s}}

4.4. /item – Thao Túng Item Hiện Đại (Java 1.17+)

Lệnh mạnh mẽ thay thế replaceitem, cho phép modify, copy, swap giữa container/entity.
/item replace entity <target> <slot> with <item> count nbt
/item modify entity <target> <slot> <function> (Dùng function để random enchant, set damage…).
/item copy entity <source> <sourceSlot> entity <target> <targetSlot>

5. Nhóm Lệnh Teleport & Di Chuyển (Teleportation Commands)

5.1. /tp (Teleport) – Lệnh Di Chuyển Cơ Bản

/tp <destination> (Teleport chính mình)
/tp <targets> <destination> (Teleport người khác)
/tp <targets> <location> <rotation> (Có góc nhìn)

  • Destination: Entity (@p, Steve), Tọa độ (100 64 100), ~ ~ ~.
  • Rotation: <yRot> <xRot> (Yaw, Pitch). ~ ~ giữ nguyên góc nhìn.
  • Ví dụ: /tp @atag=staff 0 100 0 facing 100 64 100 (Tele staff đến 0 100 0 nhìn về 100 64 100).
  • Ví dụ facing entity: /tp @s @p facing entity @etype=ender_dragon,limit=1 eyes (Tele mình đến player gần nhất, nhìn vào mắt Ender Dragon).

5.2. /spreadplayers – Rải Ngẫu Nhiên

/spreadplayers <center> <spreadDistance> <maxRange> <respectTeams> <targets> maxHeight
Dùng cho Minigame (Hunger Games, UHC).
Ví dụ: /spreadplayers 0 0 100 2000 false @a (Rải all player quanh 0 0, cách nhau min 100 block, trong bán kính 2000).

6. Nhóm Lệnh Thay Đổi Thế Giới & Block (World Editing Commands)

6.1. /setblock – Đặt Block Đơn

Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế
Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế

/setblock <pos> <block> mode dataTag
Mode: replace (mặc định), destroy (drop item như break), keep (chỉ đặt nếu block là air).
Ví dụ: /setblock ~ ~1 ~ minecraft:command_block{Command:"say Hello",auto:1b} (Đặt CB tự chạy).
Ví dụ Block State: /setblock 0 64 0 minecraft:oak_logaxis=y (Gỗ đứng).

6.2. /fill – Điền/Khắc Khu Vực Hình Hộp

/fill <from> <to> <block> mode
Mode: replace (mặc định), outline (chỉ viền), hollow (ruộng bên trong), keep (chỉ air), destroy (drop item).
Filter (Java): replace <block> -> Chỉ thay block cụ thể.
Ví dụ Tạo tường: /fill ~5 ~ ~5 ~-5 ~10 ~-5 stone_bricks outline
Ví dụ Xóa khối: /fill ~10 ~ ~10 ~-10 ~-5 ~-10 air destroy (Xóa và drop item quanh người).
Ví dụ Thay đá thành cobbles: /fill 0 0 0 100 64 100 cobblestone replace stone

6.3. /clone – Sao Chép Kiến Trúc

/clone <begin> <end> <destination> mode filter
Mode: normal, force (clone cả block đang update như redstone), move (cắt – xóa nguồn).
Filter: masked (bỏ qua air), filtered (chỉ clone block cụ thể).
Ví dụ: /clone 100 64 100 120 80 120 200 64 200 masked (Copy tòa nhà từ 100->120 sang 200, bỏ qua air).

6.4. /structure – Lưu/Tải Structure (Java 1.20+ / Bedrock)

Hệ thống thay thế Structure Block cũ, mạnh hơn cho Datapack/Addon.
/structure save <name> <pos> <size> mirror rotation ignoreEntities blocks entities
/structure load <name> <pos> mirror rotation ignoreEntities integrity seed
/structure delete <name>

6.5. /particle – Tạo Hiệu Ứng Particle

/particle <name> <pos> <delta> <speed> <count> force|normal viewers
Ví dụ: /particle minecraft:totem_of_undying ~ ~1 ~ 0.5 0.5 0.5 1 50 force @a (Hiệu ứng Totem quanh người chơi).
Delta: Kích thước hộp phát particle (x y z).
Speed: Tốc độ particle (0 = tĩnh).

7. Nhóm Lệnh Quản Lý Entity & Mob (Entity/Mob Commands)

7.1. /summon – Sinh Thực Thể (Mob, Item, Projectile…)

/summon <entity_type> pos nbt

NBT Quan Trọng:
CustomName: {CustomName:'{"text":"Boss Cuối","color":"red"}', CustomNameVisible:1b}
Attributes (Thuộc tính): {Attributes:{Name:"generic.max_health",Base:200},{Name:"generic.attack_damage",Base:20},{Name:"generic.knockback_resistance",Base:1.0f}}
Equipment (Trang bị): {HandItems:{id:"netherite_sword",Count:1b,tag:{Enchantments:{id:"sharpness",lvl:5s}}}, ArmorItems:{},{},{},{id:"netherite_helmet"}}
AI/Behavior: {NoAI:1b} (Đứng yên), {Silent:1b} (Không kêu), {Invulnerable:1b} (Bất tử), {PersistenceRequired:1b} (Không despawn), {Glowing:1b} (Chói).
Villager Trades: {VillagerData:{profession:"minecraft:librarian",level:5,type:"minecraft:plains"}, Offers:{Recipes:{buy:{id:"emerald",Count:1},sell:{id:"enchanted_book",Count:1,tag:{StoredEnchantments:{id:"mending",lvl:1s}}},priceMultiplier:0.05f,uses:0,maxUses:8}}}

Ví dụ Summon Zombie Khổng Lồ (Giant – Java only): /summon giant ~ ~ ~ {CustomName:'{"text":"Titan"}', Attributes:{Name:"generic.max_health",Base:500}}

7.2. /kill – Giết Entity

/kill targets
/kill @etype=item (Dọn item rơi lag server).
/kill @etype=!player (Giết tất cả mob, giữ player).
/kill @edistance=..5 (Giết mọi thứ trong bán kính 5 block).

7.3. /tag – Quản Lý Tag (Nhãn) Entity

/tag <targets> <add|remove|list> <name>
Cực kỳ quan trọng cho /execute và function. Tag không mất khi reload/chunk unload (khác scoreboard).
Ví dụ: /tag @etype=armor_stand,tag=!static add static -> Đánh dấu Armor Stand tĩnh.

Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế
Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế

7.4. /ride – Cưỡi/Ngồi (Java 1.19.4+)

/ride <target> mount <vehicle> / /ride <target> dismount
/ride @p mount @etype=horse,limit=1,sort=nearest (Cưỡi ngựa gần nhất).
/ride @etype=villager mount @etype=minecart,limit=1 (Cho villager vào minecart).

7.5. /attribute – Chỉnh Thuộc Tính Runtime (Java 1.20.5+)

Thay đổi attribute mà không cần respawn/summon lại.
/attribute <target> <attribute> <get|base_set|modifier_add|modifier_remove> value operation
Ví dụ: /attribute @p generic.max_health base_set 40 (Set max health 20 tim).
Ví dụ Modifier: /attribute @p generic.attack_damage modifier_add uuid "Tăng sát thương" 10 add (Cộng 10 damage).

8. Nhóm Lệnh Logic, Automatization & Data-Driven (Technical Commands)

Đây là “trái tim” của Map Maker, Datapack Developer, Technical Player.

8.1. /execute – Lệnh Thực Thi Đệ Quy (Quan Trọng Nhất)

Cú pháp hiện đại (1.13+): /execute <subcommand> ... run <command>
Các Subcommand (Có thể chuỗi nhiều cái):
1. as <targets>: Thay đổi @s (executor) thành target, nhưng vị trí vẫn ở command block/player gõ.
2. at <targets>: Thay đổi vị trí thực thi (position, dimension, rotation) thành target, @s không đổi.
3. positioned <pos> / positioned as <targets>: Đặt vị trí thực thi.
4. rotated <yRot> <xRot> / rotated as <targets>: Đặt góc nhìn.
5. facing <pos> / facing entity <targets> <eyes|feet>: Xoay để nhìn về đích.
6. in <dimension>: Chuyển dimension thực thi (minecraft:overworld, the_nether, the_end).
7. if / unless <condition>: Điều kiện (Chỉ run nếu true/false). Key: block, blocks, entity, score, loaded, dimension, predicate.
8. store result <type> <target> <path> scale: Lưu kết quả trả về (success count/result value) của command cuối vào scoreboard/data/storage.
9. store success <type> <target> <path> scale: Lưu success (0/1).
10. run <command>: Lệnh cuối cùng được chạy.

Ví dụ “Thần Thánh” (Detect player cầm Diamond Sword -> Cho effect Strength):

execute as @a at @s if entity @snbt={SelectedItem:{id:"minecraft:diamond_sword"}} run effect give @s strength 1 0 true

Phân tích: as @a -> lặp qua từng player (thay @s = player đó). at @s -> nhảy vị trí đến player đó. if entity @snbt=... -> check item tay player đó. run -> cho effect player đó (@s).

Ví dụ Store Result (Lấy độ bền tool vào scoreboard):
/scoreboard objectives add durability dummy
execute as @a store result score @s durability run data get entity @s SelectedItem.Damage
(Lưu ý: Damage = độ hao mòn, độ bền max – Damage = current durability).

8.2. /scoreboard – Hệ Thống Điểm Số (Biến Toàn Cục)

Cốt lõi của lập trình Minecraft (Variables, Logic, Timer, Math).

  • Objectives: /scoreboard objectives add <name> <criteria> displayName
    • Criteria: dummy (tự quản lý), trigger (player tự set), minecraft.custom:minecraft.walk_one_cm, minecraft.killed:minecraft.zombie, deathCount, health…
  • Players/Entities: /scoreboard players <get|set|add|remove|reset|enable|operation> <targets> <objective> value
  • Operation (Toán học giữa 2 score):
    operation <target> <targetObjective> <operation> <source> <sourceObjective>

    • Ops: +=, -=, =, /=, %=, =, <, >, >< (swap).
  • Display: /scoreboard objectives setdisplay <sidebar|list|belowName|sidebar.team.<color>> objective

Ứng dụng: Timer (/scoreboard players add @a timer 1 mỗi tick), Money system, Kill count, Custom Boss Bar logic.

8.3. /data – Đọc/Ghi NBT Runtime (Chỉ Java)

/data get block <pos> path scale
/data get entity <target> path scale
/data get storage <namespace:id> path scale
/data merge block <pos> <nbt>
/data merge entity <target> <nbt>
/data modify ... (Copy, swap, set từ nguồn khác).

Ví dụ: /data merge entity @etype=villager,limit=1,sort=nearest {Offers:{Recipes:}} (Xóa trade villager gần nhất).

8.4. /function – Chạy File Function (.mcfunction)

/function <name> with|if|unless ...
Chạy một file .mcfunction trong datapack (chứa hàng chục lệnh, chạy trong 1 tick).
if/unless check condition trước khi chạy toàn bộ function.

8.5. /schedule – Lên Lịch Chạy Lệnh (Delay)

/schedule function <name> <time> append|replace
Time: 10t (ticks), 5s (seconds), 1d (days).
Dùng để tạo delay không cần Redstone/Scoreboard timer.

8.6. /bossbar – Thanh Boss Bar Tùy Chỉnh

Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế
Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế

/bossbar create <id> <name>
/bossbar set <id> <name|color|style|value|max|visible|players|darkenSky|createFog|thicken>
Color: white, orange, magenta, light_blue, yellow, lime, pink, gray, light_gray, cyan, purple, blue, brown, green, red, black.
Style: progress, notched_6, notched_10, notched_12, notched_20.
Dùng kết hợp /execute store result bossbar ... để hiển thị HP Boss, Timer, Mana…

8.7. /advancement – Quản Lý Tiến Độ (Advancement)

/advancement <grant|revoke> <targets> <only|from|through|until> <advancement>
Dùng để unlock recipe, trigger function khi player làm gì đó (via trigger criterion).

8.8. /loot – Hệ Thống Loot Table (Java 1.14+)

/loot spawn <pos> main_hand|off_hand loot <loot_table> modifier
/loot give <target> loot <loot_table>
/loot insert <target> <slot> loot <loot_table>
/loot replace <block|entity> <pos|target> <slot> loot <loot_table>
Cho phép drop loot chính xác như kill mob/mở chest mà không cần spawn entity/block.
Ví dụ: /loot spawn ~ ~ ~ loot minecraft:entities/zombie (Drop loot zombie tại chân bạn).

8.9. /predicate – Kiểm Tra Điều Kiện Tái Sử Dụng (Java 1.19+)

Định nghĩa điều kiện phức tạp trong file JSON (data/predicates), rồi dùng trong /execute if predicate ....
Tách logic condition ra khỏi command, dễ maintain.

8.10. /execute on / positioned / anchored (Java 1.19.3+ – Cú pháp mới)

Cập nhật cú pháp execute để rõ ràng hơn:
execute as @a at @s -> execute at @a (gộp as + at).
anchored eyes/feet -> Neo vị trí tại mắt/chân entity (quan trọng cho raycasting/facing).

9. Nhóm Lệnh Thông Tin & Debug (Informational/Debug Commands)

Phù hợp với từ khóa “Informational” của bạn.

Lệnh Chức Năng
/help /help command – Xem hướng dẫn cú pháp in-game.
/seed Hiển thị Seed thế giới (Cần Op 2+).
/time query <day|daytime|gametime> Xem thời gian chính xác (ticks).
/gamerule Xem/Sửa Game Rules (Xem phần 10).
/list Xem player online + UUID.
/scoreboard objectives list Liệt kê tất cả objectives.
/data get storage minecraft:root Xem toàn bộ data storage (debug datapack).
/debug report Tạo file report lag/performance (zip) gửi cho Mojang/Admin.
/debug start/stop Bắt đầu/dừng profiling.
/perf (1.19.4+) Hiển thị hiệu năng real-time (FPS, TPS, Memory, Entities).
/tickingarea (Bedrock) Quản lý khu vực luôn load (ticking area).

10. /gamerule – Cài Đặt Quy Tắc Trò Chơi (Game Rules)

Đây là cài đặt vĩnh viễn cho thế giới (lưu trong level.dat), không cần command block chạy liên tục.

10.1. Gameplay & Combat

  • doFireTick (true/false): Lửa có lan không.
  • doMobSpawning (true/false): Mob tự nhiên spawn.
  • doMobLoot (true/false): Mob drop loot.
  • doTileDrops (true/false): Block drop item khi break.
  • doEntityDrops (true/false): Entity drop item.
  • keepInventory (true/false): Giữ đồ khi chết (Rất phổ biến).
  • keepXP (true/false): Giữ XP khi chết.
  • forgiveDeadPlayers (true/false): Neutral mob (Zombie Piglin, Enderman) tha thứ sau khi player chết.
  • universalAnger (true/false): Neutral mob giận tất cả player chứ không chỉ kẻ tấn công.
  • playersSleepingPercentage (int, default 100): % player ngủ để qua đêm (0 = 1 người ngủ là qua đêm).
  • doInsomnia (true/false): Phantom spawn khi không ngủ.
  • doImmediateRespawn (true/false): Hiện màn hình respawn ngay, không xem death screen.
  • doLimitedCrafting (true/false): Chỉ craft được recipe đã unlock (Recipe Book).
  • doVinesSpread (true/false): Dây leo lan.
  • snowAccumulationHeight (int): Chiều cao tuyết rơi tích tụ.

10.2. World Updates & Physics

  • randomTickSpeed (int, default 3): Tốc độ random tick (Tree grow, crop grow, fire spread, copper oxidize). Set 0 = tắt hoàn toàn. Set 1000 = siêu nhanh.
  • maxCommandChainLength (int, default 65536): Giới hạn chuỗi command block/function.
  • maxCommandForkCount (int, default 65536): Giới hạn fork trong function.
  • commandBlockOutput (true/false): Log output CB ra console/chat.
  • logAdminCommands (true/false): Log lệnh admin ra console.
  • sendCommandFeedback (true/false): Hiển thị feedback lệnh trong chat cho người gõ.
  • reducedDebugInfo (true/false): Ẩn thông tin F3 (biome, coords, light level).

10.3. Dimension Specific

  • doDaylightCycle (true/false): Trời có chuyển ngày/đêm không.
  • doWeatherCycle (true/false): Có mưa/sương không.
  • doPatrolSpawning (true/false): Illager Patrol spawn.
  • doTraderSpawning (true/false): Wandering Trader spawn.
  • doWardenSpawning (true/false): Warden spawn (Deep Dark).
  • spawnRadius (int): Bán kính spawn ngẫu nhiên khi mới join/respawn (default 10).

10.4. Bedrock Exclusive Gamerules

  • showcoordinates (true/false): Hiện tọa độ trên màn hình (Không cần F3).
  • showdeathmessages (true/false): Hiện tin nhắn chết.
  • pvp (true/false): Bật/tắt PvP.
  • tntexplodes (true/false): TNT nổ.
  • fireworkdamage (true/false): Pháo hoa gây damage.
  • drowningdamage, falldamage, firedamage, lavadamage, pvpdamage… (Tắt damage cụ thể).

11. Nhóm Lệnh Chỉ Dành Cho Bedrock Edition (Education/Scripting)

Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế
Danh Sách Toàn Diện Tất Cả Các Lệnh Minecraft: Hướng Dẫn Chi Tiết, Cú Pháp Và Ứng Dụng Thực Tế

Bedrock có hệ lệnh khác biệt (không có NBT, không có /execute phức tạp như Java, nhưng có Script API).

  • /ability: Set abilities: /ability @p mayfly true (Bay như Creative), mute, worldbuilder.
  • /wb / /worldbuilder: Bật World Builder Mode (Phá block trong Adventure mode, đặt block trên deny block).
  • /immutableworld: Bật/tắt Immutable World (Không phá/đặt block – cho Education).
  • /classroommode: Kết nối Classroom Mode.
  • /codebuilder / /c: Mở Code Connection (MakeCode/Python).
  • /structure: Lưu/Tải structure file (.mcstructure) – Mạnh hơn Java version cũ.
  • /script: Trigger Script Event cho JS/TS Script API.
  • /camerashake: Rung camera player.
  • /fog: Quản lý Fog setting (Bedrock 1.18+).
  • /music: Chơi nhạc disc/background.
  • /playanimation: Chơi animation entity (geckolib style vanilla).
  • /particle: Cú pháp khác Java (không có delta/speed phức tạp).
  • /replaceitem: Cú pháp slot khác (slot.weapon.mainhand, slot.armor.head…).
  • /testfor / /testforblock / /testforblocks: Lệnh check cũ (Java đã xóa, thay bằng /execute if). Bedrock vẫn dùng nhiều.

12. Nhóm Lệnh Redstone & Command Block (Redstone/Command Block Commands)

Dành cho kỹ sư Redstone và Command Block Engineer.

Lệnh Chức Năng
/setblock ~ ~ ~ command_block Đặt CB. Thêm NBT {Command:"...",auto:1b,conditionMet:0b} để config sẵn.
/blockdata (Cũ) -> /data merge block Sửa NBT block đã đặt (CB, Lectern, Chest…).
/clone Copy dây CB, máy Redstone.
/schedule Delay tick cho CB chuỗi.
/function Chạy function từ CB (Hiệu năng cao hơn CB chain rất nhiều).
/gamerule commandBlockOutput false Tắt spam chat/console từ CB.
/gamerule maxCommandChainLength Tăng giới hạn chuỗi nếu bị “Command chain too long”.

Loại Command Block:
1. Impulse (Cam): Chạy 1 lần khi có xung redstone.
2. Chain (Xanh): Chạy nếu CB phía sau chạy thành công (Chain logic).
3. Repeat (Tím): Chạy mỗi tick (20 lần/giây) khi có xung redstone (hoặc Always Active).
Điều kiện (Conditional): Chỉ chạy nếu CB trước đó thành công (Success Count > 0).
Always Active: Không cần Redstone (Chạy liên tục nếu Repeat, hoặc tự trigger 1 lần nếu Impulse/Chain).

13. Mẹo Pro, Tối Ưu Hiệu Năng & Best Practices

Viết lệnh đúng cú pháp là chưa đủ, phải viết hiệu quả để không làm lag Server (TPS drop).

13.1. Giảm Thiểu @e và @a Không Cần Thiết

  • Sai: /execute as @e run ... (Chạy cho 5000 entity -> Lag chết chốc).
  • Đúng: /execute as @etype=minecraft:zombie,tag=custom,tag=!processed run ... (Lọc chặt chẽ).
  • Luôn thêm limit=1 nếu chỉ cần 1 entity: @e...,limit=1,sort=nearest.

13.2. Ưu Tiên /function Hơn Command Block

  • Function chạy trong 1 tick, parse một lần, tối ưu JIT compiler.
  • Dễ version control (Git), dễ debug, comment code (# Comment).
  • Dùng /schedule thay cho Redstone clock.

13.3. Sử Dụng storage Thay scoreboard Cho Data Phức Tạp

  • /data modify storage minecraft:mydata ... lưu trữ JSON tree phức tạp (Vector3, List, Map) tốt hơn scoreboard chỉ lưu integer.
  • Kết hợp /execute store result storage ... để lấy data block/entity vào storage.

13.4. Raycasting & Raycasting (Java 1.20+)

Dùng /execute positioned ^ ^ ^5 rotated as @s if block ~ ~ ~ air run ... để kiểm tra block phía trước.
Hoặc function raycast trong datapack vanilla_tweaks / tự viết để detect block/entity player đang nhìn.

13.5. Debug Nhanh

  • F3 + N (Java): Chuyển Creative/Spectator nhanh.
  • F3 + I: Copy block/entity data ra clipboard (Dán vào /setblock//summon).
  • F3 + G: Hiện chunk border.
  • /debug report: Phân tích lag.

14. Tài Nguyên Tra Cứu & Công Cụ Hỗ Trợ (External Resources)

Không ai nhớ hết tất cả NBT tag hay Loot table. Hãy bookmark các trang sau:

  1. Minecraft Wiki (Official): minecraft.wiki (Trang chủ命令参考, NBT format, Data components 1.20.5+).
  2. Minecraft Commands Generator (Web Tools):
    • MCStacker (mcstacker.net): Tạo lệnh /give, /summon, /setblock qua UI kéo thả (Hỗ trợ cả Java & Bedrock).
    • Command Generators (commandgenerators.com): Tùy chỉnh nâng cao.
    • Misode (misode.github.io): Chuẩn mực hiện nay cho Datapack: Generator Function, Loot Table, Predicate, Recipe, Worldgen, Advancement. Rất sạch, cập nhật nhanh version mới.
  3. Visual Studio Code + Extension “Minecraft Development” (by Danni): Code Datapack/Function/JSON với Autocomplete, Syntax Highlight, Error checking, Deploy nhanh.
  4. Datapack Hubs: vanillatweaks.net (Module datapack chất lượng cao), planetminecraft.com, modrinth.com (Tìm datapack/mod).
  5. Discord Communities: “Minecraft Commands”, “Datapack Development”, “Technical Minecraft” – Nơi hỏi đáp realtime.

15. Kết Luận: Hành Trình Làm Chủ Minecraft Commands

Danh sách lệnh Minecraft là một “biển khổng lồ”. Bài viết này đã cố gắng đóng gói hơn 1500 từ kiến thức cốt lõi, từ cơ bản (/give, /gamemode) đến chuyên sâu (/execute store, /loot, /data modify, /attribute, gamerule).

Lộ trình học tập đề xuất:
1. Tuần 1-2: Thành thạo Target Selector (@a, @e...), Tọa độ (~, ^), /give, /tp, /gamemode, /effect.
2. Tuần 3-4: Học /execute (cú pháp mới as, at, if, run), /scoreboard (dummy, operation), /function, /schedule. Viết được Datapack đơn giản (Auto smelt, Tree chopper, Home system).
3. Tuần 5-6: Nắm vững /data get/merge, NBT structure (Item, Entity, Block Entity). Học /loot, /summon NBT phức tạp (Custom Boss, Villager Trade).
4. Tuần 7+: Datapack Development thực tế: Predicates, Dimensions, Worldgen (Noise), Script API (Bedrock), Optimization (F3+L, Spark profiler).

Hãy nhớ: Command Block là quá khứ, Datapack/Function là hiện tại và tương lai. Đừng ngại đọc Wiki tiếng Anh và thử nghiệm trong Creative mode cheat enabled. Minecraft không có “game over”, chỉ có “command failed” – và đó là lúc bạn học được điều mới.

Chúc bạn trở thành Command Master và xây dựng những kiệt tác tự động hóa hoành tráng!

Mục nhập này đã được đăng trong Blog. Đánh dấu trang permalink.

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *