Erfurt Posted April 9, 2016 Share Posted April 9, 2016 Hey guys, So I was wondering if there is an easy/simple way to use the cobblestone wall model for my own custom walls. I would like to use the vanilla model, so that my mod is compatible with resource packs that change the 3D model. At the moment I'm still in the process of figuring out what kinds of stuff my mod needs, and how to go about doing it. So I haven't looked much into it code wise yet. But to my knowledge I will need a lot of .json files per new wall block. Something like 8 .json files, I think. So I would basically just want to know if there is a way to make it easier, so I maybe only need a couple of .json files per block, but I somehow doubt it's possible. I have made this code for the new wall blocks to use, still a lot of stuff I need to add, but this is good enough for now. public class BlockWall2 extends BlockWall { public BlockWall2(Block modelBlock) { super(modelBlock); this.setResistance(10.0F); this.setHardness(1.5F); this.setCreativeTab(CreativeTabs.tabDecorations); } public int damageDropped(int meta) { return meta; } public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { return true; } } I have make a quick and dirty blockstate { "variants": { "east=false,north=false,south=false,up=false,west=false": { "model": "hawm:wall_stonebrick_post" }, "east=false,north=true,south=false,up=false,west=false": { "model": "hawm:wall_stonebrick_n" }, "east=true,north=false,south=false,up=false,west=false": { "model": "hawm:wall_stonebrick_n", "y": 90, "uvlock": true }, "east=false,north=false,south=true,up=false,west=false": { "model": "hawm:wall_stonebrick_n", "y": 180, "uvlock": true }, "east=false,north=false,south=false,up=false,west=true": { "model": "hawm:wall_stonebrick_n", "y": 270, "uvlock": true }, "east=true,north=true,south=false,up=false,west=false": { "model": "hawm:wall_stonebrick_ne" }, "east=true,north=false,south=true,up=false,west=false": { "model": "hawm:wall_stonebrick_ne", "y": 90, "uvlock": true }, "east=false,north=false,south=true,up=false,west=true": { "model": "hawm:wall_stonebrick_ne", "y": 180, "uvlock": true }, "east=false,north=true,south=false,up=false,west=true": { "model": "hawm:wall_stonebrick_ne", "y": 270, "uvlock": true }, "east=false,north=true,south=true,up=false,west=false": { "model": "hawm:wall_stonebrick_ns" }, "east=true,north=false,south=false,up=false,west=true": { "model": "hawm:wall_stonebrick_ns", "y": 90, "uvlock": true }, "east=true,north=true,south=true,up=false,west=false": { "model": "hawm:wall_stonebrick_nse" }, "east=true,north=false,south=true,up=false,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 90, "uvlock": true }, "east=false,north=true,south=true,up=false,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 180, "uvlock": true }, "east=true,north=true,south=false,up=false,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 270, "uvlock": true }, "east=true,north=true,south=true,up=false,west=true": { "model": "hawm:wall_stonebrick_nsew" }, "east=false,north=false,south=false,up=true,west=false": { "model": "hawm:wall_stonebrick_post" }, "east=false,north=true,south=false,up=true,west=false": { "model": "hawm:wall_stonebrick_n" }, "east=true,north=false,south=false,up=true,west=false": { "model": "hawm:wall_stonebrick_n", "y": 90, "uvlock": true }, "east=false,north=false,south=true,up=true,west=false": { "model": "hawm:wall_stonebrick_n", "y": 180, "uvlock": true }, "east=false,north=false,south=false,up=true,west=true": { "model": "hawm:wall_stonebrick_n", "y": 270, "uvlock": true }, "east=true,north=true,south=false,up=true,west=false": { "model": "hawm:wall_stonebrick_ne" }, "east=true,north=false,south=true,up=true,west=false": { "model": "hawm:wall_stonebrick_ne", "y": 90, "uvlock": true }, "east=false,north=false,south=true,up=true,west=true": { "model": "hawm:wall_stonebrick_ne", "y": 180, "uvlock": true }, "east=false,north=true,south=false,up=true,west=true": { "model": "hawm:wall_stonebrick_ne", "y": 270, "uvlock": true }, "east=false,north=true,south=true,up=true,west=false": { "model": "hawm:wall_stonebrick_ns_above" }, "east=true,north=false,south=false,up=true,west=true": { "model": "hawm:wall_stonebrick_ns_above", "y": 90, "uvlock": true }, "east=true,north=true,south=true,up=true,west=false": { "model": "hawm:wall_stonebrick_nse" }, "east=true,north=false,south=true,up=true,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 90, "uvlock": true }, "east=false,north=true,south=true,up=true,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 180, "uvlock": true }, "east=true,north=true,south=false,up=true,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 270, "uvlock": true }, "east=true,north=true,south=true,up=true,west=true": { "model": "hawm:wall_stonebrick_nsew" } } } And for the rest of the .json files the code looks somewhat the same as this { "parent": "block/wall_n", "textures": { "wall": "blocks/stonebrick" } } Basically the code is modified vanilla code, but for some reason it doesn't work. If anyone can see why this isn't working I would love to know what I have done wrong. Quote Link to comment Share on other sites More sharing options...
coolAlias Posted April 9, 2016 Share Posted April 9, 2016 You can use Forge's blockstate format to condense the number of JSONs required. What exactly is not working? Are you getting the purple and black texture, or is something else wrong? Check your console log output for texture errors. Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
Erfurt Posted April 9, 2016 Author Share Posted April 9, 2016 You can use Forge's blockstate format to condense the number of JSONs required. What exactly is not working? Are you getting the purple and black texture, or is something else wrong? Check your console log output for texture errors. Good to know. The only error message I get is this. [17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=false,north=false,south=true,up=false,variant=cobblestone,west=true not found [17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=true,north=false,south=false,up=false,variant=cobblestone,west=true not found [17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=true,north=false,south=true,up=true,variant=cobblestone,west=true not found [17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=true,north=true,south=true,up=false,variant=mossy_cobblestone,west=true not found [17:34:42] [Client thread/ERROR] [FML]: Supressed additional 71 model loading errors for domain hawm My problem is that it doesn't have the correct render. And is showing up as black and purple. Quote Link to comment Share on other sites More sharing options...
coolAlias Posted April 9, 2016 Share Posted April 9, 2016 That's because your blockstate file does not include all of the block variants: hawm:wall_stonebrick#east=false,north=false,south=true,up=false,variant=cobblestone,west=true You can either use an UnlistedProperty for the stone type, or you need to include that variant in your blockstate file. I recommend using the Forge syntax - it will greatly reduce the number of files and lines you need to use. Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
Erfurt Posted April 9, 2016 Author Share Posted April 9, 2016 That's because your blockstate file does not include all of the block variants: hawm:wall_stonebrick#east=false,north=false,south=true,up=false,variant=cobblestone,west=true You can either use an UnlistedProperty for the stone type, or you need to include that variant in your blockstate file. I recommend using the Forge syntax - it will greatly reduce the number of files and lines you need to use. Yeah, I don't fully know why it want 'variant=cobblestone' because I don't have it listed in my code, I can only see it coming from the original BlockWall class. But I'm not sure. Anyway, I will look into the Forge syntax, and se if I can learn something new there. Thanks for your help Quote Link to comment Share on other sites More sharing options...
coolAlias Posted April 9, 2016 Share Posted April 9, 2016 Yes, it's from BlockWall. If you are not using it, you should override #createBlockState, #getStateFromMeta, and #getMetaFromState. However, since the default state + properties are usually set in the constructor, you should check BlockWall's constructor and make sure it is not setting that property; if it is, you are probably better off just extending Block instead of BlockWall, though I'm not sure how much of an impact that will have on your custom wall's compatibility with other walls. Another option would be to use a custom state mapper and ignore the variant state: ModelLoader.setCustomStateMapper(yourBlock, (new StateMap.Builder()).addPropertiesToIgnore(VARIANT).build()); Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
Erfurt Posted April 9, 2016 Author Share Posted April 9, 2016 Yes, it's from BlockWall. If you are not using it, you should override #createBlockState, #getStateFromMeta, and #getMetaFromState. However, since the default state + properties are usually set in the constructor, you should check BlockWall's constructor and make sure it is not setting that property; if it is, you are probably better off just extending Block instead of BlockWall, though I'm not sure how much of an impact that will have on your custom wall's compatibility with other walls. Another option would be to use a custom state mapper and ignore the variant state: ModelLoader.setCustomStateMapper(yourBlock, (new StateMap.Builder()).addPropertiesToIgnore(VARIANT).build()); I have tried most of the things you suggested, however none seems to work for me for some reason. I haven't tried using a custom state mapper, because I'm not familiar with how or where to use it correctly. Is it in class for itself, or is it somewhere in my block class? Quote Link to comment Share on other sites More sharing options...
coolAlias Posted April 9, 2016 Share Posted April 9, 2016 You set custom state mappers at the same time you register your block models, typically from the ClientProxy (or a method call originating from there). You don't have to implement anything special in your Block class to do so. Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
Erfurt Posted April 9, 2016 Author Share Posted April 9, 2016 You set custom state mappers at the same time you register your block models, typically from the ClientProxy (or a method call originating from there). You don't have to implement anything special in your Block class to do so. Everything is working as intended now Thanks a lot! Now I just need to figure out how to make the block connect to vanilla walls, and vice versa. Also some minor bugs I have Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.