Jump to content

Recommended Posts

Posted

So I have a submodel that I'm using to represent some TE data and just changed from it being a boolean property to an integer (0-6).  I'm perfectly happy copy-pasting the submodel json file 5 times and supplying slight variations on each, however I wanted to ask if it was possible to have variants in the model and just query that instead.

 

My blockstate file looks like this atm:

 

"salt_level": {
            "6": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt6" }
                }
            },
            "5": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt5" }
                }
            },
            "4": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt4" }
                }
            },
            "3": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt3" }
                }
            },
            "2": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt2" }
                }
            },
            "1": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt1" }
                }
            },
            "0": {}
        }

 

Where each of those submodels would look like:

 

{
    "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
    "textures": {
        "0": "harderfarming:blocks/saltblock"
    },
    "elements": [
        {
            "name": "salt",
            "from": [ 5.0, 0.0, 5.0 ], 
            "to": [ 11.0, 6.0, 11.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "east": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "south": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "west": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "up": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "down": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] }
            }
        }
    ]
}

 

Only that the "to" and UV values will differ slightly.

 

I was just wondering if there was a cleaner/simpler way to do this.

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.

Posted

I'm not sure this will work, but maybe you can try to pas arguments to it like you with models. Like for example in a wall:

 

"submodel": {"wall_north": {"model": "wall_side","uvlock": true}}

 

So i would try this:

"submodel": {"wall_north": {"model": "wall_side","uvlock": true},"var1":0, "var2":1}

 

If i check this with the jsonlint it doesn't give errors so that's alright. Don't know if it will work.

I would try it like this.

Posted

Mmmm....nope.  Typed like that the game through a "could not find variant" message caused by "Not a JSON Object: 6.0".  Shoving the var1/var2 stuff inside the } just to the left (so it was part of the submodel declaration) threw "Expected to[1] to be a Float, was "#height"" message instead.

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.

Posted

If each model has a different "to", then I think you need to stick to separate model files.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

If each model has a different "to", then I think you need to stick to separate model files.

 

That's what I figured, thought I'd ask.

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.

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



×
×
  • Create New...

Important Information

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