Jump to content

Recommended Posts

Posted (edited)

Heyo, I'm currently in the process of making a GUI for my mod's configuration options, accessible from "Mods > My Mod > Config" (The whole business of registering an extension point etc). Given the shear number of times poor Diesieben has had to answer the same question of how to achieve this I'd say it's a pretty common query (and why wouldn't it be config is pretty standard stuff).

 

Why is this config GUI not built into Forge? Is there some secret reason I should know about or has simply noone gotten round to it? Maybe just a decision to let modders implement it themselves? But then surely you could still have a generic GUI and provide a hook for modders to edit or replace it if they choose?

 

If my implementation is successful enough and testable I may just put in a pull request on the Forge GitHub to implement this. But it does perplex me why this isn't a thing...

 

All the best to whomever reads this!

 

P.s. Apologies if I have missed something important: it is very late.

Edited by GenElectrovise
Closed.

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

Posted

Fair enough seems like a pretty good reason.

 

11 minutes ago, diesieben07 said:

Nobody has stepped up to provide a stable and maintainable implementation.

In this case sounds like it could be more complex than I thought, but if I achieve anything worth sharing I'll put in a pull request.

Thanks!

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

Posted

More specifically, we used to have one, but then our rendering guy got stolen by Mojang. And thee cost of updating it everytime they changed something upstream got too  much.

There are mods out there that add generic screens. The main reason there isn't one in Forge is manpower to maintain them in the future.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

 

13 minutes ago, LexManos said:

And thee cost of updating it everytime they changed something upstream got too  much.

If I may ask, what was the bottleneck in updating it? I suppose changes to screen rendering, given you mentioned the rendering guy?

If I'm going to try to implement my own version, I may as well try to target the problem!! 

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

Posted
13 hours ago, LexManos said:

The main reason there isn't one in Forge is manpower to maintain them in the future.

What would this mean in this context exactly? (Trying to consider whether this project would be a valuable addition to Forge)

To clarify, does this mean: "any system is too much to maintain, so it's better to just leave it to mod authors"

Or does it mean: "If we had a more maintainable system, it would be a useful addition"

I'm basically asking because if it's the former, then I'll only make a screen for my own mods; if it's the latter, then I'll at least have a shot at implementing it in Forge itself :)

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

Posted

Most  likely its the later. But the cost is quite a lot with mojang liking to re-write the rendering system.
Again, there are already a few 'generic config gui' mods  out there that work.
We provide a  fairly simple data layer for defining config objects, so a few  people have taken it  upon themselves to make them into mods.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted (edited)
3 hours ago, LexManos said:

But the cost is quite a lot with mojang liking to re-write the rendering system.

It seems to me that anything that you'd need in order to make the GUI could be accomplished with #drawString or with Widgets. Is maintaining these the cost of which you speak?

After all, a config GUI is just rendering a list of keys and a way to edit each value (either toggles or text widgets), no?

I suppose if you wanted to cut down on maintenance then the first port of call would be to minimise independent calls to volatile 3rd party code (i.e. Minecraft itself).

Perhaps it is not so simple though... If it was I'd think that someone would have gotten there before me?

Edited by GenElectrovise

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

Posted

Again people HAVE done this. It's not just draw strings and widgets. Because configs can have a lot of config value types that dont exist in vanilla.
All I can say is just go do it and see what happens.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted
35 minutes ago, LexManos said:

Because configs can have a lot of config value types that dont exist in vanilla.

Case in point, my work project. Which is Unity/C#, but the idea is the same.

The Unity inspector is pretty good at finding public/serializable values and showing them in a list in the Inspector gui, but it's layout or labels aren't always the best, and there's only so much you can do with annotations (of which there are several). So for more flexibility, Unity offers both a CustomInspector feature and a CustomPropertyDrawer feature (the former is for Unity-objects that appear in the inspector, the latter for miscellaneous objects that are contained within the former).

However even this is limited to only the things Unity knows how to serialize. Generics? Lists of Interface objects? Abstracts? Not supported.

But my project needed support for generic objects because of how our interaction system (ECS components encapsulating simple finite state objects) and our grading system (did the user perform the following steps in the prescribed order?) had to integrate with each other.

I had a hard requirement to be able to display any object Foo in the inspector, regardless of what Foo's type was. So I had to dig into Unity's inspector code and extract out how it handled all of the types it did handle and rewrite it to accept arbitrary values, that if it didn't match the available types, would use reflection to find all of the object's public/serializable fields and then try to draw all of those, recursing down again and again until a primative type was able to be drawn.

And even with caching to avoid duplicate reflection lookups, it still isn't fast. There's a soft limit of about 20-50 of these inspector drawers that Unity can draw at one time before the lag becomes disruptive. And when you're dealing with complex custom types, the layout isn't pretty. Thus I had to go reimplement Unity's custom editor and custom property drawer system as well.

Which is to say...if it's more than a handful of very simple objects (ints, strings, booleans...) you're going to have to do the work yourself.

  • Thanks 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
7 hours ago, LexManos said:

All I can say is just go do it and see what happens.

Wise advice for many circumstances. Interesting commit also.

 

6 hours ago, Draco18s said:

Case in point, my work project. Which is Unity/C#, but the idea is the same.

The Unity inspector is pretty good at finding public/serializable values and showing them in a list in the Inspector gui, but it's layout or labels aren't always the best, and there's only so much you can do with annotations (of which there are several). So for more flexibility, Unity offers both a CustomInspector feature and a CustomPropertyDrawer feature (the former is for Unity-objects that appear in the inspector, the latter for miscellaneous objects that are contained within the former).

However even this is limited to only the things Unity knows how to serialize. Generics? Lists of Interface objects? Abstracts? Not supported.

But my project needed support for generic objects because of how our interaction system (ECS components encapsulating simple finite state objects) and our grading system (did the user perform the following steps in the prescribed order?) had to integrate with each other.

I had a hard requirement to be able to display any object Foo in the inspector, regardless of what Foo's type was. So I had to dig into Unity's inspector code and extract out how it handled all of the types it did handle and rewrite it to accept arbitrary values, that if it didn't match the available types, would use reflection to find all of the object's public/serializable fields and then try to draw all of those, recursing down again and again until a primative type was able to be drawn.

And even with caching to avoid duplicate reflection lookups, it still isn't fast. There's a soft limit of about 20-50 of these inspector drawers that Unity can draw at one time before the lag becomes disruptive. And when you're dealing with complex custom types, the layout isn't pretty. Thus I had to go reimplement Unity's custom editor and custom property drawer system as well.

Which is to say...if it's more than a handful of very simple objects (ints, strings, booleans...) you're going to have to do the work yourself.

Thank you - this is very comprehensive and I understand the point that LexManos is trying to make now. This is the explanation I've been looking for.

I will now close this thread.

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

  • GenElectrovise changed the title to [closed] Why is there no generic mod config GUI?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • That seems to have fixed it, thank you!
    • I am having some issues starting an RLCraft server on a minimal install of Debian 12. I have Java installed and I'm able to start the vanilla Minecraft server jar no problem and people can join and play without any issues, as soon as I try to create a new directory with the Forge jar the initial install with the INSTALLER jar works when I use the java command with the --installServer flag, but as soon as I try to start the server using the forge jar that is NOT labelled with installer I get the following error: A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         at java.base/java.lang.reflect.Method.invoke(Method.java:569)         at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:70)         at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:34) Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')         at net.minecraft.launchwrapper.Launch.<init>(Launch.java:34)         at net.minecraft.launchwrapper.Launch.main(Launch.java:28)         ... 6 more   I have tried using newer versions of Java directly from Oracle as well. Has anybody been successful in starting and running a RLCraft server from the terminal on a Linux machine? I cannot figure out why it doesn't want to work but the vanilla jar works without issue. Thank you in advance!
    • This is my latest attempt :  public class ManaScreen extends Screen { Mana mana = new Mana(); boolean removeManaBar = false; ResourceLocation manaBar = ResourceLocation.fromNamespaceAndPath(RSGArmoury.MOD_ID, "/textures/block/spawnable_arena_wall.png"); public ManaScreen() { super(Component.literal("Mana")); } @Override protected void init() { super.init(); Minecraft.getInstance().setScreen(this); } @Override public boolean isPauseScreen() { return false; } @Override public void render(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) { pGuiGraphics.blit(manaBar, 10, -10, 0, 0, mana.getMana(), 10, mana.getMana(), 10); if (removeManaBar) { this.onClose(); return; } super.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick); } public void addManaBar() { removeManaBar = false; Minecraft.getInstance().setScreen(new ManaScreen()); } public boolean removeManaBar() { return removeManaBar = true; } }
    • I tried a few different things that all didnt work. Right now I have nothing but what I had that seemed most likely to work was just a guiOverlay.blit(x, y, z, vx, vy, getMana()). I dont remember the exact code but it was somthing along those lines. It was in a new class extending screen I believe.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.