Posted September 26, 20178 yr Hi, I've been trying to figure out how to get a variant property string (for the purposes of building a ModelResourceLocation for a subblock) programmatically, given a block meta and/or blockstate. The variants seem to be ordered the same as meta, but I am not sure if this is always the case. If it is, is there a better way than doing blockState.getValue(blockState.getPropertyKeys(...))? If it is not the case, how would one achieve this? Also, I've noticed there is a getVariants method in BlockStateMapper, but I'm unable to get a handle on the BlockModelShapes as early as I require (in the ModelRegistryEvent) sadly. Cheers. Edited December 20, 20177 yr by CosmicDan Mark as solved CosmicDan.com Windows software, Android hacking, and other curios
September 26, 20178 yr Create an instance of an anonymous class that extends StateMapperBase and implements StateMapperBase#getModelResourceLocation to return a dummy ModelResourceLocation (e.g. new ModelResourceLocation("minecraft:air")). You can then use StateMapperBase#getPropertyString to get a property string to use as the variant of a ModelResourceLocation. You can see how I do this in my mod here and 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.
September 26, 20178 yr Author Oh wow that seems really obvious now, I already use #getPropertyString in an actual StateMapper already *facepalm* Thanks heaps! An aside, would you happen to have any recommended reading for the latest Forge stuff (in addition to the Forge docs and TheGreyGhost's articles/MBE repo)? I recently read a gist of yours that was helpful. CosmicDan.com Windows software, Android hacking, and other curios
September 26, 20178 yr Definitely check out these - https://wiki.mcjty.eu/modding/index.php/Main_Page McJty is doing a great job explaining plenty of topics there and has links to other sites as well.
September 26, 20178 yr I try to keep TestMod3 up to date with the latest Forge/Minecraft changes, so you can reference it to see how to adapt to recent changes or how to implement various features. You can also search this forum to see if anyone has asked about the topic before. 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.
September 26, 20178 yr Author Sweet, thanks guys - will do. CosmicDan.com Windows software, Android hacking, and other curios
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.