Jump to content

SuprizePlayz

Members
  • Posts

    12
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    https://www.youtube.com/c/
  • Location
    Germany
  • Personal Text
    Welcome to my Forge forum profile!
    My online nickname is "suprize" or "SuprizePlayz" and I currently study Computer Science.
    Sometimes I like to program, or at least try to, some mods with the Forge API or ideas in Java code.

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

SuprizePlayz's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. If you are using "IntelliJ IDEA", you can also press CTRL+SHIFT+F to search globally. Go to "Scope" and instead of "All Places" choose "Project and Libraries" in the dropdown menu right next to "Scope". What ever you type into the search bar in this small window, it will also look for in the game files. In your case, look for the Blocks class in the search field. Hope this helps.
  2. The entity path is clear to me, okay... But the collision means that it will be harder to programm because Minecraft hasn't such a good collision system, right? Err.... I don't think so...
  3. Yes, you're right. I meant the less commonly modded things instead of non-Minecraft things. I also thought of Entity or rideable entities, but i needed a verification of this. Now, I will try to find out more about rideable entities with inventory and will make some updates on this topic. Thanks for helping!
  4. Hello Guys, the reason why I started this topic was my inexperience in Minecraft Modding with Forge... As everyone wants to savor the best style in programming, I wanted to know how you could start adding for example cars or other non-Minecraft related objects into the game. At the moment, I'm programming my cars and roads modification, in which I need a little support. I couldn't find anything helpful in other guides as reference on YouTube. Tutorials or guidelines could help me! Thanks in advance and best regards, SuprizePlayz
  5. Both options aren't bad, but, as you said before, it is faster to code with getValue() method than annotations like @GameRegistry.ObjectHolder. I would prefer the getValue() way.
  6. 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");
  7. 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...
  8. 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); }
  9. 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
  10. But I have one problem left: Why aren't my textures and the subblocks themselves not registered? D:
  11. Okay, thanks to you, diesieben07! I will try that tomorrow. EDIT: It worked well, thanks!
  12. 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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.