Each key in the "variants" object must be either a fully-specified variant (e..g. "inventory,variant=light") or a property name (e.g. "variant").
Each property must have its own key in the "variants" object and contain a key for each possible value of the property (whose value is a variant). You can't nest one property (e.g. "north", "south", "east" or "west") inside another property's value (e.g. "ight" or "dark").
You can see examples of blockstates files with multiple properties here and here.
On a related note: In the EnumInfuser loop in ModBlocks.initClient, the final registerBlockModel call for each EnumInfuser value will overwrite the previous two calls made in the boolean loop. This makes those calls pointless.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So the game treats every connection as a separate metadata value (at least in the world)? Back in 1.7, I just had to update the block texture from inside the getIcon(World world, int side) method. How am I supposed to do something similar now? I've looked at just about all of your TestMod3 code, and there are no examples of something that use this "nested" behavior. This whole modeling system just seems to make everything needlessly complicated.
Forge's blockstates format is optimised for use with properties that each have their own effect on the model (e.g. one property controls textures, another controls rotation), but it doesn't really handle the case of multiple properties affecting the model together (e.g. the combination of the variant and connection properties controls the texture for each side) unless you use fully-specified variants (like the vanilla format).
I think your situation is best handled by registering an IStateMapper so that the light and dark infusers use separate blockstates files, each of which specifies its own textures depending on the connection properties. This will achieve the nested behaviour you want.
To create the IStateMapper, create an instance of StateMap.Builder, call StateMap.Builder#withName with the variant property, call StateMap.Builder#withSuffix with a suffix like "_infuser" and then call StateMap.Builder#build. This will tell Minecraft to use the light_infuser.json and dark_infuser.json blockstates files instead of infuser.json.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Sounds great! So I just do something like this in my block constructor:
StateMap.Builder builder = new StateMap.Builder();
builder.withName(variant);
builder.withSuffix("_infuser");
builder.build();
Then set all of my top and bottom textures in defaults, and set the sides with the facing properties.
You need to register the IStateMapper by calling ModelLoader.setCustomStateMapper. These are all client-only classes, so they can only be referenced in client-only code (not the constructor).
Do I have to change how I register the models?
Yes. The ModelResourceLocation you pass to ModelLoader.setCustomModelResourceLocation should have your mod ID as the domain (magistics), the name of the blockstates file as the path (light_infuser or dark_infuser) and the variant of the blockstates file as the variant (either an existing variant like east=false,north=false,south=false,west=false or a custom fully-defined variant like inventory).
Ty so much for your help btw.
No problem.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I know I'm so close. When I place the infuser in the world, the top and bottom faces render, but not the sides. The inventory model also doesn't render, so I know I must be registering something wrong. I've updated the Gist.
EDIT: I figured it out for the facing portion; the block now renders in the world perfectly! My only issue now is what to do for the inventory variant. I've been having some trouble w/ the custom furnaces in this regard too; they render but their models are active and the front is reversed.
You're still calling registerBlockModel multiple times for each metadata value (infuser type), but only the last of these calls will be used. This means that Minecraft will try to use the model of the "east" variant (which doesn't exist) rather than the "inventory" variant.
If you've already fixed this, post your latest code.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I have the following block setup: Gist
When I load the game, my block model renders in the inventory, but not in the world. What am I doing wrong?
Your blockstates file is invalid.
Each key in the "variants" object must be either a fully-specified variant (e..g. "inventory,variant=light") or a property name (e.g. "variant").
Each property must have its own key in the "variants" object and contain a key for each possible value of the property (whose value is a variant). You can't nest one property (e.g. "north", "south", "east" or "west") inside another property's value (e.g. "ight" or "dark").
You can see examples of blockstates files with multiple properties here and here.
On a related note: In the EnumInfuser loop in ModBlocks.initClient, the final registerBlockModel call for each EnumInfuser value will overwrite the previous two calls made in the boolean loop. This makes those calls pointless.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So the game treats every connection as a separate metadata value (at least in the world)? Back in 1.7, I just had to update the block texture from inside the getIcon(World world, int side) method. How am I supposed to do something similar now? I've looked at just about all of your TestMod3 code, and there are no examples of something that use this "nested" behavior. This whole modeling system just seems to make everything needlessly complicated.
Forge's blockstates format is optimised for use with properties that each have their own effect on the model (e.g. one property controls textures, another controls rotation), but it doesn't really handle the case of multiple properties affecting the model together (e.g. the combination of the variant and connection properties controls the texture for each side) unless you use fully-specified variants (like the vanilla format).
I think your situation is best handled by registering an IStateMapper so that the light and dark infusers use separate blockstates files, each of which specifies its own textures depending on the connection properties. This will achieve the nested behaviour you want.
To create the IStateMapper, create an instance of StateMap.Builder, call StateMap.Builder#withName with the variant property, call StateMap.Builder#withSuffix with a suffix like "_infuser" and then call StateMap.Builder#build. This will tell Minecraft to use the light_infuser.json and dark_infuser.json blockstates files instead of infuser.json.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Sounds great! So I just do something like this in my block constructor:
StateMap.Builder builder = new StateMap.Builder();
builder.withName(variant);
builder.withSuffix("_infuser");
builder.build();
Then set all of my top and bottom textures in defaults, and set the sides with the facing properties. Do I have to change how I register the models?
Ty so much for your help btw.
You need to register the IStateMapper by calling ModelLoader.setCustomStateMapper. These are all client-only classes, so they can only be referenced in client-only code (not the constructor).
Yes. The ModelResourceLocation you pass to ModelLoader.setCustomModelResourceLocation should have your mod ID as the domain (magistics), the name of the blockstates file as the path (light_infuser or dark_infuser) and the variant of the blockstates file as the variant (either an existing variant like east=false,north=false,south=false,west=false or a custom fully-defined variant like inventory).
No problem.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I know I'm so close. When I place the infuser in the world, the top and bottom faces render, but not the sides. The inventory model also doesn't render, so I know I must be registering something wrong. I've updated the Gist.
EDIT: I figured it out for the facing portion; the block now renders in the world perfectly! My only issue now is what to do for the inventory variant. I've been having some trouble w/ the custom furnaces in this regard too; they render but their models are active and the front is reversed.
You're still calling registerBlockModel multiple times for each metadata value (infuser type), but only the last of these calls will be used. This means that Minecraft will try to use the model of the "east" variant (which doesn't exist) rather than the "inventory" variant.
If you've already fixed this, post your latest code.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
That moment when it all clicks. Thanks again!
https://github.com/T145/magistics/commit/696128fbaad8db51cea70af4a6460cc68ce4a934
No problem. I'm glad you got it working.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.