Posted April 25, 20178 yr Hi there, I'm attempting to add a bunch of fluids to the mod, and so far, everything appears to work except that the fluid in-world does not render correctly. The files that I believe to be relevant are below: https://github.com/turbodiesel4598/NuclearCraft/tree/master/src/main/java/nc/block/fluid https://github.com/turbodiesel4598/NuclearCraft/blob/master/src/main/java/nc/init/NCFluids.java https://github.com/turbodiesel4598/NuclearCraft/blob/master/src/main/java/nc/proxy/ClientProxy.java https://github.com/turbodiesel4598/NuclearCraft/blob/master/src/main/resources/assets/nuclearcraft/blockstates/fluids.json Is there a particular mistake I am making? Thanks in advance. Edited April 26, 20178 yr by turbodiesel4598
April 25, 20178 yr Post the FML log, it should say why the fluid blocks don't have a model. 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.
April 25, 20178 yr I cloned your repository to debug this locally, but I encountered an issue: You're manually adding the Tesla and JEI JARs in the libs directory as dependencies, but your repository doesn't include these files. You should prefer using Maven/Ivy dependencies as these will be automatically downloaded by Gradle when setting up the workspace. JEI's Developer Wiki explains how to add it as a Maven dependency here, Tesla's readme explains how to do this here. After fixing this, I narrowed down the source of your problem. The issue is that you're calling ModelLoader.setCustomStateMapper for your fluid Blocks before they've been registered, which ModelLoader doesn't support. You need to call it after they've been registered. In general, it's not entirely safe to pass around a Block or any other IForgeRegistryEntry before it's been registered. The technical explanation is that ModelLoader stores the registered IStateMappers in a HashMap<RegistryDelegate<Block>, IStateMapper>. HashMap uses Object#hashCode and Object#equals to determine if two keys are equal and RegistryDelegate.Delegate implements these using its name field, which is only set when an IForgeRegistryEntry.Impl instance (e.g. a Block) is registered. Before registration, all RegistryDelegates are equal to each other. When you call ModelLoader.setCustomStateMapper with a Block that hasn't been registered, the IStateMapper is stored in the HashMap with a null-named RegistryDelegate as the key. When you call it again with another unregistered Block, the HashMap considers the two null-named RegistryDelegates to be the same key, so it replaces the old IStateMapper value with the new one. When you call ModelLoader.setCustomStateMapper with a Block that has been registered, its RegistryDelegate will have a unique name (the Block's registry name) and be considered a distinct key in the HashMap from any other Block's RegistryDelegate. 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.
April 25, 20178 yr I've forked your repository and pushed the fixes for the issues I mentioned. You can view and/or merge these changes here. Edited April 27, 20178 yr by Choonster 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.
April 25, 20178 yr Author Ah, I see - that also might explain why the bucket textures of fluids blocks that were being registered earlier were playing up. Thanks so much for the help, and yes, I will get my dependencies fixed too Edited April 26, 20178 yr by turbodiesel4598
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.