查看“模组:编辑 XNB 文件”的源代码
←
模组:编辑 XNB 文件
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看和复制此页面的源代码。
←[[使用模组:目录|目录]] 本页描述了如何编辑游戏文件以更改游戏中的数据、图像和地图。 ==介绍== ===什么是 XNB 文件?=== 游戏将数据、地图和纹理 存储在 <tt>.xnb</tt> 这种压缩数据文件中,它们在游戏的 <tt>Content</tt> 文件夹中。 例如,对话期间显示的阿比盖尔的头像来自这个文件: <tt>Content\Portraits\Abigail.xnb</tt>。解包这个文件,你会得到 <tt>Abigail.png</tt> 这个图片文件,内容如下:<br />[[File:Modding - creating an XNB mod - example portraits.png]] (如果你使用 xnbcli 来解包,你通常会得到 <tt>Abigail.json</tt> 文件。 那只是用来打包回 <tt>.xnb</tt> 所需的文件,通常不需要更改它。) ===如何将更改应用到游戏中?=== 有3个方法可以使你的修改应用到游戏中: # 创建一个 [https://www.nexusmods.com/stardewvalley/mods/1915 Content Patcher] 内容包。这不需要编程,仅编辑 JSON 文件就可以更改游戏的 XNB 数据,也无需替换实际的游戏文件。 # [[模组:创建模组/创建 SMAPI 模组|制作一个 SMAPI 模组]] 并使用 [[模组:创建模组/APIs/Content|内容 API]]。不过,这需要编程。 # 通过替换原始游戏文件来创建 XNB 模组。不再建议使用,本页面没有讲解; 访问 [[模组:使用 XNB 模组|使用 XNB 模组]] 获取更多信息。 ===在哪里可以得到帮助?=== 欢迎访问星露谷模组社区。Feel free to [[模组:Community|ask the community]] for help. ==<span id="unpacking">解包游戏文件</span>== 你无法编辑 <tt>.xnb</tt> 文件其本身,你需要编辑其中的文件 <br> 将文件从中取出叫做 '''解包''' <br> 把文件放入其中叫做 '''打包''' <br> 有两个主要的 XNB 解包工具可用: ===StardewXnbHack=== {{github|Pathoschild/StardewXnbHack#readme|StardewXnbHack}} 是用于解包 XNB 文件的开源且跨平台的工具<br> 它不能打包回 <tt>.xnb</tt> 不过你会需要 [[模组:创建模组/Content Patcher|创建内容包]] :; on Linux/Mac ::* '''[https://www.winehq.org/download Wine 1.7 or later]''' to run Windows programs like XNB Extract. ::* '''[https://www.dropbox.com/s/oj5tch8np74nk4d/XNBExtract0.2.2.zip?dl=0 XNB Extract 0.2.2 for Linux/Mac]''' to unpack and pack the game's XNB files. ::* '''[https://www.gimp.org/downloads/ GIMP]''' to edit image files (or use your favourite image editor). You should also back up your game's <tt>Content</tt> folder, so you can recover the original files if you make a mistake. ===Unpack & pack game files=== <span id="unpacking"></span> You can't edit an <tt>.xnb</tt> file itself, you need to edit the file that's inside it. Pulling out that inner file is called ''unpacking'', and putting it back is called ''packing''. Here's how to do it: # Download XNB Extract (see [[#First-time setup]]). # Unpack the file for editing: ## Find the file you want to edit in the <tt>Contents</tt> folder. ## Copy it into XNB Extract's <tt>Packed</tt> folder. ## Double-click <tt>UnpackFiles.bat</tt> (Windows) or <tt>UnpackFiles.sh</tt> (Linux/Mac). # Edit the unpacked file (see below). # Repack the file for the game: ## Double-click <tt>PackFiles.bat</tt> (Windows) or <tt>PackFiles.sh</tt> (Linux/Mac). ## Move the repacked <tt>.xnb</tt> file back to the original location. ==Making changes== ===Spritesheets, tilesheets, or portraits=== [[File:Modding - creating an XNB mod - example tilesheet.png|thumb|An example tilesheet, which consists of a grid of tiles like this: [[File:Modding - creating an XNB mod - example tile 1.png]]]] Definitions: * A '''spritesheet''' is a PNG file containing small images in a regular grid pattern. Each square in the spritesheet's grid pattern is called a '''sprite'''. For example, each in-game item has a sprite in <tt>Content\Maps\spring_objects.xnb</tt>. * A '''tilesheet''' is a synonym for spritesheet when used for map tiles. In a tilesheet, each square is called a ''tile'' and is 16×16 pixels. * A '''portrait''' is a sprite from the <tt>Content\Characters\*.xnb</tt> spritesheets. Spritesheets are easy to edit: # [[#unpacking|Unpack the file]] you want to change. # Open the unpacked <tt>.png</tt> file in an image editor (see [[#Getting started]]). # Make changes directly to the image. # [[#unpacking|Repack the file]] and copy it back to the original location. That's it! You can launch the game to see your changes. ===地图=== 请见:[[使用模组:地图]] [[Category:模组]] [[en:Modding:Editing XNB files]] [[ru:Модификации:Редактирование XNB файлов]]
该页面使用的模板:
Template:Executable name
(
查看源代码
)
Template:Github
(
查看源代码
)
Template:Nexus mod
(
查看源代码
)
返回至
模组:编辑 XNB 文件
。
导航菜单
个人工具
创建账户
登录
名字空间
模组
讨论
不转换
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
台灣正體
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
未翻译的页面
帮助:编辑入门
随机页面
官方链接
官方网站
官方论坛
官方商品
Discord
Reddit
工具
链入页面
相关更改
上传文件
特殊页面
页面信息