Getting Variable Value (Or NBT Tag) From an other mod

Started by Ro... on

Topic category: Help with modding (Java Edition)

Last seen on 04:12, 18. Apr 2024
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Getting Variable Value (Or NBT Tag) From an other mod

Hey, Let say i have a mod (mod 1) which add Player Statistics (Magic Strength, Mana, Mana Speed (They are numbers abviously)), i have weapons using these Stats. then, i make another mod (mod 2) which add more weapons to my mod 1, I want the weapons of mod 2 to use the stats of mod 1, Is this possible to do that?

Last seen on 19:20, 25. Jun 2023
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You might have to do java…
Sun, 12/19/2021 - 21:28

You might have to do java code to change the used element manually to one from your "mod 1." You could try and combine this with nbt data and your mod 2 will get data from your item from mod 1.

NBT Tags are shared by mods,…
Thu, 12/23/2021 - 10:25

NBT Tags are shared by mods, so you can use NBTs across any of your mods (or the ones added by other people). This way I added add-on support in my mod.
Variables, in the other hand, would require Java ig. But if you don't need to access someone else's mods' variables, you can easily do workaround - make procedure pushing variable to NBTs, and then you can access it via procedures in another mod.

I hope that explains enough, in case you have questions, feel free to ask ^^

Last seen on 04:12, 18. Apr 2024
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you, you gived me an…
Thu, 12/23/2021 - 19:49

Thank you, you gived me an idea. it might take time, and i might hurt my brain because of how complicated it will be, but its possible.

Last seen on 19:20, 25. Jun 2023
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
By the way, don't forget to…
Fri, 12/31/2021 - 04:59

By the way, don't forget to add a mod dependency for your mod B if it's going to use things from mod A much. You don't have to do this if you're just making a simple "hey these mods can work together" feature, but you do if it's like an add-on.