Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.15.2] Generating JSON Files isn't working; how to use ItemModelProvider ?

Featured Replies

Posted

Hi guys!

 

I want to generate my json files within my code because it would take too long to do it all by hand.

Before noticing that forge provides some useful classes / interfaces, I wrote some code myself which I thought would work... but it doesn't.

I don't really know why, and I am super obwhelmed by forge's classes / interfaces for this purpose, so if someone would share some insight on ItemModelProvider and which methods are important, I'd be delighted!

Do I need a modelBuilder, modelLoader and modelProvider? What about the DataGenerator?

 

My code

The main mod class:

https://github.com/celinemargaux/Plantastic/blob/crop-experiments/src/main/java/com/celinemargaux/plantastic/Plantastic.java

 

the init class with nested json:

https://github.com/celinemargaux/Plantastic/blob/crop-experiments/src/main/java/com/celinemargaux/plantastic/init/Init.java

 

my assets:

https://github.com/celinemargaux/Plantastic/tree/crop-experiments/src/main/resources/assets/plantastic

 

Thanks in advance!

Celine

Hi

I guess you're talking about json models for blocks or items?

If this is just a once-off thing, I would personally use Excel (with formulas to copy the right words into the right places in the file) and then export as text.

 

I would also get my mod working perfectly with just one item/block first.  And then when I had ironed out all the bugs, I would add all the remaining items/blocks.

 

-TGG

  • Author

Sorry for the late response!

Yes, it's for generating the object_name.json files!
Okay, I could do that, but in the long run I'd like to understand that as well.

I will definitely work on the core code of my mod before making more things, you're right.

 

Thanks for your answer,

 

Celi

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.