lumien231 / Custom-Main-Menu

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

Random Slideshow? #347

Open lolapkfight opened 5 years ago

lolapkfight commented 5 years ago

I want to make my Slideshow randomized. but I don't know how to write the prperty. My current json file:

`{ "images": { "title": { "image" : "modpack:textures/mystic_legends.png", "posX" : -135, "posY" : 0, "width" : 270, "height" : 100, "alignment" : "top_center" },

    "edition":
    {
        "image" : "modpack:textures/modpack.png",
        "posX" : -42,
        "posY" : 67,
        "width" : 80,
        "height" : 40,
        "alignment" : "top_center"

    },

    "buttonbg":
    {
        "image" : "modpack:textures/buttonbg.png",
        "posX" : -250,
        "posY" : -10,
        "width" : 500,
        "height" : 60,
        "alignment" : "center"
    }
},

"buttons":
{
    "singleplayer":
    {
        "text" : "menu.singleplayer",
        "posX" : -225,
        "posY" : 0,
        "width" : 100,
        "height" : 20,
        "texture" : "modpack:textures/button.png",
        "alignment" : "center",
        "action" : 
        {
            "type" : "openGui",
            "gui" : "singleplayer"
        }
    },

    "multiplayer":
    {
        "text" : "menu.multiplayer",
        "posX" : -120,
        "posY" : 0,
        "width" : 100,
        "height" : 20,
        "texture" : "modpack:textures/button.png",
        "alignment" : "center",
        "action" : 
        {
            "type" : "openGui",
            "gui" : "multiplayer"
        }
    },

    "mods":
    {
        "text" : "fml.menu.mods",
        "posX" : -15,
        "posY" : 0,
        "width" : 100,
        "height" : 20,
        "texture" : "modpack:textures/button.png",
        "alignment" : "center",
        "action" : 
        {
            "type" : "openGui",
            "gui" : "mods"
        }
    },

    "options":
    {
        "text" : "menu.options",
        "posX" : 90,
        "posY" : 0,
        "width" : 100,
        "height" : 20,
        "texture" : "modpack:textures/button.png",
        "alignment" : "center",
        "action" : 
        {
            "type" : "openGui",
            "gui" : "options"
        }
    },

    "quit":
    {
        "text" : "menu.quit",
        "posX" : -65,
        "posY" : 25,
        "width" : 100,
        "height" : 20,
        "texture" : "modpack:textures/button.png",
        "alignment" : "center",
        "action" : 
        {
            "type" : "quit"
        }
    },

    "language":
    {
        "text" : "",
        "posX" : 200,
        "posY" : 25,
        "imageWidth" : 1500,
        "imageHeight" : 1500,
        "width" : 20,
        "height" : 20,
        "tooltip" : "Change Language",
        "texture" : "modpack:textures/language.png",
        "alignment" : "center",
        "action" : 
        {
            "type" : "openGui",
            "gui" : "languages"
        }
    },

    "refresh":
    {
        "text" : "",
        "posX" : 40,
        "posY" : 25,
        "width" : 20,
        "height" : 20,
        "texture" : "custommainmenu:textures/gui/buttons.png",
        "tooltip" : "refresh Resources",
        "alignment" : "center",
        "action" : 
        {
            "type" : "refresh"
        }
    },

    "bugs":
    {
        "text" : "",
        "posX" : 200,
        "posY" : 0,
        "imageWidth" : 800,
        "imageHeight" : 1050,
        "width" : 20,
        "height" : 20,
        "texture" : "modpack:textures/report.png",
        "tooltip" : "report Bugs",
        "alignment" : "center",
        "action" : 
        {
            "type" : "openLink",
            "link" : "https://forms.gle/NgNr5746d5xnE1RJ6"
        }
    },

    "more":
    {
        "text" : "",
        "posX" : 225,
        "posY" : 15,
        "imageWidth" : 250,
        "imageHeight" : 250,
        "width" : 20,
        "height" : 20,
        "texture" : "modpack:textures/more.png",
        "tooltip" : "Check my CurseForge Profile",
        "alignment" : "center",
        "action" : 
        {
            "type" : "openLink",
            "link" : "https://minecraft.curseforge.com/members/lolapkfight"
        }
    }
},

"labels":
{
    "mojang":
    {
        "text" : "lolapkfight",
        "hoverText" : "§nlolapkfight",
        "posX" : -55,
        "posY" : -10,
        "color" : -1,
        "alignment" : "bottom_right",
        "action" : 
        {
            "type" : "openGui",
            "gui" : "credits"
        }
    },

    "version":
    {
        "text" : "Mystic Legends 1.0",
        "posX" : 5,
        "posY" : -10,
        "color" : -200,
        "alignment" : "bottom_left",
        "action" : 
        {
            "type" : "version"
        }
    }

},

"other":
{
    "background": 

    { 
         "image" : "",
         "slideshow":
         {
              "images" : ["modpack:backgrounds/bg1.png","modpack:backgrounds/bg2.png","modpack:backgrounds/bg3.png","modpack:backgrounds/bg4.png","modpack:backgrounds/bg5.png","modpack:backgrounds/bg6.png","modpack:backgrounds/bg7.png","modpack:backgrounds/bg8.png","modpack:backgrounds/bg9.png","modpack:backgrounds/bg10.png","modpack:backgrounds/bg11.png","modpack:backgrounds/bg12.png","modpack:backgrounds/bg13.png","modpack:backgrounds/bg14.png","modpack:backgrounds/bg15.png","modpack:backgrounds/bg16.png","modpack:backgrounds/bg17.png","modpack:backgrounds/bg18.png","modpack:backgrounds/bg19.png","modpack:backgrounds/bg20.png","modpack:backgrounds/bg21.png","modpack:backgrounds/bg22.png","modpack:backgrounds/bg23.png","modpack:backgrounds/bg24.png","modpack:backgrounds/bg25.png","modpack:backgrounds/bg26.png","modpack:backgrounds/bg27.png","modpack:backgrounds/bg28.png","modpack:backgrounds/bg29.png","modpack:backgrounds/bg30.png","modpack:backgrounds/bg31.png","modpack:backgrounds/bg32.png","modpack:backgrounds/bg33.png","modpack:backgrounds/bg34.png","modpack:backgrounds/bg35.png","modpack:backgrounds/bg36.png","modpack:backgrounds/bg37.png","modpack:backgrounds/bg38.png","modpack:backgrounds/bg39.png","modpack:backgrounds/bg40.png","modpack:backgrounds/bg41.png","modpack:backgrounds/bg42.png","modpack:backgrounds/bg43.png"],
              "displayDuration" : 100,
              "fadeDuration" : 100
    }

}

}`

