Posted September 10, 20178 yr Hello folks, I've got a problem with my block variants and I don't know what's wrong with the properties, but all should be okay... I've looked for errors and cannot find anything. I tried also searching on the Internet, f. ex. in this forum or planetminecraft.net, but I didn't find any useful for me. Here you can find my Crash Report: https://pastebin.com/tWgLcV9F I left the Proxy, the main and other classes out. If they are needed, I will post them! And here are the important classes involved in this event: The CustomBlockRoadSurface class: package com.youtube.realisticvehicles.blocks; import java.util.List; import javax.annotation.Nullable; import com.youtube.realisticvehicles.util.IMetaName; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.client.audio.Sound; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.youtube.realisticvehicles.blocks.CustomBlockRoadSurface.EnumType.*; public class CustomBlockRoadSurface extends Block implements IMetaName { public static final PropertyEnum<CustomBlockRoadSurface.EnumType> VARIANT = PropertyEnum.<CustomBlockRoadSurface.EnumType>create("variant", CustomBlockRoadSurface.EnumType.class); public CustomBlockRoadSurface(String name) { super(Material.ROCK); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, NORMALWHITE)); setUnlocalizedName(name); setRegistryName(name); setHardness(3.0f); setResistance(5.0f); setHarvestLevel("pickaxe", 2); setSoundType(SoundType.GROUND); } @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, ITooltipFlag advanced) { } @Override public int damageDropped(IBlockState state) { return ((CustomBlockRoadSurface.EnumType) state.getValue(VARIANT)).getMeta(); } @Override public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> items) { for(CustomBlockRoadSurface.EnumType customblockroadsurface$enumtype : values()) { items.add(new ItemStack(this, 1, customblockroadsurface$enumtype.getMeta())); } } //@Deprecated @Override public IBlockState getStateFromMeta(int meta) { return blockState.getBaseState().withProperty(VARIANT, CustomBlockRoadSurface.EnumType.byMetadata(meta)); } @Override public int getMetaFromState(IBlockState state) { return ((CustomBlockRoadSurface.EnumType) state.getValue(VARIANT)).getMeta(); } @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(Item.getItemFromBlock(this), 1, (int) getMetaFromState(world.getBlockState(pos))); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {VARIANT}); } public static enum EnumType implements IStringSerializable { NORMALWHITE(0, "normal_white"), LEFTWHITE(1, "left_white"), RIGHTWHITE(2, "right_white"), DOUBLEDWHITE(3, "doubled_white"), //RSCW(4, "combined_white"); PARKINGRIGHTWHITE(4, "parkingright_white"); private static final CustomBlockRoadSurface.EnumType[] META_LOOKUP = new CustomBlockRoadSurface.EnumType[values().length]; private final int meta; private final String name, unlocalizedName; private EnumType(int meta, String name) { this(meta, name, name); } private EnumType(int meta, String name, String unlocalizedName) { this.meta = meta; this.name = name; this.unlocalizedName = unlocalizedName; } @Override public String getName() { return this.name(); } public int getMeta() { return this.meta; } public String getUnlocalizedName() { return this.unlocalizedName; } public String toString() { return this.name; } public static CustomBlockRoadSurface.EnumType byMetadata(int meta) { return META_LOOKUP[meta]; } static { for(CustomBlockRoadSurface.EnumType customblockroadsurface$enumtype : values()) { META_LOOKUP[customblockroadsurface$enumtype.getMeta()] = customblockroadsurface$enumtype; } } } @Override public String getSpecialName(ItemStack stack) { return values()[stack.getItemDamage()].getName(); } } The ItemBlockVariants class: package com.youtube.realisticvehicles.blocks.item; import com.youtube.realisticvehicles.util.IMetaName; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; public class ItemBlockVariants extends ItemBlock { public ItemBlockVariants(Block block) { super(block); setHasSubtypes(true); setMaxDamage(0); } @Override public String getUnlocalizedName(ItemStack stack) { return super.getUnlocalizedName() + "_" + ((IMetaName)this.block).getSpecialName(stack); } @Override public int getMetadata(int damage) { return damage; } } ... and last, but not least: the BlockInit class: package com.youtube.realisticvehicles.init; import com.youtube.realisticvehicles.Reference; import com.youtube.realisticvehicles.blocks.Asphalt; import com.youtube.realisticvehicles.blocks.CustomBlockRoadSurface; import com.youtube.realisticvehicles.blocks.Road_Surface; import com.youtube.realisticvehicles.blocks.Velocity_80; import com.youtube.realisticvehicles.blocks.item.ItemBlockVariants; import com.youtube.realisticvehicles.tabs.RoadBlocksTab; import com.youtube.realisticvehicles.tabs.RoadSignsTab; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.ForgeRegistries; public class BlockInit { public static Block asphalt; public static Block velocity_80; public static Block road_surface; public static final RoadBlocksTab roadblocks = new RoadBlocksTab(); public static final RoadSignsTab roadsigns = new RoadSignsTab(); public static void init() { asphalt = new Asphalt(Material.ROCK, "asphalt", roadblocks, SoundType.STONE, 3, 5, 0, 0, "pickaxe", 2); velocity_80 = new Velocity_80(Material.IRON, "velocity_80", roadsigns, SoundType.METAL, 3, 5, 0, 0, "pickaxe", 2); road_surface = new CustomBlockRoadSurface("road_surface"); } public static void register() { registerBlock(asphalt); registerBlock(velocity_80); registerBlock(road_surface, new ItemBlockVariants(road_surface)); } public static void registerBlock(Block block) { ForgeRegistries.BLOCKS.register(block); ItemBlock item = new ItemBlock(block); item.setRegistryName(block.getRegistryName()); ForgeRegistries.ITEMS.register(item); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); } public static void registerBlock(Block block, ItemBlock itemblock) { ForgeRegistries.BLOCKS.register(block); itemblock.setRegistryName(block.getRegistryName()); ForgeRegistries.ITEMS.register(itemblock); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); } public static void registerBlockWithVariants(Block block, ItemBlock itemblock) { ForgeRegistries.BLOCKS.register(block); itemblock.setRegistryName(block.getRegistryName()); ForgeRegistries.ITEMS.register(itemblock); } public static void registerRender(Block block, int meta, String filename) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(new ResourceLocation(Reference.MODID, filename), "inventory")); } public static void registerRenders() { for(int i = 0; i < CustomBlockRoadSurface.EnumType.values().length; i++) { registerRender(road_surface, i, "road_surface_" + CustomBlockRoadSurface.EnumType.values()[i].getName()); } } } I hope, you can find any errors in here. Thanks in advance, SuprizePlayz Edited September 12, 20178 yr by SuprizePlayz
September 10, 20178 yr Author Okay, thanks to you, diesieben07! I will try that tomorrow. EDIT: It worked well, thanks! Edited September 11, 20178 yr by SuprizePlayz New state of the program
September 11, 20178 yr Author But I have one problem left: Why aren't my textures and the subblocks themselves not registered? D:
September 11, 20178 yr Author 18 minutes ago, diesieben07 said: You need to use the registry events to register things. I tried ItemInit#registerRenders() with a for loop to register everything in the enum as a item, package com.youtube.realisticvehicles.init; import com.youtube.realisticvehicles.Reference; import com.youtube.realisticvehicles.blocks.CustomBlockRoadSurface; import com.youtube.realisticvehicles.items.Canister; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; public class ItemInit { public static Item canister; public static CustomBlockRoadSurface road_surface; public static void init() { canister = new Canister("canister", TabInit.items); road_surface = new CustomBlockRoadSurface("road_surface"); } public static void register() { registerRender(canister, 0, "canister"); registerRenders(); } public static void registerRender(Item item, int meta, String filename) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":" + filename), "inventory")); } public static void registerRenders() { for(int i = 0; i < CustomBlockRoadSurface.EnumType.values().length; i++) { registerRender(Item.getItemFromBlock(road_surface), i, "road_surface_" + CustomBlockRoadSurface.EnumType.values()[i].getName()); } } } ...but it says, Forge cannot load them. I've made textures correctly named and all needed .json files. [13:09:48] [main/ERROR]: Exception loading model for variant realisticvehicles:road_surface_rightwhite#inventory for items ["minecraft:air", "realisticvehicles:road_surface"], normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model realisticvehicles:item/road_surface_rightwhite with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:297) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.io.FileNotFoundException: realisticvehicles:models/item/road_surface_rightwhite.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1600(ModelLoader.java:126) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:933) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [13:09:48] [main/ERROR]: Exception loading model for variant realisticvehicles:road_surface_rightwhite#inventory for items ["minecraft:air", "realisticvehicles:road_surface"], blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model realisticvehicles:road_surface_rightwhite#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:305) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1242) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [13:09:48] [main/ERROR]: Exception loading model for variant realisticvehicles:road_surface_normalwhite#inventory for items ["minecraft:air", "realisticvehicles:road_surface"], normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model realisticvehicles:item/road_surface_normalwhite with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:297) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.io.FileNotFoundException: realisticvehicles:models/item/road_surface_normalwhite.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1600(ModelLoader.java:126) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:933) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [13:09:48] [main/ERROR]: Exception loading model for variant realisticvehicles:road_surface_normalwhite#inventory for items ["minecraft:air", "realisticvehicles:road_surface"], blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model realisticvehicles:road_surface_normalwhite#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:305) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1242) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [13:09:48] [main/ERROR]: Exception loading model for variant realisticvehicles:road_surface#variant=normalwhite for blockstate "realisticvehicles:road_surface[variant=normalwhite]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model realisticvehicles:road_surface#variant=normalwhite with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:233) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:221) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:159) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1242) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 21 more [13:09:48] [main/ERROR]: Exception loading model for variant realisticvehicles:road_surface_doublewhite#inventory for items ["minecraft:air", "realisticvehicles:road_surface"], normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model realisticvehicles:item/road_surface_doublewhite with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:297) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.io.FileNotFoundException: realisticvehicles:models/item/road_surface_doublewhite.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1600(ModelLoader.java:126) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:933) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [13:09:48] [main/ERROR]: Exception loading model for variant realisticvehicles:road_surface_doublewhite#inventory for items ["minecraft:air", "realisticvehicles:road_surface"], blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model realisticvehicles:road_surface_doublewhite#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:305) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1242) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [13:09:48] [main/FATAL]: Suppressed additional 6 model loading errors for domain realisticvehicles Edited September 11, 20178 yr by SuprizePlayz
September 11, 20178 yr Author I was a bit confused, sorry for that. I cleaned up a bit of my code and managed it to register all blocks now with RegistryEvent.Register<block> (and so on) and used for the models the ModelRegistryEvent. Fortunately, I have no more errors after Pre-Init/Init/Post-Init. Unfortunately, the subblocks don't have their own texture, but the baseState texture from realisticvehicles:road_surface_normal_white. I think the problem is my .json-files could be wrong programed or the code doesn't contain this part in itself... The classes look now like this: RegistryHandler.java: package com.youtube.realisticvehicles.handlers; import com.youtube.realisticvehicles.Reference; import com.youtube.realisticvehicles.blocks.item.ItemBlockVariants; import com.youtube.realisticvehicles.init.ModBlocks; import net.minecraft.block.Block; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.registries.IForgeRegistry; import java.util.HashSet; import java.util.Set; @Mod.EventBusSubscriber public class RegistryHandler { public static final Set<ItemBlock> ITEM_BLOCKS = new HashSet<>(); @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> registry = event.getRegistry(); registry.registerAll( ModBlocks.ASPHALT, ModBlocks.ROAD_SURFACE, ModBlocks.VELOCITY_80 ); } @SubscribeEvent public static void registerItemBlocks(RegistryEvent.Register<Item> event) { final ItemBlock[] items = { new ItemBlock(ModBlocks.ASPHALT), new ItemBlockVariants(ModBlocks.ROAD_SURFACE), new ItemBlock(ModBlocks.VELOCITY_80), }; final IForgeRegistry<Item> registry = event.getRegistry(); for (final ItemBlock item : items) { registry.register(item.setRegistryName(item.getBlock().getRegistryName())); ITEM_BLOCKS.add(item); } } @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ASPHALT), 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":asphalt"), "inventory")); /*ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 1, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 2, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 3, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "inventory"));*/ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 4, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "variant=normal_white")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 1, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "variant=left_white")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 2, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "variant=right_white")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 3, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "variant=double_white")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 4, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "variant=parkingright_white")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.VELOCITY_80), 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":velocity_80"), "inventory")); } } ModBlocks.java: package com.youtube.realisticvehicles.init; import com.youtube.realisticvehicles.Reference; import com.youtube.realisticvehicles.blocks.Asphalt; import com.youtube.realisticvehicles.blocks.CustomBlockRoadSurface; import com.youtube.realisticvehicles.blocks.Velocity_80; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; @SuppressWarnings("WeakerAccess") @ObjectHolder(Reference.MODID) public class ModBlocks { @ObjectHolder("asphalt") public static final Block ASPHALT = new Asphalt(Material.ROCK, "asphalt", ModTabs.roadblocks, SoundType.STONE, 3, 5, 0, 0, "pickaxe", 2); @ObjectHolder("velocity_80") public static final Block VELOCITY_80 = new Velocity_80(Material.IRON, "velocity_80", ModTabs.roadsigns, SoundType.METAL, 3, 5, 0, 0, "pickaxe", 2); @ObjectHolder("road_surface") public static final Block ROAD_SURFACE = new CustomBlockRoadSurface("road_surface"); } ClientProxy.java: package com.youtube.realisticvehicles.proxy; import com.youtube.realisticvehicles.handlers.RecipeHandler; import com.youtube.realisticvehicles.handlers.RegistryHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; public class ClientProxy extends CommonProxy { public void preInit(FMLPreInitializationEvent e) { super.preInit(e); RecipeHandler.registerCrafting(); RecipeHandler.registerSmelting(); RegistryHandler handler = new RegistryHandler(); } public void init(FMLInitializationEvent e) { super.init(e); } public void postInit(FMLPostInitializationEvent e) { super.postInit(e); }
September 11, 20178 yr 2 hours ago, SuprizePlayz said: RegistryHandler handler = new RegistryHandler(); This line does jack and all. Get rid of it. ModelLoader is SideOnly(CLIENT), you can't have it in common code. 2 hours ago, SuprizePlayz said: @ObjectHolder("asphalt") public static final Block ASPHALT = new Asphalt(Material.ROCK, "asphalt", ModTabs.roadblocks, SoundType.STONE, 3, 5, 0, 0, "pickaxe", 2); You are not using ObjectHolder correctly. If you are assigning the value yourself, you don't need the annotation. 2 hours ago, SuprizePlayz said: public static final Set<ItemBlock> ITEM_BLOCKS = new HashSet<>(); You're doing nothing with this hashset except adding things to it. You don't need it. 2 hours ago, SuprizePlayz said: ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 4, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 4, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "variant=parkingright_white")); You're registering two different model variants for the same item-metadata combination. 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.
September 11, 20178 yr Author 39 minutes ago, Draco18s said: 2 hours ago, SuprizePlayz said: ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 4, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.ROAD_SURFACE), 4, new ModelResourceLocation(new ResourceLocation(Reference.MODID + ":road_surface"), "variant=parkingright_white")); And how should I register it then? I tried many variations of registration, but nothing worked really... setItemBlockModel(ModBlocks.ASPHALT, 0, "asphalt", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 0, "road_surface", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 0, "road_surface_normal_white", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 1, "road_surface_left_white", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 2, "road_surface_right_white", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 3, "road_surface_double_white", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 3, "road_surface", "variant=double_white"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 4, "road_surface_parkingright_white", "inventory"); I tried it like this and it was nearly fulfilled... Only the road_surface_double_white Block doesn't get displayed... Edited September 11, 20178 yr by SuprizePlayz
September 11, 20178 yr 39 minutes ago, SuprizePlayz said: And how should I register it then? I tried many variations of registration, but nothing worked really... Uh... Use the metadata value that that state encodes to in your getMetaFromState? 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.
September 11, 20178 yr Author setItemBlockModel(ModBlocks.ROAD_SURFACE, 0, "road_surface", "variant=normal_white"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 1, "road_surface", "variant=left_white"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 2, "road_surface", "variant=right_white"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 3, "road_surface", "variant=double_white"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 4, "road_surface", "variant=parkingright_white"); I tried this, but it only displays the standard block model of road_surface If I try this, it works perfectly...: setItemBlockModel(ModBlocks.ROAD_SURFACE, 0, "road_surface", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 0, "road_surface_normal_white", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 1, "road_surface_left_white", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 2, "road_surface_right_white", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 3, "road_surface_double_white", "inventory"); setItemBlockModel(ModBlocks.ROAD_SURFACE, 4, "road_surface_parkingright_white", "inventory");
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.