MenuForge- Making Inventory GUIs a whole lot easier with swing

Discussion in 'Programming' started by Tecno_Wizard, Jun 25, 2016.

  1. MODS: If you want to move this to offtopic, go ahead. I wasn't 100% sure if counted as programming or not because it's really a code generator at it's heart.

    Hey everyone! I know I don't have a lot of activity in these forums, but I have plenty of Bukkit/Spigot experience and learned how miserable it is to create an inventory GUI. Yes, there are plenty of utilities, but what I feel is the most aggravating is actually making the menu look the way you want it to. It's hard to set things up the way you want when you have to fight that dumb cloned ItemMeta object the whole way through and your only visualization of spacing is with a number over 9.

    This is why I and another member of the Bukkit forums, ZombieStriker, made a utility we call MenuForge.
    MenuForge is an easy to use method of making your inventory look exactly the way you want it to by letting you manipulate it in a graphical setting. The best part? It outputs a class to generate that inventory.

    We've been working on this (slowly) for months and we feel it is finally ready for real use.
    Lets say you want to make a server hub (although this is designed for much more complicated things)
    Here's what you start with.
    We only really need a row, so i'll go to the Inventory Details tab and change it to one row. Then I'll give each icon a position (click on desired slot) and give them details. Want ChatColors? Use the ChatColor tab and select the color/format you want. Use the "Show formatted text" checkbox to see what the text will look like. You can drag the icons around to your liking, too. Magic isn't supported here. Sorry.
    Here's what I made. (The hoverover is a little glitchy. Sorry about that. We still have work to do on this)
    Cool, right? See the click action section? You can use that to make a click listener, but it isn't 100% necessary if you don't plan on using the system this outputs to listen for clicks. You might just want the stacks and their positions. We get it, that's fine.

    Let's get the output of this. Go to File and export. I'm going to use the popup for the screenshot, but you'll probably use the clipboard to paste into a java class.

    Whole lot easier, isn't it? This isn't the entire class but it's a good amount of it.

    What if you want to save what you did so you can edit it later? Easy! File->Save and choose a location, It saves a text file, but it's mostly binary so you won't get much out of opening it (It's a serialized Java object of your inventory). Opening is the same. There is a chance that we will break older save files with updates, but it's necessary to make improvements to the stacks themselves.

    You can find a beta jar at my github account here as well as the source code. The licence is a CC BY-SA.
    • Like Like x 1