lumien231 / Custom-Main-Menu

A mod that allows you to modify the minecraft main menu
MIT License
67 stars 37 forks source link

Problem with resource loading etc. #193

Open poenatic opened 7 years ago

poenatic commented 7 years ago

Hello, I am trying to make a "Skyrim - Themed" Modpack with whole Story, Quest,.. etc but there is one problem. I trying to make a Skyrim designed Minecraft menu, but there is a problem with the loading of resources (or with something else, Im not into coding or something). So what exacly happening is that some textures are missing and they were repaced with pink/black cancer or in case of the backround the backround is just black (480x270). By the way I am using CustomMainMenu with Resource Loader.

Paths: 1. ".minecraft\resources\Skyrim\textures\backround"

  1. ".minecraft\resources\Skyrim\textures\gui"
  2. ".minecraft\resources\Skyrim\textures\logo"

mainmenu.json:

{ "images": { "title": { "image" : "Skyrim:/textures/backround/image.png", "posX" : -238, "posY" : 222, "width" : 512, "height" : 512, "alignment" : "top_center" } },

"buttons":
{
    "singleplayer":
    {
        "text" : "Einzelspieler",
        "posX" : 150,
        "posY" : 48,
        "width" : 98,
        "height" : 20,
        "texture" : "Skyrim:textures/gui/buttonspielen.png",
        "action" : 
        {
            "type" : "openGui",
            "gui" : "singleplayer"
        }
    },

    "multiplayer":
    {
        "text" : "Mehrspieler",
        "posX" : 150,
        "posY" : 62,
        "width" : 98,
        "height" : 20,
        "texture" : "Skyrim:textures/gui/buttonserver.png",
        "action" : 
        {
            "type" : "openGui",
            "gui" : "multiplayer"
        }
    },

    "options":
    {
        "text" : "Optionen",
        "posX" : 150,
        "posY" : 76,
        "width" : 98,
        "height" : 20,
        "texture" : "Skyrim:textures/gui/buttonoption.png",
        "action" : 
        {
            "type" : "openGui",
            "gui" : "options"
        }
    },

    "quit":
    {
        "text" : "menu.quit",
        "posX" : 150,
        "posY" : 100,
        "width" : 98,
        "height" : 20,
        "texture" : "Skyrim:textures/gui/buttonbeenden.png",
        "action" : 
        {
            "type" : "quit"
        }
    },

    "refresh":
    {
        "text" : "",
        "posX" : -154,
        "posY" : 132,
        "width" : 20,
        "height" : 20,
        "texture" : "custommainmenu:textures/gui/buttons.png",
        "action" : 
        {
            "type" : "refresh"
        }
    }
},

"texts":
{

},

"other":
{
    "image":
    {
        "image" : "Skyrim:textures/backround/image.png",
        "mode" : "stretch"
    }
}

}

So what I would to know is if I did something wrong or if there is some bug or something becouse I made the same thing I think one or two jears ago and everything was perfectly working. And is there anything to think of when youre making a new backround like size or something? If you need something like logs just tell me and I going to screenshot it or copy paste it to you.

Cyanide55385 commented 7 years ago

Do you have resource loader installed?

Shazuli commented 6 years ago

You misspelled the source address. It should be: "image" : "Skyrim:textures/backround/image.png", if your first folder in the resource folder is: Skyrim. Then you just need to do forward slash until you get to the right .png file. Oh, there seems to be a bug that you can't have capital letter in either the folder or file names. And the mod that loads the custom resources (Resource Loader) only loads stuff to the game at launch. So if you want to add a new file to your menu, you need to restart the game. Otherwise it will say it doesn't exist. The refresh button only refresh the script, not the resources. Hopefully this will help! :D

janagyjr commented 6 years ago

