Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional Data API #344

Open
RedstoneParadox opened this issue Sep 8, 2023 · 3 comments
Open

Conditional Data API #344

RedstoneParadox opened this issue Sep 8, 2023 · 3 comments
Labels
library: data Related to the data library. new: module A pull request which adds a new module

Comments

@RedstoneParadox
Copy link

RedstoneParadox commented Sep 8, 2023

A major flaw with data files is that if you want to add mod compatibility/integration in the form of data files (i.e. adding a recipe for another mod's workstation) is that you need to use mixins to prevent those data files from loading when the other mod is not present, otherwise, the console and logs are spammed with exceptions. Since this deals with inter-mod compatibility, I feel it would be a good fit for QSL to implement.

This API would consist of a simple event that would be fired every time MC finds a data file to load. Listeners would return a boolean to determine whether or not that file should be skipped. Since the most common use case would be checking whether a given mod is present, a helper function would also be available for creating a listener that checks if a given mod is loaded.

In the past, LibCD was used to accomplish this through a separate .mcmeta file for each data file you wanted to have conditionally loaded. In my experience, this approach was far from ergonomic.

@lukebemish
Copy link
Contributor

I feel like the conditionality of data should be, itself, either data driven or possible to make data driven. This could be easily accomplished by hooking such an event up to the data callback system

@RedstoneParadox
Copy link
Author

If it is data driven, it has to be more ergonomic than LibCD. That being said, I would personally prefer a code interface.

@lukebemish
Copy link
Contributor

Hooking it up to the data callback system allows you to have both with relative ease

@ix0rai ix0rai added new: module A pull request which adds a new module library: data Related to the data library. labels Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library: data Related to the data library. new: module A pull request which adds a new module
Projects
None yet
Development

No branches or pull requests

3 participants