Posted October 21, 20178 yr Here is my current blockstates file. { "forge_marker": 1, "defaults": { "model": "earlygameminer:miner" }, "variants": { "inventory": { "model": "cube_all", "textures": { "all": "blocks/dirt" } }, "variant": { "stone": { "textures": { "top": "blocks/stone", "side": "earlygameminer:blocks/miner_stone_side" } }, "iron": { "textures": { "top": "blocks/iron_block", "side": "earlygameminer:blocks/miner_iron_side" } }, "diamond": { "textures": { "top": "blocks/diamond_block", "side": "earlygameminer:blocks/miner_diamond_side" } } } } } My block has three versions (stone, iron, and diamond) which is indicated by an iProperty named "variant". All three varients render correctly in world. However in inventory only the "inventory" section is used. I set it as dirt so that I could see it is actually working. What is the syntax to have the inventory use the exact same logic as when placed? My block code is modeled after BlockPlanks. However I can't seem to understand where BlockPlanks sets up its blockstates file.
October 21, 20178 yr You have to register your variant with the ModelLoader. For example, I have this: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L147 I have my code set up to take an arbitrary property as a variant, I get the metadata value and state information for each subblock, then register it: https://github.com/Draco18s/ReasonableRealism/blob/1.11.2/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L162-L169 (The 1.12 code I use is more complicated due to the ModelRegistryEvent nonsense, so I linked the simpler snippet from 1.11) 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.
October 22, 20178 yr Author I'm not completely able to follow the logic in your helper class. Here is what I think you are doing. Please correct me where I am wrong. I'm using the ores in your mod as an example. 1) You have an ItemRawOre that implements subtypes. I didn't create a ItemMiner because the generic BlockItem seems to work fine. When each of the three variants of my block are mined, I get BlockItems of the three variants. Is creating a custom Item required? 2) You register all the ItemRawOre variants by calling EasyRegistry#registerItemWithVariants. 3) This loops through each of the subTypes of ItemRawOre calling ModelLoader#setCustomModelResourceLocation for each one. 4) Each one of the subTypes has its own blockState json file. Assuming all that is correct, here's what I don't understand. Why can I define one blockState json file for all the variants of my block in world, but I would need a different blockState json file for each of the variants in inventory?
October 22, 20178 yr 59 minutes ago, dakamojo said: I'm not completely able to follow the logic in your helper class. Here is what I think you are doing. Please correct me where I am wrong. I'm using the ores in your mod as an example. 1) You have an ItemRawOre that implements subtypes. I didn't create a ItemMiner because the generic BlockItem seems to work fine. When each of the three variants of my block are mined, I get BlockItems of the three variants. Is creating a custom Item required?2) You register all the ItemRawOre variants by calling EasyRegistry#registerItemWithVariants. My ItemRawOre is not a block, it is an item. This is so my ores can be subject to Fortune enchantments (among others). Quote 3) This loops through each of the subTypes of ItemRawOre calling ModelLoader#setCustomModelResourceLocation for each one. 4) Each one of the subTypes has its own blockState json file. 4 is Incorrect. I have one blockstate file. https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/resources/assets/harderores/blockstates/orechunks.json Each ore block also has a blockstate file, but the ore items themselves only have 1. The two do not have a relationship with each other. Quote Assuming all that is correct, here's what I don't understand. Why can I define one blockState json file for all the variants of my block in world, but I would need a different blockState json file for each of the variants in inventory? You don't. Here is my block json: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/resources/assets/harderores/blockstates/ore_hardiron.json Here's where I register it: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/ores/OresBase.java#L181 The easy registry is a mess because of the way I want to handle things in my main mod class (as a single function call). But here's a break down of what it does: 1) register and item the block with the game 2) get all valid states for the block and register an item model: https://github.com/Draco18s/ReasonableRealism/blob/1.11.2/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L46-L55 3) That involves calling ModelLoader.setCustomModelResourceLocation for each variant from the block's state: https://github.com/Draco18s/ReasonableRealism/blob/1.11.2/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L162-L169 My 1.12 code makes a hash of that process because it has to cache the object to register and then wait for the ModelRegistryEvent, but it still does just that: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L197-L199 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.