Pls can someone tell me how to make the images randomly.

WIFIGUN commented 3 years ago

Try this

`"other": { "background":

{ 
     "image" : "",
     "slideshow":
     {
          "images" : ["modpack:backgrounds/bg1.png","modpack:backgrounds/bg2.png","modpack:backgrounds/bg3.png","modpack:backgrounds/bg4.png","modpack:backgrounds/bg5.png","modpack:backgrounds/bg6.png","modpack:backgrounds/bg7.png","modpack:backgrounds/bg8.png","modpack:backgrounds/bg9.png","modpack:backgrounds/bg10.png","modpack:backgrounds/bg11.png","modpack:backgrounds/bg12.png","modpack:backgrounds/bg13.png","modpack:backgrounds/bg14.png","modpack:backgrounds/bg15.png","modpack:backgrounds/bg16.png","modpack:backgrounds/bg17.png","modpack:backgrounds/bg18.png","modpack:backgrounds/bg19.png","modpack:backgrounds/bg20.png","modpack:backgrounds/bg21.png","modpack:backgrounds/bg22.png","modpack:backgrounds/bg23.png","modpack:backgrounds/bg24.png","modpack:backgrounds/bg25.png","modpack:backgrounds/bg26.png","modpack:backgrounds/bg27.png","modpack:backgrounds/bg28.png","modpack:backgrounds/bg29.png","modpack:backgrounds/bg30.png","modpack:backgrounds/bg31.png","modpack:backgrounds/bg32.png","modpack:backgrounds/bg33.png","modpack:backgrounds/bg34.png","modpack:backgrounds/bg35.png","modpack:backgrounds/bg36.png","modpack:backgrounds/bg37.png","modpack:backgrounds/bg38.png","modpack:backgrounds/bg39.png","modpack:backgrounds/bg40.png","modpack:backgrounds/bg41.png","modpack:backgrounds/bg42.png","modpack:backgrounds/bg43.png"],
          "displayDuration" : 100,
          "fadeDuration" : 100
          shuffle=true
}

}`

jusipat commented 3 years ago

shuffle=true results in a crash

jusipat commented 3 years ago

Fixed via a .json checker, guarentee that "fadeDuration": 100, has a comma and "shuffle": true