Thief Villager Datapack — Minecraft Java 1.21.4
Installation
-
Back up your world.
-
Place the ZIP file directly into the world's datapacks folder without extracting it.
Typical location: %APPDATA%\.minecraft\saves\WorldName\datapacks
-
Enter the world and run /reload. Operator permissions are required.
-
Wait 30 seconds in Survival or Adventure mode.
Rules
-
A thief villager appears once every 600 game ticks (30 seconds at normal speed) for each player.
-
A boss bar at the top of the screen shows the time until the next thief arrives. The final 5 seconds are displayed in red.
-
The villager displays the stolen item in its hand and announces the item name and quantity in chat.
-
Default item names follow the game's language settings, and custom anvil names are also shown.
-
One non-empty slot is chosen uniformly from the 9 hotbar slots and 27 main inventory slots.
-
The entire stack in the selected slot is stolen. Armor slots, off-hand, and Ender Chests are excluded.
-
If the inventory is empty, that theft cycle is skipped.
-
All item data is copied, including quantity, custom names, enchantments, durability, and Shulker Box contents.
-
Killing the villager immediately returns the original stack to an empty slot in the victim's inventory.
-
If no empty slot is available, the item is dropped motionless at the owner's feet and a notification is shown. Only the owner can pick it up.
-
If the owner is offline, dead, or in Spectator mode, the storage marker is retained and the item is returned when they come back and the chunk is loaded.
-
The thief must be caught within 200 game ticks (10 seconds at normal speed) after spawning.
-
If not caught in time, a centered message saying "You failed to catch the villager" is displayed and the villager disappears.
-
Items stolen by a thief that times out are permanently lost. If a kill and timeout occur on the same tick, item return takes priority.
-
Items are also returned if the thief dies naturally.
-
Items dropped during return disappear after 5 minutes.
-
Each thief stores items separately, so a new thief can appear even if previous thieves still exist.
-
Players in Creative or Spectator mode are never targeted automatically.
-
Supports the three default dimensions. If a chunk unloads, the thief and stored items are saved and processed when reloaded.
-
In multiplayer, thieves run away from the nearest non-spectator player.
Commands
/function thief:test — Instantly perform one theft (run by a player, intended for testing)
/function thief:stop — Stop new thieves from spawning
/function thief:start — Resume spawning and reset the timer
/function thief:recover — Return all stolen items from loaded chunks to their owners (items from older versions without owner data are returned at their location)
Removal
Run /function thief:stop, then either catch all active thieves or use /function thief:recover to recover items.
For thieves located far away, travel to the relevant chunks and recover them before closing the world and removing the ZIP file.
Implementation & Limitations
-
Villager movement is controlled by commands. It works best on flat terrain and simple one-block-high elevation changes.
-
Movement speed on flat ground is approximately 4.49 blocks per second (0.22448 blocks per tick), about 80% of a normal sprinting player's speed. Sprint-jumping and Speed effects are not considered in this comparison.
-
The datapack checks the block below the villager and moves it downward if airborne, allowing it to settle onto the ground after spawning in the air or traversing slopes.
-
When blocked by a wall, the villager searches 12 possible directions, including left, right, and backward, and keeps the selected detour direction for 1 second.
-
Both body and head space are checked to prevent movement through walls. This is not a full pathfinding AI and cannot solve complex mazes.
-
Original items are stored on an invisible passenger marker rather than relying on equipment drops.
-
The item shown in the villager's hand is for display only, with its drop chance set to 0 to prevent duplicate returns.
-
If both the villager and its storage marker are removed by bulk entity deletion commands or plugins, the stored items may be lost.
-
Verified on an official Minecraft Java 1.21.4 local server and auto-connected client, including movement, theft, enchanted item return and pickup, boss bar display, failure messages, and the 200-tick time limit.
-
Visual inspection of client-side graphics was not performed.
Compatibility
Compatible with Minecraft Java Edition 1.21.4 datapack version 61.
https://www.minecraft.net/en-us/article/minecraft-java-edition-1-21-4
도둑 주민 데이터팩 — Minecraft Java 1.21.4
설치
1. 월드를 백업합니다.
2. ZIP을 풀지 않고 해당 월드의 datapacks 폴더에 넣습니다.
일반적인 위치: %APPDATA%\.minecraft\saves\월드이름\datapacks
3. 월드에 들어가 /reload 를 실행합니다. 명령어 사용 권한이 필요합니다.
4. 서바이벌 또는 모험 모드에서 30초 기다립니다.
규칙
- 플레이어마다 600게임틱(정상 속도에서 30초)에 한 번 도둑이 나타납니다.
- 화면 위 보스바가 나에게 다음 도둑이 오는 시간을 표시합니다. 마지막 5초는 빨간색입니다.
- 주민은 훔친 물건을 손에 표시하며, 채팅으로 아이템 이름과 수량을 알려줍니다.
- 기본 이름은 게임 언어 설정을 따르고, 모루 등으로 붙인 이름도 표시합니다.
- 단축바 9칸 + 일반 인벤토리 27칸 중 비어 있지 않은 슬롯을 균등하게 고릅니다.
- 선택한 슬롯의 묶음 전체를 훔칩니다. 갑옷, 보조 손, 엔더 상자는 제외합니다.
- 인벤토리가 비어 있으면 그 차례는 건너뜁니다.
- 아이템의 수량, 이름, 인챈트, 내구도, 셜커 상자 내용 등 아이템 데이터를 복사합니다.
- 주민을 처치하면 훔친 플레이어의 빈 인벤토리 슬롯에 원본 묶음을 바로 돌려줍니다.
- 빈 슬롯이 없으면 주인 발밑에 정지한 상태로 떨어뜨리고 안내합니다. 이 아이템은 주인만 주울 수 있습니다.
- 주인이 오프라인/사망/관전자 상태면 보관 마커를 유지하고, 돌아왔을 때 해당 청크가 로드되어 있으면 반환합니다.
- 도둑이 나타난 뒤 200게임틱(정상 속도에서 10초) 안에 잡아야 합니다.
- 시간 안에 잡지 못하면 피해자 화면 중앙에 “주민을 못 잡았다”를 표시하고 주민이 사라집니다.
- 시간 초과로 사라진 도둑이 훔친 아이템은 잃습니다. 처치와 시간 초과가 같은 틱이면 처치 반환을 우선합니다.
- 자연사해도 반환됩니다. 바닥에 반환된 아이템은 5분 후 사라집니다.
- 도둑마다 별도 보관하므로 이전 도둑이 남아 있어도 다음 도둑이 등장합니다.
- 크리에이티브/관전자에서는 자동으로 훔치지 않습니다.
- 기본 3개 차원 지원. 청크가 내려가면 도둑과 물건은 저장되며 다시 불러오면 처리됩니다.
- 멀티플레이에서 도둑은 가장 가까운 관전자 외 플레이어에게서 도망갑니다.
명령어
/function thief:test 지금 바로 한 번 훔치기 (플레이어가 실행, 시작 상태에서 사용)
/function thief:stop 새 도둑 출현 중지
/function thief:start 다시 시작, 타이머 초기화
/function thief:recover 불러온 청크의 모든 도둑 물건을 주인에게 반환 (주인 정보 없는 구버전 물건은 현장에 반환)
제거
/function thief:stop 후 도둑을 잡거나 /function thief:recover 로 회수하세요.
멀리 떨어진 도둑은 그 청크로 돌아가 회수한 뒤 월드를 종료하고 ZIP을 제거하세요.
구현 및 제한
- 주민의 이동은 명령어로 제어합니다. 평지와 단순한 한 블록 높이 지형에 적합합니다.
- 평지 이동 속도는 초당 약 4.49블록(틱당 0.22448블록)으로, 효과 없는 일반 달리기의 약 80%입니다. 달리기 점프나 신속 효과는 기준에서 제외합니다.
- 발밑을 확인해 공중에서는 아래로 내려보내므로, 오르막/내리막이나 공중 소환 후 바닥에 내려옵니다.
- 벽에 막히면 좌우/뒤쪽을 포함한 12방향으로 이동 가능성을 탐색하고, 선택한 우회 방향을 1초간 유지합니다.
- 몸과 머리 공간을 확인하여 벽을 관통하는 이동을 피합니다. 복잡한 미로를 푸는 완전한 길찾기 AI는 아닙니다.
- 장비 드롭에 의존하지 않고 보이지 않는 동승 마커에 원본 아이템을 저장합니다.
- 손의 아이템은 표시용이며 드롭 확률을 0으로 설정하여 두 번 반환되지 않게 합니다.
- 엔티티 일괄 삭제 명령/플러그인으로 마커까지 지우면 물건이 사라질 수 있습니다.
- 공식 Minecraft Java 1.21.4 로컬 서버와 자동 접속 클라이언트로 이동, 도난, 인챈트 아이템 반환/줍기, 보스바, 실패 문구 전달, 200틱 제한을 검증했습니다.
- 그래픽 클라이언트 화면의 시각 검사는 하지 않았습니다.
호환 기준: 공식 Java 1.21.4 릴리스 노트의 데이터팩 버전 61
https://www.minecraft.net/en-us/article/minecraft-java-edition-1-21-4