Jump to content

[1.12.2] Blockstate with item transforms doesn't load


MCrafterzz

Recommended Posts

Here is the blockstate file:

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "all": "blocks/dirt"
        }
    },
    "variants": {
        "layers": {
            "1": {
                "model": "ml:layer_2"
            },
            "2": {
                "model": "ml:layer_4"
            },
            "3": {
                "model": "ml:layer_6"
            },
            "4": {
                "model": "ml:layer_8"
            },
            "5": {
                "model": "ml:layer_10"
            },
            "6": {
                "model": "ml:layer_12"
            },
            "7": {
                "model": "ml:layer_14"
            },
            "8": {
                "model": "ml:layer_16"
            }
        },
        "inventory": [{
            "model": "ml:layer_2",
            "textures": {
                "all": "blocks/dirt"
            },
            "transform": {
                "display": {
                    "gui": {
                        "rotation": [30, 225, 0],
                        "translation": [0, 0, 0],
                        "scale": [0.625, 0.625, 0.625]
                    },
                    "ground": {
                        "rotation": [0, 0, 0],
                        "translation": [0, 3, 0],
                        "scale": [0.25, 0.25, 0.25]
                    },
                    "firstperson_righthand": {
                        "rotation": [0, 45, 0],
                        "translation": [0, 4.2, 0],
                        "scale": [0.40, 0.40, 0.40]
                    },
                    "firstperson_lefthand": {
                        "rotation": [0, 225, 0],
                        "translation": [0, 4.2, 0],
                        "scale": [0.40, 0.40, 0.40]
                    }
                }
            }
        }]
    }
}

Why doesn't this load correctly? It gives the error: [12:53:03] [main/ERROR] [FML]: Exception loading model for variant ml:dirt_layer#inventory for item "ml:dirt_layer", normal location exception

 

Removing the inventory part makes it load again.

 

Thankful for all help!

 

Edited by MCrafterzz
Link to comment
Share on other sites

The "transform" tag applies to models.

Blockstate files are not models.

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

You can specify display transformations in Forge's blockstates format, but not in the Vanilla model format like you're doing.

 

I explain how to do this here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thanks Choonster, I did change it but it seems to ignore everything except the gui part:

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "all": "blocks/dirt"
        }
    },
    "variants": {
        "layers": {
            "1": {
                "model": "ml:layer_2"
            },
            "2": {
                "model": "ml:layer_4"
            },
            "3": {
                "model": "ml:layer_6"
            },
            "4": {
                "model": "ml:layer_8"
            },
            "5": {
                "model": "ml:layer_10"
            },
            "6": {
                "model": "ml:layer_12"
            },
            "7": {
                "model": "ml:layer_14"
            },
            "8": {
                "model": "ml:layer_16"
            }
        },
        "inventory": [{
            "model": "ml:layer_2",
            "transform": {
                "gui": {
                    "rotation": [{
                        "x": 30
                    }, {
                        "y": 225
                    }, {
                        "z": 0
                    }],
                    "translation": [0, 0, 0],
                    "scale": 0.625
                },
                "ground": {
                    "rotation": [{
                        "x": 0
                    }, {
                        "y": 0
                    }, {
                        "z": 0
                    }],
                    "translation": [0, 3, 0],
                    "scale": 0.1
                },
                "firstperson_righthand": {
                    "rotation": [{
                        "x": 0
                    }, {
                        "y": 45
                    }, {
                        "z": 0
                    }],
                    "translation": [0, 4.2, 0],
                    "scale": 0.1
                },
                "firstperson_lefthand": {
                    "rotation": [{
                        "x": 0
                    }, {
                        "y": 225
                    }, {
                        "z": 0
                    }],
                    "translation": [0, 4.2, 0],
                    "scale": 0.1
                }
            }
        }]
    }
}

 

The scale is 0.1 but it's still much larger than any other block

Link to comment
Share on other sites

I'm not too sure, that looks right to me. Are you getting any errors in the log?

 

Try stepping through ForgeBlockStateV1.Variant.Deserializer#deserialize to see if it's recognising your transforms.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I'm not getting any errors and after changing some values it does seem to work. I just need to continue changing values it hopefully will be good. It's totally guess work so it'll take a while.

 

EDIT: I tried converting the values with code:

Main.logger.warn(new TRSRTransformation(new ItemTransformVec3f(new Vector3f(0, 45, 0), new Vector3f(0, 4.2f, 0), new Vector3f(0.4f,0.4f,0.4f))).getTranslation());

 

But it just printed out the same values as in the constructor :C

Edited by MCrafterzz
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.