After your first run with this mod the only difference you should notice is that there is an additional button added in your main menu. If you look in the config/CustomMainMenu folder you will notice a file called menu.json. In there you will see all elements the vanilla main menu has, modifying the content and pressing the refresh button ingame will allow you to instantly see what changes you made (You can remove the refresh button once you are happy with your result). Everything in there should be fairly self explanatory if you have ever worked with json files. See the Pages for more Information about the different stuff you can add to your menu.For the texture / image /tect property it takes a resource location (or (for images) if you use web as your resource domain an url to an image online). You can add your own resources ones using either a resource pack or Resource Loader (easier).
第一次运行游戏后,主菜单里有一个额外的按钮(ctrl+r)。如果你看看在config/custommainmenu的文件夹,你会看到一个名为menu.json的档案,并可以在那里修改所有的主菜单东西。修改后便可以按刷新按钮(ctrl+r),你马上就会看到您所做的修改(你可以删除刷新按钮(ctrl+r)如果你满意你的结果)。如果你用过json的话你应该熟悉那里的东西。至于材质,图像等需要提供改材质/图像的位置如果你使用url来上传图片。你也可以使用材质包加增材质。作者推荐的工具: - 事前工作: 安装ResourceLoader 安装完ResourceLoader mod后,.minecraft会出现resources文件夹: resource就是用来存放图片,文字档等资源 在resource里建立一个资文件夹,用来存放某个主题要用到的资源 - 游戏内会在语言选择旁出现一个重新整理按钮(刷新) 每次对文件做修改后按一下此按钮(或是CTRL + R),就会立刻更新画面。
注意事项 ResourceLoader并非必要,安装ResourceLoader只是方便修改图片。 如果不想使用此mod,建议参考debug解决方法那里 - 在config里,Custom Main Menu是长这样的(安装完此mod后,在游戏主文件>config>CustomMainMenu>mainmenu): - {
- "images":
- {
- "title":
- {
- "image" : "custommainmenu:textures/gui/minecraft.png",
- "posX" : -137,
- "posY" : 30,
- "width" : 512,
- "height" : 512,
- "alignment" : "top_center"
- },
-
- "edition":
- {
- "image" : "custommainmenu:textures/gui/edition.png",
- "posX" : -49,
- "posY" : 67,
- "width" : 128,
- "height" : 16,
- "alignment" : "top_center"
- }
- },
-
- "buttons":
- {
- "singleplayer":
- {
- "text" : "menu.singleplayer",
- "posX" : -100,
- "posY" : 48,
- "width" : 200,
- "height" : 20,
- "action" :
- {
- "type" : "openGui",
- "gui" : "singleplayer"
- }
- },
-
- "multiplayer":
- {
- "text" : "menu.multiplayer",
- "posX" : -100,
- "posY" : 72,
- "width" : 200,
- "height" : 20,
- "action" :
- {
- "type" : "openGui",
- "gui" : "multiplayer"
- }
- },
-
- "mods":
- {
- "text" : "fml.menu.mods",
- "posX" : -100,
- "posY" : 96,
- "width" : 200,
- "height" : 20,
- "action" :
- {
- "type" : "openGui",
- "gui" : "mods"
- }
- },
-
- "options":
- {
- "text" : "menu.options",
- "posX" : -100,
- "posY" : 132,
- "width" : 98,
- "height" : 20,
- "action" :
- {
- "type" : "openGui",
- "gui" : "options"
- }
- },
-
- "quit":
- {
- "text" : "menu.quit",
- "posX" : 2,
- "posY" : 132,
- "width" : 98,
- "height" : 20,
- "action" :
- {
- "type" : "quit"
- }
- },
-
- "language":
- {
- "text" : "",
- "posX" : -124,
- "posY" : 132,
- "width" : 20,
- "height" : 20,
- "action" :
- {
- "type" : "openGui",
- "gui" : "languages"
- }
- },
-
- "refresh":
- {
- "text" : "",
- "posX" : -154,
- "posY" : 132,
- "width" : 20,
- "height" : 20,
- "texture" : "custommainmenu:textures/gui/buttons.png",
- "action" :
- {
- "type" : "refresh"
- }
- }
- },
-
- "labels":
- {
- "mojang":
- {
- "text" : "Copyright Mojang AB. Do not distribute!",
- "hoverText" : "?Copyright Mojang AB. Do not distribute!",
- "posX" : -197,
- "posY" : -10,
- "color" : -1,
- "alignment" : "bottom_right",
- "action" :
- {
- "type" : "openGui",
- "gui" : "credits"
- }
- },
-
- "fml":
- {
- "text" : "",
- "posX" : 2,
- "posY" : -40,
- "color" : -1,
- "alignment" : "bottom_left"
- }
- },
-
- "other":
- {
- "splash-text":
- {
- "posX" : 90,
- "posY" : 70,
- "color" : -256,
- "alignment" : "top_center",
- "texts" : "file:minecraft:texts/splashes.txt"
- },
-
- "panorama":
- {
- "images" : "minecraft:textures/gui/title/background/panorama_%c.png",
- "animate" : true,
- "animationSpeed" : 1,
- "blur" : true,
- "gradient" : true
- }
- }
- }
复制代码
我们可以看到里面有images,buttons,labels,other四个大集合, 其中又有许多的子集合。 - Image 这是负责放图片相关的物件,例如标题大大的Minecraft
(Edition是上图中写着Java edition那里) "image"是图片存放的路径 "posX、Y"是这个物件的座标 "width""height"是它的长度宽度 "alignment"是它校准位置
Button 这是按钮,例如:单人游戏、多人游戏等。
Others 这是logo旁的闪烁黄字、背景动画。
我们要在修改的就是把变数后面的值改掉,例如:(posX: 20 -> posX: 40) - 了解各项变数后,我们一起动手吧! 把Logo改成自己的图 把自己的图放在resources里 
然后打开mainmenu.json档案: 
把"image"后面的路径改成自己的图的位置 以我的resource资料夹为例 "image" : "custommainmenu:texture/gui/minecraft.png",会变成 "image" : "logo.png", Custom Main Menu就会会去抓取resources/里的资料, 这样Minecraft那块logo就变成你自己的图了。 大小位置再根据后面的变数去做调整。
把button换个材质 button里有个变数叫做texture(预设文件里面没有),它可以把button上那个丑(mei)丑(mei)的石头材质换成你的图,并且利 用"imageWidth","imageHeight"去调整texture图的大小,基本上需要调整成刚好那张图的大小 修改方法和把Logo改成自己的图一样 把材质放到resource里,然后把"image"后面的路径改成自己的材质的位置
注意事项 除了预设变数之外,其余编辑一律使用小写英文,包括路径、图档(命名时一律小写英文)!!! 同集合的参数、物件,后面还有东西的话,记得加逗号(json语法) (不是分号) 例如: "title": { "image" : "custommainmenu:texture/gui/minecraft.png", "posX" : -137, "posY" : 30, "width" : 512, "height" : 512, "alignment" : "top_center" <--后面没东西就不用加逗号 } 有bug的时候建议还原bug出现之前的动作,一步一步地找出原因。
死图 你可能遇到过:mod装了,resource文件夹有了,输入的图片路劲也正确,但跑出来却是这样: 
解决方法: 在mod文件夹里的CustomMainMenu.jar文件,用解压工具打开,进入到asset/custommainmenu/texture/gui 。而这个文件夹里的 文件都是预设主画面的图片。 
我们可以把这些图片直接替换成我们的图片,或著是把resource文件夹整个丟进去。 (记得要修改图片路径!) - 其实整个使用Custom Main Menu其实不是很难 难得可能是调整出我们需要的变数及debug 希望大家也能做出自己想要的主画面! |