Nucleoid Creator Tools
本模组为 Nucleoid 生态系统实现了多种用于生成游戏内容的工具。
该模组目前的主要功能是对游戏地图创建的处理。
创建地图
任何小游戏都需要一个地图作为游戏发生的场所。虽然有时小游戏希望程序化地生成地图,但在许多情况下,手工建造的地图更受欢迎。
创建地图的第一步是打开一个地图工作区。地图工作区本质上只是一个你可以在其中进行建造的空间维度,之后可以将其导出为 Plasmid 可读取的地图模板文件。
通过运行以下命令可以打开一个空的虚空地图工作区:/map open <id>(例如 /map open bedwars:cubes)
所需的 id 是你工作区的唯一标识符,格式为 namespace:identifier。它应为全小写且不能包含空格。
你还可以使用自定义区块生成器创建工作区:/map open <id> like <dimension>(例如 /map open bedwars:nether like minecraft:nether)
在工作区之间移动
创建好工作区后,你需要能够在它们之间穿梭。
可以通过运行 /map join <id> 来实现,这将把你传送至该工作区所在的维度。
一旦进入工作区维度,你就可以自由建造任何你想要的东西!
同样,也可以通过运行 /map leave 来离开地图工作区并返回你之前的位置。
设置地图边界
当将地图导出以便加载到游戏中时,模组需要知道应包含世界的哪个区域。这是通过设置一个包围你的地图的框来控制实现的。
当你首次进入工作区时,你会注意到由粒子形成的一个框轮廓——这就是你的地图边界!你可以通过运行 /map bounds <id> <corner_1> <corner_2> 在工作区中更改它们。
id 是要设置边界的工作区 ID
corner_1 和 corner_2 是轴对齐包围盒的两个角
设置地图原点
通常情况下,你不需要更改地图工作区的原点。本质上,地图原点控制着地图导出后对应于 (0; 0; 0) 的方块位置。如果你把地图建在了错误的位置,并且希望在游戏实际开始时移动它,这会很有用。
例如,如果你的地图高出了 10 个方块,将原点设置为 (0; 10; 0) 将使导出的地图向下移动 10 个方块。
这可以通过 /map origin <id> <origin> 进行设置
id 是要设置原点的工作区 ID
origin 是要设置原点的方块位置
设置原点时要小心,不要导致你的地图超出边界!如果你将地图原点设置在低于地图边界下限 Y 坐标的位置,这意味着在导出的地图中,你的边界将会低于 y=0!
处理区域
拥有一个我们可以为小游戏加载的地图是有用的,但游戏逻辑缺少关于地图的任何有用信息。例如,你的小游戏如何知道在哪里生成玩家,或者在 Bedwars 中特定队伍的床位于何处?
这就是区域的作用:区域只是地图的一个命名区域,可用于向游戏代码传达应在其中发生某事的区域。地图上可以有多个同名区域,或者同一位置有多个不同名称的区域。对区域进行命名有助于向游戏代码标识每个区域代表什么。
创建区域
要开始创建区域,请运行:/give @s nucleoid_creator_tools:add_region。这将给你 Add Region 物品,你可以使用该物品通过选择两个角来轻松定义世界中的区域。
右键点击一个方块,应该会出现一个粒子框。这将开始通过选择第一个角来定义区域的过程。现在,当你环顾四周时,框的形状会与第二个角匹配。再次右键点击会选择当前注视的方块作为第二个角。
现在,你可以运行 /map region commit <marker>。这会将高亮显示的区域添加到你的地图中,并使用给定的 marker,它应该会以不同颜色的粒子高亮显示。
在使用 Add Region 物品选择区域时,你还可以通过潜行并右键点击来更改选择模式。这将循环切换 3 种模式:
- 偏移模式:高亮的方块是你正在注视的方块,根据你从哪一侧观察它而进行偏移(类似于放置方块)
- 精确模式:高亮的方块正是你正在注视的方块(类似于破坏方块)
- 脚下模式:高亮的方块是你脚下的方块
有用的区域命令
/map region rename all <old> <new>:将当前工作区中的所有区域从 old 重命名为 new
/map region rename here <old> <new>:将当前工作区中与你的玩家相交的所有区域从 old 重命名为 new
/map region remove here: 移除当前工作区中与你的玩家相交的所有区域
/map region remove at <pos>:移除当前工作区中与给定 pos 相交的所有区域
附加数据
可能希望向代码传达比仅区域更多的有关地图的信息。这可以通过附加任意 NBT 数据来实现,这些数据随后可以由代码访问。
数据可以附加到区域或整个地图上。
要在特定区域上处理数据,你的玩家必须与该区域的边界相交!
/map region data <marker> get:打印给定区域的数据
/map region data <marker> set <data>:设置给定区域的数据(这将覆盖之前存在的任何数据!)
/map region data <marker> merge <data>:将给定数据与给定区域上的现有数据合并
还可以将数据传递给区域提交命令:/map region commit <marker> <data>
要在全球地图上进行数据操作,命令的功能类似:
/map data get:打印附加到地图上的数据
/map data set <data>:覆盖地图上现有的数据
/map data merge <data>:将给定数据与地图上现有的数据进行合并
导出地图
当你的地图完成后,需要将其导出为一个可以由迷你游戏模组加载的文件。只需运行以下命令即可完成:/map export <id>。
导出的地图将被放置在 /nucleoid_creator_tools/exports/<namespace>/map_templates/<path>.nbt
Nucleoid Creator Tools
This mod implements various tools for generating game content for the Nucleoid ecosystem.
The main current functionality with this mod is the handling of game map creation.
Creating a Map
Any minigame needs a map for the game to take place within. While sometimes a minigame may want to generate the map procedurally, in many cases, hand-built maps are desirable.
The first step to creating a map is opening a map workspace. A map workspace is essentially just a dimension that you can build within, which can later be exported into a map template file readable by Plasmid.
An empty void map workspace can be opened by running: /map open <id> (e.g. /map open bedwars:cubes)
The required id is a unique identifier for your workspace in namespace:identifier format. It should be all lowercase and cannot have spaces.
You are also able to create workspaces with custom chunk generators: /map open <id> like <dimension> (e.g. /map open bedwars:nether like minecraft:nether)
Moving in and out of workspaces
Once you have created a workspace, you need to be able travel between them.
This is possible by running: /map join <id>, which will teleport you into that workspace dimension.
Once you are in the workspace dimension, you are free to build whatever you want!
Likewise, it is possible to leave a map workspace and return to your former location by running: /map leave.
Setting the map bounds
When exporting a map to be loaded into a game, the mod needs to know the area of the world which should be included. This is controlled by setting a box that encompasses your map.
When you first enter a workspace, you will notice a box outline formed by particles- these are your map bounds! They can be changed in a workspace by running: /map bounds <id> <corner_1> <corner_2>.
id is the workspace id to set bounds for
corner_1 and corner_2 are the two corners of the axis-aligned bounding box
Setting the map origin
More often than not, you will not need to change the origin of a map workspace. Essentially, though, the map origin controls the block position that will correspond to (0; 0; 0) once the map is exported. This is useful if you built your map in the wrong place, and want to move it when the game actually starts.
For example, if your map is 10 blocks too high, setting your origin to (0; 10; 0) will result in the exported map moving 10 blocks downward.
This can be set through /map origin <id> <origin>
id is the workspace id to set the origin for
origin is the block position to set the origin to
Be careful when setting origin to not cause your map to go out of bounds! If you set your map origin somewhere below the lower y of your map bounds, that will mean in the exported map, your bounds will be going below y=0!
Working with regions
Having a map that we can load for a minigame is useful, but the game logic is missing any sort of useful information about the map. For example, how can your minigame know where to spawn players, or where the bed for a specific team in bedwars is located?
This is where regions come in: a region is just a named area of the map which can be used to communicate to the game code an area in which something should happen. There can be multiple regions in the map with the same name, or multiple regions with different names in the same location. The naming of regions is useful in order to identify to the game code what each region represents.
Creating a region
To get started with creating a region, run: /give @s nucleoid_creator_tools:add_region. This gives you the Add Region item, which can be used to easily define regions within your world by selecting two corners.
By right clicking on a block, a particle box should appear. This starts the process of defining a region by selecting the first corner. Now, as you look around, the box will shape to match the second corner. Right clicking a second time will select the current looked-at block as the second corner.
Now, you can run /map region commit <marker>. This will add the highlighted region to your map with the given marker, and it should highlight with differently colored particles.
When selecting a region with the Add Region item, you can additionally change the selection mode by sneaking & right clicking. This cycles through 3 modes:
- offset mode: the highlighted block is the block you are looking at, offset by the side you are looking at it from (like placing a block)
- exact mode: the highlighted block is the exact block your are looking at (like breaking a block)
- at feet mode: the highlighted block is the block at your feet
Useful region commands
/map region rename all <old> <new>: renames all regions in the current workspace from old to new
/map region rename here <old> <new>: renames all regions intersecting with your player in the current workspace from old to new
/map region remove here: removes all regions intersecting with your player from the current workspace
/map region remove at <pos>: removes all regions intersecting with the given pos from the current workspace
Attaching data
It may desirable to communicate more information about the map to the code than just regions. This can be done by attaching arbitrary NBT data which is later accessible by the code.
Data can be either attached to a region or to the map as a whole.
To work with data on a specific region, your player must be intersecting that region's bounds!
/map region data <marker> get: prints the data for the given region
/map region data <marker> set <data>: sets the data for the given region (this will overwrite any previously existing data!)
/map region data <marker> merge <data>: merges the given data with the existing data on the given region
It is additionally possible to pass data to the region commit command: /map region commit <marker> <data>
To work with data on the global map, the commands function similarly:
/map data get: prints the data attached to the map
/map data set <data>: overwrites the existing data on the map
/map data merge <data>: merges the given data with the existing data on the map
Exporting maps
Once your map is complete, you will want to export it into a file that can be loaded by a minigame mod. This can be done simply by running: /map export <id>.
The exported map will be placed in /nucleoid_creator_tools/exports/<namespace>/map_templates/<path>.nbt
评论 0
登录后参与评分
还没有评论,来抢沙发吧