Carpet extensions should be able to add stuff to `system_info`
Ghoulboy78 opened this issue ยท 0 comments
Currently system_info
has Carpet rules, which are technically supposed to be a modded thing separate from scarpet. Therefore I think it follows that other extensions should be able to add their own features, which would be added as: system_info('mod_name:info_name')
or something like that, with maybe /
instead of the colon, idk.
This would be actually really easy to implement, it would involve adding a public function in SystemInfo.java
which looks smth like this:
public static void addSystemInfo(CarpetExtension extension, String infoName, Function<CarpetContext,Value> function){
options.put(extension.getClass().getSimpleName()+":"+infoName, function);
}
The only worry I have is that programmers don't understand that they have to run this function immediately, so it might be that they try to run this during runtime, which of course doesn't break it, but does cause other, weirder problems.
And ofc there is the issue that a user may try to grab a system info from an extension which isn't loaded, but I do have a vague idea of how to solve that.