I'm having a similar issue, however I'm not using resource loader. I just want to add in a custom menu background for my modpack (1.7.10, TCG's Chill Pack):

"background": { "image" : "file:chillpack:textures/gui/background.png", "mode" : "fill" }

path to file from within the instance is resources/chillpack/textures/gui/background.png

Edit: [17:58:56] [Client thread/WARN]: Failed to load texture: file:chillpack:textures/gui/background.png java.io.FileNotFoundException: file:chillpack:textures/gui/background.png

It fails with or without file: preceding the rest of it.

I've restarted the client multiple times, and @Shazuli's comment is the closest I've been to getting this to work, but I'm still getting this:

image

Shazuli commented 6 years ago

In order to have custom stuff in your meny @janagyjr you need to have Resource Loader installed. There is no way around it am I afraid. The RL mod uses a library that handles Input and Output (IO) (hence the error: java.io.FileNotFoundException). The CMM mod is almost useless without RL, the only thing you can use then is files that are already loaded, such as: Mods content, vanilla Minecraft textures, etc. That is also why if you add a new resource to your folder you have to re-start the game in order to put everything back into RAM. That is why it sometimes takes so long for MC with many mods installed to load. It goes through every single file and loads it into the game. If you still have problem with getting your custom background to work I'll send you a copy of a project I never finished you can use as preference.

janagyjr commented 6 years ago

Oh my goodness, why even have them as separate mods then?!

Thanks for the help.

lumien231 commented 6 years ago

Oh my goodness, why even have them as separate mods then?!

Because Resource Loader can be used without CMM? You can use it to load custom stuff for other mods or override resources without a texture pack.

LukasDoesDev commented 5 years ago

Im having also a similar issue, the button texture does not show. the button json: "LukasYT": { "text" : "", "posX" : -180, "posY" : 132, "width" : 20, "height" : 20, "texture" : "modpack:textures/YTButton.png", "action" : { "type" : "openLink", "link": "https://bit.ly/SubToLukas" } }, and the YTButton.png's path from the instance is (CoolMods is name of my instance you can think it as .minecraft) CoolMods/resources/modpack/textures/YTButton.png

LukasDoesDev commented 5 years ago

oh, it works! i restarted the game and the images appeared

DarkSkywalker8 commented 5 years ago

Hello there, I installed Custom Main Menu mod, as well as Resource Loader (1.12.2 with other mods (82 in total) + optifine), followed your steps, and, an image I want to be displayed, appears in black & pink/purple (It's some kind of band on the left with the different buttons displayed above it). Can you help me to figure out what's wrong?

here's the result (black+pink squares) (+the bottom text is centered in full screen, so it doesn't really matter if it is a bit decentered in windowed mode):

aa

here is the location of the file (it is called 'transparent.png'):

a

and here's the config, it's located in 'bandeau' section, everythings works except that:

{
    "images":
    {
        "bandeau":
        {
            "image" : "textures:gui/transparent.png",
            "posX" : -310,
            "posY" : 0,
            "width" : 224,
            "height" : 373,
            "alignment" : "top_center"
        },

    "title":
        {
            "image" : "custommainmenu:textures/gui/minecraft.png",
            "posX" : -298,
            "posY" : 20,
            "width" : 375,
            "height" : 375,
            "alignment" : "top_center"
        },

        "edition":
        {
            "image" : "custommainmenu:textures/gui/edition.png",
            "posX" : -235,
            "posY" : 47,
            "width" : 96,
            "height" : 12,
            "alignment" : "top_center"
        }

    },

    "buttons":
    {
        "singleplayer":
        {
            "text" : "menu.singleplayer",
            "posX" : -298,
            "posY" : 28,
            "width" : 200,
            "height" : 20,
            "action" : 
            {
                "type" : "openGui",
                "gui" : "singleplayer"
            }
        },

        "multiplayer":
        {
            "text" : "menu.multiplayer",
            "posX" : -298,
            "posY" : 52,
            "width" : 200,
            "height" : 20,
            "action" : 
            {
                "type" : "openGui",
                "gui" : "multiplayer"
            }
        },

        "mods":
        {
            "text" : "fml.menu.mods",
            "posX" : -298,
            "posY" : 76,
            "width" : 74,
            "height" : 20,
            "action" : 
            {
                "type" : "openGui",
                "gui" : "mods"
            }
        },

        "options":
        {
            "text" : "menu.options",
            "posX" : -220,
            "posY" : 76,
            "width" : 74,
            "height" : 20,
            "action" : 
            {
                "type" : "openGui",
                "gui" : "options"
            }
        },

        "quit":
        {
            "text" : "menu.quit",
            "posX" : -298,
            "posY" : 100,
            "width" : 200,
            "height" : 20,
            "action" : 
            {
                "type" : "quit"
            }
        },

        "language":
        {
            "text" : "",
            "posX" : -142,
            "posY" : 76,
            "width" : 20,
            "height" : 20,
            "action" : 
            {
                "type" : "openGui",
                "gui" : "languages"
            }
        },

        "refresh":
        {
            "text" : "",
            "posX" : -118,
            "posY" : 76,
            "width" : 20,
            "height" : 20,
            "texture" : "custommainmenu:textures/gui/buttons.png",
            "action" : 
            {
                "type" : "refresh"
            }
        }
    },

    "labels":
    {
        "modpack name":
        {
            "text" : "Custom Minecraft 1.12.2 ModPack",
            "hoverText" : "§nCustom Minecraft 1.12.2 ModPack",
            "posX" : -618,
            "posY" : -20,
            "color" : -1,
            "alignment" : "bottom_right",
            "action" : 
            {
                "type" : "openGui",
                "gui" : "credits"
            }
        },

        "fml":
        {
            "text" : "",
            "posX" : 23,
            "posY" : -70,
            "color" : -1,
            "alignment" : "bottom_left"
        }
    },

    "other":
    {
        "splash-text":
        {
            "posX" : -98,
            "posY" : 55,
            "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
        }
    }
}

Thanks in advance (and sorry if there is some few language mistakes, I'm a 16 y/o French boy!)

Edit: Okay nevermind, I've fixed it, we need to set the image files in the mod, by opening it with winrar, now it works!

Capture

An idea about color codes?

Edit again: nevermind too, I fixed that thing, I now have an orange yellow kind color, the one I like! I discovered myself some type of hacker!