This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
CraftedCart's profile picture

Better Minecraft GUIs (Modding)

Started by CraftedCart, 17 February 2016 - 03:45 PM
CraftedCart #1
Posted 17 February 2016 - 04:45 PM
So I've been modding Minecraft recently and decided to make an entirely new UI system for Minecraft (Really, why try to use a small box in the centre of your screen?).
The mod is a forcefield mod for 1.8 (MFF: Modular FluxFields)

This UI system is based off of components. Each component can be set to have an action performed whenever it is clicked on, and an action to be performed on every frame.

This uses slick-util to render fonts. Roboto is used.

Currently existing components are:
  • UIButton
  • UIComponent (A panel)
  • UICustomQuad (Specify 4 points in which a quad will be drawn between them)
  • UIDualSlider (A slider with 2 handles)
  • UIGradientPanel (A panel that can have a gradient)
  • UIIndeterminateRadialProgressBar (A circular indeterminate progress bar)
  • UILabel (Text)
  • UILineGraph
  • UIListBox (A scrollable list of components)
  • UIListSpacer (A spacer for use within a UIListBox)
  • UINotification
  • UINotificationManager
  • UIProgressBar
  • UIRadialProgressBar (A circular progress bar)
  • UIRootComponent (The panel that contains everything, and also draws the debug mode)
  • UITextButton (A button with text)
  • UIToggleBox (A checkbox)
Imgur Album: http://imgur.com/a/on7jU

Screenshots!

The Info UI:


Sizing GUI:


The Security GUI:

This one is the most interesting one (The code for this one is bigger than the logic for the whole of the tileentity - And it's still incomplete!).
Player names and UUIDs are gotten via Mojang's APIs.
Player faces and body renders are gotten via Crafatar.
The thin grey boxes are text boxes.
The text boxes follow standard conventions as well (for the most part - Mojang, It's option + arrow keys on mac to jump across words, not command + arrow keys).
  • Ctrl / Option arrows to jump across by words
  • Cmd arrows to goto the beginning / end
  • Ctrl / Option backspace / delete to remove words
  • Cmd backspace / delete to wipe out everything to the left / right of the cursor
The debug mode (F3) for the security GUI, with componets highlighted in red:

As I said, everything is a component. The hirearchy can be explored on the right. Being able to inspect the hirearchy of componets is a lot more useful than what you may think (When developing it, at least).

The Power Statistics GUI:


I thought that this UI implementation could work fairly well within ComputerCraft (I'm already working on another mod though. Don't expect me to make a plugin for this). Many people have asked for bigger screen resolutions however this would take up more of the network. As this UI system uses components, there would be no need to send each pixel's data over the network.

Source Code for the GUI (Look in guiutils for the components and stuff): https://github.com/C...elds/client/gui
At the time of posting, the security GUI is a WIP and is not on GitHub yet…

TRY IT YOURSELF
The latest download for Modular FluxFields at the time of posting is Alpha 2 (No fancy GUIs there).
You can download bleeding edge builds from here: https://bintray.com/...-Bleeding-Edge/
If you do, place down a ForceField Projector and a Creative Power Generator on top. RClick on the Projector.

If you have any questions, feel free to ask me!

Source code for MFF: https://github.com/C...ular-FluxFields
Website: http://craftedcart.g...lar-FluxFields/
Downloads (No fancy GUIs yet, try the bleeding edge links for that): http://craftedcart.g...s/download.html
Edited on 04 June 2016 - 08:09 PM
Creator #2
Posted 17 February 2016 - 05:17 PM
This looks very nice! Congrats!

How exactly is it related to CC?
FUNCTION MAN! #3
Posted 17 February 2016 - 10:11 PM
Konlab #4
Posted 24 March 2016 - 09:57 AM
Do you plan realeasing an UI Library without FluxFields? For modders?
I really like it!
Edited on 24 March 2016 - 08:58 AM
LewisTehMinerz #5
Posted 26 March 2016 - 05:58 PM
Just wondering, how are you loading slick-util from mods/CraftedCart/slick-util.jar? I do not see any code for it.


Erm, why is it trying to write to my Windows Registry?


Mar 26, 2016 6:12:53 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Edited on 26 March 2016 - 05:13 PM
CraftedCart #6
Posted 04 June 2016 - 09:37 PM
Just wondering, how are you loading slick-util from mods/CraftedCart/slick-util.jar? I do not see any code for it.


Erm, why is it trying to write to my Windows Registry?


Mar 26, 2016 6:12:53 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

Sorry for the late reply.

Loading slick-util.jar is done here (Line 71 onwards)
https://github.com/CraftedCart/Modular-FluxFields/blob/2fbcdcdf68e6ac5c8086223ec41b745d96d09760/src/main/java/io/github/craftedcart/modularfluxfields/proxy/ClientProxy.java

As for writing to the Registry, I use a Mac and never added something to write to the registry. I would guess that it might be because of Java's Swing window system (but don't quote me on that)
CraftedCart #7
Posted 04 June 2016 - 09:45 PM
Do you plan realeasing an UI Library without FluxFields? For modders?
I really like it!

Sorry for the late reply.

I probably could do. :)/>

I already have another UI library up, although that's more aimed towards raw LWJGL, instead of being built on top of Minecraft (https://github.com/CraftedCart/FluidUI) - It's also far lacking in terms of the types of components - I will have a look into creating a UI library for MC without Modular Fluxfields however.

It might be a little while though - Mojang yet again changed stuff (The world renderer - So I now have given up on Minecraft's world renderer and I'm using GL11.xyz()) when I updated from 1.8 to 1.8.8 (And now there's Forge 1.9 - Argh!)
Edited on 04 June 2016 - 08:03 PM