ezforever / thatorthis Goto Github PK
View Code? Open in Web Editor NEWA Fabric mod for choosing between sets of Fabric mods.
Home Page: https://modrinth.com/mod/thatorthis
License: MIT License
A Fabric mod for choosing between sets of Fabric mods.
Home Page: https://modrinth.com/mod/thatorthis
License: MIT License
Allow right-clicking a mod in the toggable mods section to open its Mod Menu Config GUI.
When creating my modpack, I am finding it annoying that when i make an error in rules.json, i have to close the game anyway to fix it.
It would be useful to have a (togglable,disabled by default) option to just crash when rules.json was invalid.
Technically speaking, ThatOrThis take its inspiration from Modsmod and GrossFabricHacks, which abuses the LanguageAdapter feature of the Fabric Loader. This allows part of this mod's code to run even before Fabric Loader starts to initialize most other mods. It then read configs, resolve for additional mods to load, and inject them into the loader via Java reflection wizardry.
NOTE: ThatOrThis is only intended for small, client-side mods. It may cause crashes and/or server/world incompatibilities if rules and options are not designed carefully. Test your modpack throughly before and after installing this mod.
Reading those paragraphs made me wonder - is that "gross hack" even necessary? Considering that it cannot hotswap mods anyway, wouldn't it be way easier to just append a ".disabled" or similar to the jar's filename?
In some situations it would bee useful to be able to prevent loading mods from certain directories or other rule objects. For example when user want to load a mod that is incompatible with another loaded mod, this is a good precaution.
Is it possible to implement something like this?
Currently (as of v0.2.1) in a dedicated server environment, there is no way to change ThatOrThis' settings without manually editing choices.json
. This is not considered a lack of feature (since ThatOrThis is not designed for server-side anyway), but it would be nice to have a similar GUI as on client-side.
Features would be like:
-nogui
), no button or window will be shown.This feature will, however, need to rewrite a lot of vanilla GUI components. Also, since even server.properties
needs to be edited by hand, there is no strong demand to implement this feature. So I'm posting this question
issue here for suggestion and feedback.
An example modpack (e.g. MultiMC or Curseforge-based) would be nice to get a better grasp at how the rules work.
Kept here to replace TODO.md
in the repo. Items marked "(?)" are still under consideration.
Emergency changes
Fabric Loader v0.12.0 introduces a massive refactor on mod loading mechanics, which breaks ThatOrThis completely. A rewrite needs to be done before it's too late. As the rewrite will break compatibility with Fabric Loader v0.11.x, support for these versions will be dropped on ThatOrThis v0.3.0.
FabricInternals
to keep only interfacing code and move inner classes to a new package (commit de94067)Stuffs to a better & cleaner config schema: (Include in v0.3.0?)
GENERATED
rules' buttons (text from modmenu.descriptionTranslation.XXX
? Format?)LanguageAdapter
s and GrossFabricHacks entrypoints on injecting a mod, and if found, issue a non-fatal error (LanguageAdapter found in "xxx-language-support"! Expect it to break
)modmenu.parent
; need more reflection hacks)
ArgumentModCandidateFinder
(FabricMC/fabric-loader#470)@xxx.xxx
hack with JSON-based text (Text net.minecraft.text.Text.Serializer.fromJson(String)
)RuleHolder
to be like a container, similar to ChoiceHolder
? (Good for consistency but otherwise unnecessary for now)disabled
into ChoiceHolder
(Not possible for now due to Map<>
inheritance, but should be done)CyclingButtonWidget
)It is funny, but it is a bug :)
Demo
(I used a laptop touchpad to get this)
{
"id": "a-rule",
"type": "DEFINED",
"caption": "Switch: %s",
"options": [
{
"id": "off",
"caption": "Off",
"directories": [ ]
},
{
"id": "on",
"caption": "On",
"isDefault": true,
"directories": [ "a-mod" ]
}
]
}
to
{
"id": "a-rule",
"type": "BOOLEAN",
"caption": "Switch: %s",
"switchText": [ "On", "Off" ],
"default": true,
"directories": [ "a-mod" ]
}
This would also be useful when/if #21 is introduced.
I have a client+server environments and I'm trying to use thatorthis to allow me to load client-only mods only on the client and server-only mods only on the server.
I got things setup for the client and it works in singleplayer. I use git version control in my .minecraft/
directory, and I cloned the repository into my server environment (I have lots of things ignored, I basically just sync datapacks and mods. I've been doing this for months, just separating server/client mods manually. The usage of git is not the issue. )
For the server, I get a crash during startup, this is the console output.
Could not create directory .\mods\.\mods\OPTIONAL
in the console prompted me to create the directory mods/mods/
, and sure enough the game starts up if that exists, and any directories of selected rule options are created.
As the title says. Maybe this mod can switch to quilt?
Quilt 看起来支持加载额外模组,也许可以切换到 Quilt?
Description
The "reset" (§r) parameter does not apply to text during automatic line breaks. At the same time, the last specified parameter starts to apply to all subsequent text by default, and the new "§r" will reset the text formatting to it.
Demo
Example rule:
{ "rules":[ { "id":"test_rule1", "type":"DISABLED", "caption":"Hover me", "tooltip":"randomtext§a §rrandomtext§a §rrandomtext§a §rrandomtext§a §rrandomtext§a §rrandomtext§a §rrandomtext§a §rrandomtext§a §rrandomtext§a §crandomtext§r randomtext randomtext" } ] }
To reproduce
Example rules
Example rule.zip
Noticed this when creating my modpack: My rules.zip
when starting the mod it will give this error:
Exception in thread "main" java.lang.NoClassDefFoundError: net/fabricmc/loader/discovery/ModResolutionException at io.github.ezforever.thatorthis.Main.run(Main.java:33) at io.github.ezforever.thatorthis.PreloadAdapter.<clinit>(PreloadAdapter.java:14) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:466)
This mod seems amazing and I think it will make my life a lot easier, but there's one more feature that I would find very useful.
A lot of client-only mods are ignored and therefore optional when connecting to servers.
I'd love to be able to put all such mods in a directory and allow the user to individually toggle each of these mods.
This could maybe be implemented by having a rule that, instead of an "options"
entry has its own "directories"
entry, or maybe call it "toggle_directories"
or something to make it clearer that directories specified at the rule level mean they're for toggling, not an "option"
.
{
"aliases": {
"sodium": [ "sodium" ],
"sodium-extra": [ "sodium-extra" ],
"cool-mods": [ "mod1", "mod2" ],
},
"rules": [
{
"id": "cool-stuff",
"type": "DEFINED",
"caption": "Cool Stuff: %s",
"options": [
{
"id": "on",
"caption": "On",
"isDefault": true,
"directories": [ "cool-mods" ] // works as if mod1 and mod2 were in a directory called "cool-mods"
},
{
"id": "off",
"caption": "Off",
"directories": [ ]
},
]
},
{
"id": "sodium-v-extra",
"type": "DEFINED",
"caption": "Renderer: %s",
"options": [
{
"id": "sodium",
"isDefault": true,
"caption": "Sodium",
"directories": [ "sodium" ]
},
{
"id": "sodium-extra",
"caption": "Sodium Extra",
"directories": [ "sodium", "sodium-extra" ]
},
]
},
]
}
Many times you will want a mod to be individually togglable and this could happen for a large amount of mods, with the current system you'd have to make a new directory for each and every mod you'd add. Under this system, this would improve UX, as everything can be changed in a singular file (or a set of them, if this feature is not part of rules.json
), without the need to manage mod directory structure.
As mentioned in #1, I have a plan to make ThatOrThis a library mod, expose the ability of choosing and loading additional mods to other mods and developers. Modpack configs, GUI elements, etc. will be moved to a separate (optional) mod.
However, there are some questions to be answered before we could work on this:
I love this mod and it is making life so much easier, but i think it'd be even better if there was an icon like mod menu has, above that icon, or a bar (like mod menu) (configerable)
The ability to search through toggable mods would be very nice.
Please consider publishing the mod to Curseforge to make it easier for modpacks to use it.
Edit: actually modpacks couldn't use this right away due to JAR bundling needed, but if you implement the direct download, they could. Still, would be great to have it in CF already for exposure.
It would be nice to have rules that depend on the enabled state of generated/defined types.
For example, using boolean conditions with the field "ruleCondition" to enable a rule configuration:
{
"rules": [
{
"id": "shaders",
"type": "DEFINED",
"caption": "Type of optimizations: %s",
"tooltip": "Enable Sodium optimizations (Most performant) or Optifine (Better shader tunning)?",
"options": [
{
"id": "sodiumId",
"caption": "Sodium",
"directories": [ "modsSodium" ]
},
{
"id": "optifineId",
"caption": "Optifine",
"directories": [ "modsOptifine" ],
"isDefault": false
}
]
},
{
"id": "SodiumOnlyOptimizationsId",
"type": "GENERATED",
"caption": "Sodium only optimizations",
"tooltip": "Enable other optimization mods that are not compatible with optine",
"directories": [ "sodiumCompatibleOnlyMods" ],
"ruleCondition": "sodiumId"
},
{
"id": "SodiumOptimizationMod43AddonsId",
"type": "GENERATED",
"caption": "Configure mod 43's Addons",
"tooltip": "Choose what addons are enabled for mod 43 (only compatible with Sodium)",
"directories": [ "sodiumMod43Addons" ],
"ruleCondition": "SodiumOnlyOptimizationsId:modid43"
}
The first rule (DEFINED) has two options, either Sodium or Optifine.
When choosing Sodium, the user then could see a new button with sodium only mods (rule with id SodiumOnlyOptimizationsId).
When enabling a specific mod (modid43, in the example), the user could then see another button for configuring modid43's addons.
PS: Really nice work on this mod!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.