Posted June 18, 20205 yr As stated in the title, i get the "model missing for variant" exception for a log-like block i'm creating, although the referenced model is there. The block is correctly looking in inventory and hand, but has the purple-black texture when placed. I know that, usually, when that exception is thrown, there is a description of the error underneath, however, in shell, there isn't. I'm doing 1.14.3 and using Eclipse, so i have to use a Windows Batch file to start the game. Exception loading blockstate definition: 'testmod:blockstates/carved_oak_log.json' missing model for variant: 'testmod:carved_oak_log#' Blockstate json: { "variants": { "axis=y": { "model": "testmod:block/carved_oak_log" }, "axis=z": { "model":"testmod:block/carved_oak_log", "x": 90 }, "axis=x": { "model": "testmod:block/carved_oak_log", "x": 90, "y": 90 } } } Model json: { "parent": "block/cube_column", "textures": { "end": "block/oak_log_top", "side": "testmod:block/carved_oak_log" } } Texture (pretty sure irrelevant but it is attachments). Registry: @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { //ITEMS ITEMS ITEMS// @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( //NormalItems ItemList.tutorial_item = new Item(new Item.Properties().group(ItemGroup.MISC)).setRegistryName(location("tutorial_item")), //Block Items ItemList.tutorial_block = new BlockItem(BlockList.tutorial_block, new Item.Properties().group(ItemGroup.MISC)).setRegistryName(BlockList.tutorial_block.getRegistryName()), ItemList.carved_oak_log = new BlockItem(BlockList.carved_oak_log, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(BlockList.carved_oak_log.getRegistryName()) ); logger.info("Items registered."); } //BLOCKS BLOCKS BLOCKS// @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { event.getRegistry().registerAll ( BlockList.tutorial_block = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0f, 2.0f).lightValue(7).sound(SoundType.METAL)).setRegistryName(location("tutorial_block")), BlockList.carved_oak_log = new Block(Block.Properties.create(Material.WOOD).hardnessAndResistance(2.0f, 2.0f).sound(SoundType.WOOD)).setRegistryName(location("carved_oak_log")) ); logger.info("Blocks registered."); } Edited June 19, 20205 yr by Bauzli
June 18, 20205 yr Show your code and the full error log. We're not telepathic. 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.
June 18, 20205 yr Author 7 minutes ago, [NoOneButNo] said: What is the name of your json files? and the full log? the name of both json files is carved_oak_log.json, the texture file is carved_oak_log.png. Both Blockstate and Model files are the corresponding oak log Models and Blockstates copied and changed. I don't really know what you mean with "The full log", but this is the 4 lines before it. Everything else is not related to the issues. [20:55:39.305] [Server-Worker-4/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'testmod:blockstates/carved_oak_log.json' in resourcepack: 'main' for variant: 'axis=z': Unknown blockstate property: 'axis' [20:55:39.305] [Server-Worker-4/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'testmod:blockstates/carved_oak_log.json' in resourcepack: 'main' for variant: 'axis=x': Unknown blockstate property: 'axis' [20:55:39.306] [Server-Worker-4/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'testmod:blockstates/carved_oak_log.json' in resourcepack: 'main' for variant: 'axis=y': Unknown blockstate property: 'axis' [20:55:39.306] [Server-Worker-4/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'testmod:blockstates/carved_oak_log.json' missing model for variant: 'testmod:carved_oak_log#'
June 18, 20205 yr Author 2 minutes ago, [NoOneButNo] said: Sounds like you did not properly implemented your blockstate "axis". Like i said, i just copied the oak log blockstate json over and changed the model names so they reference the model of my block. Do i have to create the axis blockstate itself myself?
June 18, 20205 yr Yes since you are not overriding the vanilla class responsible for that blockstate. Edit: Extending. Or making a new one while implementing that blockstate. Edited June 18, 20205 yr by [NoOneButNo]
June 18, 20205 yr Author 3 minutes ago, [NoOneButNo] said: Yes since you are not overriding the vanilla class responsible for that blockstate. Edit: Extending. Or making a new one while implementing that blockstate. I am pretty new to this so...what does that mean? I have basic understanding of Java, but if you don't wanna explain yourself, do you have an idea on where i could find information on how to do this? In the Vanilla assets, there is no axis.json file, so now i'm confused.
June 18, 20205 yr public class RotatedPillarBlock extends Block { public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS; public RotatedPillarBlock(Block.Properties properties) { super(properties); this.setDefaultState(this.getDefaultState().with(AXIS, Direction.Axis.Y)); } /** * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed * blockstate. * @deprecated call via {@link IBlockState#withRotation(Rotation)} whenever possible. Implementing/overriding is * fine. */ public BlockState rotate(BlockState state, Rotation rot) { switch(rot) { case COUNTERCLOCKWISE_90: case CLOCKWISE_90: switch((Direction.Axis)state.get(AXIS)) { case X: return state.with(AXIS, Direction.Axis.Z); case Z: return state.with(AXIS, Direction.Axis.X); default: return state; } default: return state; } } protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(AXIS); } public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(AXIS, context.getFace().getAxis()); } } This is an example of a vanilla block that implements it. Take your time and read it meanwhile Im gonna go get some sleep.
June 18, 20205 yr 2 minutes ago, Bauzli said: In the Vanilla assets, there is no axis.json file, so now i'm confused It isn't sn asset. It is a property of logs. Go look at one of the log json files. 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.
June 18, 20205 yr Author 34 minutes ago, Draco18s said: It isn't sn asset. It is a property of logs. Go look at one of the log json files. Thanks.This would mean that i can -somehow- add this property to my block and it would work. 35 minutes ago, [NoOneButNo] said: public class RotatedPillarBlock extends Block { public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS; public RotatedPillarBlock(Block.Properties properties) { super(properties); this.setDefaultState(this.getDefaultState().with(AXIS, Direction.Axis.Y)); } /** * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed * blockstate. * @deprecated call via {@link IBlockState#withRotation(Rotation)} whenever possible. Implementing/overriding is * fine. */ public BlockState rotate(BlockState state, Rotation rot) { switch(rot) { case COUNTERCLOCKWISE_90: case CLOCKWISE_90: switch((Direction.Axis)state.get(AXIS)) { case X: return state.with(AXIS, Direction.Axis.Z); case Z: return state.with(AXIS, Direction.Axis.X); default: return state; } default: return state; } } protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(AXIS); } public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(AXIS, context.getFace().getAxis()); } } I'm not advanced enough in Java to fully understand whats going on here, and i don't make a new class for the new Blocks i create. So i don't really know how to register a block that is in a whole new class.
June 18, 20205 yr 29 minutes ago, Bauzli said: i don't really know how to register a block that is in a whole new class. Its just like registering a block that isn't a whole new class. Except you call new on a different class. Shocking, I know. 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.
June 18, 20205 yr Sounds like you need to learn inheritance some more. This is actually basic polymorphism...
June 19, 20205 yr Author 16 hours ago, [NoOneButNo] said: Sounds like you need to learn inheritance some more. This is actually basic polymorphism... Yeah i know heritance fully, but to me writing mods in forge seems almost like a new language, especially because i have never worked with json before. 18 hours ago, Draco18s said: Its just like registering a block that isn't a whole new class. Except you call new on a different class. Shocking, I know. Thanks, actually fixed my issue. So thank all of you guys, you've actually both really helped me understand the registry process and how minecraft works codewise way more. Edited June 19, 20205 yr by Bauzli
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.