Jump to content

JSON syntax variants+snow


Axspeo

Recommended Posts

Hello guys this Json file I made is giving me crashes,

 

{
    "variants": {
        "variant=frozen_dirt_grassy": {
            "snowy=false": {
                "model": "mtaxspeo:block_frozen_dirt_grassy"
            },
            "snowy=true": {
                "model": "mtaxspeo:fixme_grass_snowed"
            }
        },

        "variant=dia_dim_dirt": {
            "model": "mtaxspeo:fixme_dirt"
        }
    }
}

Can't I have multiple variants with snowy condition? Or am I writing it wrong?

 

Thanks in Advance!

Link to comment
Share on other sites

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

24 minutes ago, Draco18s said:

 

I didn't know Forge had a special Json syntax.

 

Anyway I didn't understand how am I supposed to write the json file for 2 blocks like I was trying to do. The examples you gave me are "single-block" examples. In my case i got the "frozen_dirt_grassy" block and the "dia_dim_dirt" block, the first has the snow condition and the second is a common dirt block.

 

I know that I could do something like this without the snow condition tho:

{
    "variants":
    {
        "variant=frozen_dirt_grassy": { "model": "mtaxspeo:block_frozen_dirt_grassy" },
        "variant=dia_dim_dirt": { "model": "mtaxspeo:fixme_dirt" }
    }
}

But I still didn't get it where should I add it.

Thanks

Link to comment
Share on other sites

When it comes to block states, if one variant has an extra value all others do as well.

So you technically have a "variant=dia_dim_dirt,snowy=true" and "variant=dia_dim_dirt,snowy=false"

You just don't do anything with them.  But your JSON model still needs to specify them.

  • Like 1

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

4 minutes ago, LexManos said:

When it comes to block states, if one variant has an extra value all others do as well.

So you technically have a "variant=dia_dim_dirt,snowy=true" and "variant=dia_dim_dirt,snowy=false"

You just don't do anything with them.  But your JSON model still needs to specify them.

{
    "variants": {
        "variant=frozen_dirt_grassy": {
            "snowy=false": {
                "model": "mtaxspeo:block_frozen_dirt_grassy"
            },
            "snowy=true": {
                "model": "mtaxspeo:fixme_grass_snowed"
            }
        },

        "variant=dia_dim_dirt": {
            "snowy=false": {
                "model": "mtaxspeo:fixme_dirt"
            },
            "snowy=true": {
                "model": "mtaxspeo:fixme_dirt"
            }
        }
    }
}

Thanks for your answer, shouldn't this work then? Sorry for the newbie questions and thanks

Link to comment
Share on other sites

No you're hybridizing the Forge and Mojang JSON formats.

In the mojang version you have to specify all full variants. 

The point of Forge's json is to build the permutations for you.

So you can't nest them like that, you'd need:

{
    "variants": {
        "variant": {
            "frozen_dirt_grassy": {},
            "dia_dim_dirt": {}
        },
        "snowy": {
            "true": {},
            "false": {}
        }
    }
}

 

If you have a '=' ANYWHERE in your variant name it detects it as a normal Mojang variant and doesn't build the permutations for you.

So ya... read the docs, and either use the Forge version, or Mojang's version. Don't mix the two.

  • Like 1

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

16 minutes ago, LexManos said:

No you're hybridizing the Forge and Mojang JSON formats.

In the mojang version you have to specify all full variants. 

The point of Forge's json is to build the permutations for you.

So you can't nest them like that, you'd need:


{
    "variants": {
        "variant": {
            "frozen_dirt_grassy": {},
            "dia_dim_dirt": {}
        },
        "snowy": {
            "true": {},
            "false": {}
        }
    }
}

 

If you have a '=' ANYWHERE in your variant name it detects it as a normal Mojang variant and doesn't build the permutations for you.

So ya... read the docs, and either use the Forge version, or Mojang's version. Don't mix the two.

Now I understand, Thank you for your help :)

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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