Maze Wand:威尔逊迷宫生成器
用魔杖构建迷宫。迷失其中,但绝不被困。
概述
Maze Wand 是一款适用于 Minecraft Java 版的原生数据包,可在你的世界内直接生成可自定义的迷宫。
当该数据包首次检测到玩家时,会自动给予一支发光的 Magic Wand。右键点击魔杖会打开一个可点击的聊天菜单(日文界面),用于生成迷宫、调整维度、选择材质以及管理最新生成的迷宫。
入口将在玩家所在位置创建,并且迷宫将向 +X 和 +Z 方向延伸。
无需安装任何模组或资源包。
功能特性
- 通过可点击的 Magic Wand 菜单生成迷宫
- 配置 X 轴和 Z 轴方向的迷宫单元格数量
- 更改路径宽度、墙壁厚度和墙壁高度
- 以玩家脚下的方块作为迷宫材质
- 手动设置任意有效的方块 ID
- 自动使用墙壁材质生成实心地板
- 在生成过程中显示进度消息
- 停止正在进行的生成过程
- 删除或重新生成最新的迷宫
- 支持传统的
/function 命令
- 在无人为尺寸限制的情况下生成迷宫
迷宫生成原理
Maze Wand 使用 威尔逊算法(Wilson’s Algorithm),这是一种基于圈消除随机游走的迷宫生成方法。
- 整个迷宫区域最初被填充为所选材质。
- 一个未访问的单元格开始随机游走。
- 当游走路径回环到自身时,消除该环路。
- 当游走路径接触到已有迷宫结构时,保留剩余路径并将其挖空。
- 持续此过程,直到所有迷宫单元格都被连接。
由于方向是随机选择的,生成的迷宫具有较少的方向偏差,且重复的道路网格模式较少。
挖空完成后,数据包会执行 BFS 可达性检查。仅当入口和出口存在且可以从起点到达目标点时,迷宫才会被标记为完成。
使用方法
- 将
MazeGenerator_26_1_2.zip 放入世界的 datapacks 文件夹中,不要解压。
- 重新进入世界或运行
/reload。
- 右键点击自动提供的 Magic Wand。
- 打开设置菜单并配置迷宫。
- 站在希望创建入口的位置。
- 选择 Generate Maze。
如果丢失了魔杖,请使用以下命令:
/function maze:give_wand
可用设置
| 设置项 |
描述 |
| X轴路径数量 |
X 轴方向的迷宫单元格数量 |
| Z轴路径数量 |
Z 轴方向的迷宫单元格数量 |
| 路径宽度 |
每个可通行通道的宽度 |
| 墙壁厚度 |
通道之间墙壁的厚度 |
| 墙壁高度 |
迷宫墙壁的垂直高度 |
所有值的最小值为 1。
迷宫材质
有两种方式选择墙壁和地板材质:
- 自动选择: 站在期望的方块上,从 Magic Wand 菜单中选择地板材质选项。
- 方块 ID 选择: 使用
maze:set_material 输入有效的方块 ID。
示例:
/function maze:set_material {block:"minecraft:diamond_block"}
所选材质将同时用于墙壁和自动生成的地板。
高级命令
/function maze:help
/function maze:give_wand
/function maze:set_material {block:"minecraft:diamond_block"}
/function maze:generate {w:21,d:21,h:4,wall:1,path:2,block:"minecraft:stone_bricks"}
/function maze:cancel
在直接生成命令中:
w: X 轴方向的迷宫单元格数量
d: Z 轴方向的迷宫单元格数量
h: 墙壁高度
wall: 墙壁厚度
path: 路径宽度
block: 墙壁和地板材质
特殊尺寸
1x1: 起点和终点使用同一个单元格。
1xN 和 Nx1: 生成一条直线通道,入口和出口位于两端。
- 小型双单元格宽度的迷宫使用与普通迷宫相同的可达性验证。
兼容性
已在以下版本测试成功:
- Minecraft Java Edition 26.1.2
- Minecraft Java Edition 26.2
重要提示
世界修改警告: 迷宫生成会覆盖方块并清除生成区域内的通道。在生成迷宫前请备份重要世界。
删除警告: “Delete Latest Maze” 会清除已生成的区域。它不是一个完整的撤销系统,也不会恢复原始地形。
性能警告: 极大尺寸的迷宫可能导致严重卡顿、世界冻结或 Minecraft 崩溃。大规模迷宫生成风险自负。
一次只能生成一个迷宫。
为防止内部 /trigger 消息出现在聊天栏中,该数据包在加载时会禁用世界的 command-feedback 游戏模式规则。
Maze Wand: Wilson Maze Generator
Build mazes with a wand. Get lost, but never trapped.
Overview
Maze Wand is a vanilla data pack for Minecraft Java Edition that generates customizable mazes directly inside your world.
When the data pack detects a player for the first time, it automatically gives them a glowing Magic Wand. Right-clicking the wand opens a clickable Japanese chat menu for generating mazes, changing their dimensions, selecting materials, and managing the latest maze.
The entrance is created at the player’s position, and the maze extends toward the +X and +Z directions.
No mod or resource pack is required.
Features
- Generate mazes through a clickable Magic Wand menu
- Configure the number of maze cells along the X and Z axes
- Change the path width, wall thickness, and wall height
- Use the block beneath the player as the maze material
- Set any valid block ID manually
- Automatically generate a solid floor using the wall material
- Display progress messages during generation
- Stop an active generation process
- Delete or regenerate the latest maze
- Use traditional
/function commands
- Generate mazes without an artificial size limit
How Maze Generation Works
Maze Wand uses Wilson’s Algorithm, a maze-generation method based on loop-erased random walks.
- The complete maze area is initially filled with the selected material.
- An unvisited cell begins a random walk.
- When the walk loops back into itself, the loop is erased.
- When the walk reaches the existing maze, the remaining path is carved.
- The process continues until every maze cell has been connected.
Because directions are selected randomly, the resulting maze has less directional bias and fewer repetitive road-grid patterns.
After carving is complete, the data pack performs a BFS reachability check. The maze is only marked as complete when the entrance and exit exist and the goal can be reached from the start.
How to Use
- Place
MazeGenerator_26_1_2.zip in the world’s datapacks folder without extracting it.
- Re-enter the world or run
/reload.
- Right-click the automatically provided Magic Wand.
- Open the settings menu and configure the maze.
- Stand where the entrance should be created.
- Select Generate Maze.
If the wand is lost, use:
/function maze:give_wand
Available Settings
| Setting |
Description |
| X-axis path count |
Number of maze cells along the X axis |
| Z-axis path count |
Number of maze cells along the Z axis |
| Path width |
Width of each walkable passage |
| Wall thickness |
Thickness of the walls between passages |
| Wall height |
Vertical height of the maze walls |
All values have a minimum of 1.
Maze Materials
There are two ways to select the wall and floor material:
- Automatic selection: Stand on the desired block and select the floor-material option from the Magic Wand menu.
- Block ID selection: Enter a valid block ID with
maze:set_material.
Example:
/function maze:set_material {block:"minecraft:diamond_block"}
The selected material is used for both the walls and the automatically generated floor.
Advanced Commands
/function maze:help
/function maze:give_wand
/function maze:set_material {block:"minecraft:diamond_block"}
/function maze:generate {w:21,d:21,h:4,wall:1,path:2,block:"minecraft:stone_bricks"}
/function maze:cancel
In the direct generation command:
w: Number of maze cells along the X axis
d: Number of maze cells along the Z axis
h: Wall height
wall: Wall thickness
path: Path width
block: Wall and floor material
Special Sizes
1x1: The start and goal use the same cell.
1xN and Nx1: A straight passage is generated with the entrance and exit at opposite ends.
- Small two-cell-wide mazes use the same reachability verification as regular mazes.
Compatibility
Tested successfully on:
- Minecraft Java Edition 26.1.2
- Minecraft Java Edition 26.2
Important Notes
World modification warning: Maze generation overwrites blocks and clears passages inside the generated area. Back up important worlds before generating a maze.
Deletion warning: “Delete Latest Maze” clears the generated area. It is not a complete undo system and does not restore the original terrain.
Performance warning: Extremely large mazes may cause severe lag, freeze the world, or crash Minecraft. Huge maze generation is performed entirely at your own risk.
Only one maze can be generated at a time.
To prevent internal /trigger messages from appearing in chat, the data pack disables the world’s command-feedback gamerule while loaded.
评论 0
登录后参与评分
还没有评论,来抢沙发吧