#How to register items only if certain other mods or items exist
14 messages · Page 1 of 1 (latest)
you can't really access tags that early
Hmm, I've seen forge mods that add certain items if an item with a forge: tag exists (for example, adding a tin sword if an item with forge:ingots/tin exists. Is there a way to do this in fabric?
they probably read the raw data from all of the jars
but tags are not loaded or even initialized at that point normally
Alright, is there a way to do it with specific items or mods, instead of items with a certain tag?
just add some conditions to your registration code
but be aware that once that conditions aren’t true anymore, your content will disappear from the world
conditional registration should probably be avoided if possible. instead you should register them always and use minecraft's "feature toggles" system. it is used by all experimental features (such as bundles) and is quite simple & safe as your content won't just vanish from worlds if the dependency mod is unloaded
How can I check if a mod is loaded? In forge its something like ModList.get().isLoaded()
FabricLoader.getInstance().isModLoaded(...)
Thanks
not sure how it works for recipes, if it just handles it or you need to do something. in any case check bundles or the 1.21 experimental datapack for reference
Just to check, there is no way of checking if an item that has a certain tag exists (say c:tin_ore). Instead, the code has to look for some mod that adds that item (tin ore for example), right?