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.

Featured Replies

Posted

Even after reading this and this, I still don't quite get how Forge uses these files, and I couldn't find that much other documentation on the new system.

 

I.e. what is happening when I declare blockstates? How does Forge know what new variant names to look for? What is the actual class that interacts with and parses .json files? And so on.

 

For the people who do know, can you share a link to some resources that you think are helpful?

Hi

 

You might find this link useful

greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

in particular the topics under Blocks and Items

 

ModelBakery.addVariantName is used to register for variants.  For items you also need to Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register() to tell minecraft that the item renderer should look for the model in ModelManager.

 

Vanilla methods that are particularly relevant:

ModelManager.onResourceManagerReload()

BlockModelShapes.reloadModels()

and especially

ModelBakery.getModelBlockDefinition() is the entry point for parsing JSON files.

ModelBakery.bakeModel()

 

The vanilla code is quite complex and will probably take a while to get your head around.

 

If you just want an example of some working code, this project has some examples of block variants and item variants (examples 3 and 11)

https://github.com/TheGreyGhost/MinecraftByExample

 

-TGG

 

  • Author

Thanks. I mainly wanted to see if it was possible to add a "default" tag to the .json files so that you don't have to specify the same thing multiple times (like the default case in a switch statement).

 

For example, for a block, I'd want to have something like this:

{
    "parent": "block/cube",
    "textures": {
        "down": "top_texture",
        "up": "top_texture",
        "default": "side_texture"
    }
}

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.