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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • What MC version? What's the IP? Are any mods needed to be able to join?
    • Thank you for your answer ! Unfortunatly i have the same problem when i use setPos() public static int movingfunction(CommandContext<CommandSourceStack> context){ CommandSourceStack source = context.getSource(); if (!(source.getEntity() instanceof ServerPlayer)) { return 0; } ServerPlayer player = (ServerPlayer ) source.getEntity(); double moveSpeed = 0.5; for (int i =0; i<10000;i++) { LOGGER.info("running for the {} time", i); double x = player.getX() + player.getViewVector(1.0f).x * moveSpeed; double y = player.getY(); double z = player.getZ() + player.getViewVector(1.0f).z * moveSpeed ; Vec3 movementVec = new Vec3(x, y, z); LOGGER.info("x ={} y ={} z ={}", x, y, z); player.setPos( movementVec); } return 1; } With the logs i can see that x and z are increasing but once again my player is not moving. is there a function to use to sync the server and the client ? I also tried to use LocalPlayer instead of ServerPlayer but my code would stop when i got the object. Also i will change a bit the main topic but is there a way to similate key press ? i found KeyBinding.setKeyBindState on others post but it look like there is no more KeyBinding in 1.20   I found this code : KeyMapping.click(Minecraft.getInstance().options.keyUp.getKey()); But it doesn't seems to work   And i found this one : Minecraft.getInstance().options.keyUp.setDown(true); wich works but doesn't exactly do what i want , it doesn't release the key so for exemple i can't make him run. Minecraft.getInstance().options.keyUp.setDown(true); Minecraft.getInstance().options.keyUp.setDown(false); Minecraft.getInstance().options.keyUp.setDown(true); doesn't make him run
    • Add crash-reports with sites like https://paste.ee/ Maybe an issue with blur, essentials or cumulus_menus
    • Add the crash-report or latest.log (logs-folder) with sites like https://paste.ee/ and paste the link to it here  
  • Topics

×
×
  • Create New...

Important Information

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