July 28, 20196 yr Author I'm getting a bit of a strange error now. package goocraft4evr.expand_goocraft; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import com.goocraft.mod.items.ModItems; import com.goocraft.mod.proxy.ServerProxy; @Mod(modid=Main.MODID,version=Main.VERSION,name=Main.NAME,acceptedMinecraftVersions="[1.12.2]") public class Main { public static final String MODID = "goocraft_mod"; public static final String VERSION = "1.0"; public static final String NAME = "Goocraft4Evr's Expansionary Goodstuffs"; @Instance(MODID) public Main instance; @SidedProxy(clientSide = "goocraft4evr.expand_goocraft.proxy.Client_Proxy",serverSide = "goocraft4evr.expand_goocraft.proxy.Server_Proxy") public static ServerProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { ModItems.init(); proxy.preInit(event); } @EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); } @EventHandler public void postInit(FMLPostInitializationEvent event) { proxy.postInit(event); } } this is the entirety of my Main class. For some reason, classes like ModItems and ServyProxy are undefined. There's my hierarchy above.
July 28, 20196 yr Just now, SeptemberBlue said: this is the entirety of my Main class. For some reason, classes like ModItems and ServyProxy are undefined. Your imports aren't correct. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 28, 20196 yr Author Now my problem is that I can't get my item to show up in my inventory (since I had to redo the whole mod thing, I've decided to start with an item then once that's done I'd do the ore and whatever) Where should I look first?
July 28, 20196 yr 3 minutes ago, SeptemberBlue said: Where should I look first? What? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 28, 20196 yr Author Just now, Animefan8888 said: What? To be more specific, I'm wondering what java class would be responsible for why the items aren't showing up. To make it easier though, I'll just paste the code for these. ModItem: package goocraft4evr.expand_goocraft.items; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class ModItem extends Item { public ModItem(String name) { this.setRegistryName(name); this.setUnlocalizedName(name); this.setCreativeTab(CreativeTabs.MATERIALS); ModItems.ITEMS.add(this); } } ModItems: package goocraft4evr.expand_goocraft.items; import java.util.ArrayList; import java.util.List; import net.minecraft.item.Item; public class ModItems { public static final List<Item> ITEMS = new ArrayList<Item>(); public static void init() { new ModItem("Amethyst"); } } RegistryHandler: package goocraft4evr.expand_goocraft; import goocraft4evr.expand_goocraft.items.ModItems; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for (Item item:ModItems.ITEMS) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(),null)); } } } The Main method might also be relevant, but I've already posted that and it hasn't been changed.
July 28, 20196 yr 1 minute ago, SeptemberBlue said: @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } You need to call ModItems.init at the beginning of this. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 28, 20196 yr Author 2 minutes ago, Animefan8888 said: You need to call ModItems.init at the beginning of this. so do I just add ModItems.init() into the method?
July 28, 20196 yr Just now, SeptemberBlue said: so do I just add ModItems.init() into the method? Yes at the top of it. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 28, 20196 yr Author Just now, Animefan8888 said: Yes at the top of it. @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { ModItems.init(); event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } I tried this but the item didn't show up. Unless you wanted it outside the method, like above the @SubscribeEvent thing. I also thought I'd mention that I also have the item lang, textures and json set up in the res folder.
July 28, 20196 yr 11 minutes ago, SeptemberBlue said: I tried this but the item didn't show up. Unless you wanted it outside the method, like above the @SubscribeEvent thing. What you have is what I meant. Is there anything in the console. Make the string lower case here aka "amethyst" new ModItem("Amethyst"); VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 28, 20196 yr Author 2 minutes ago, Animefan8888 said: What you have is what I meant. Is there anything in the console. Make the string lower case here aka "amethyst" new ModItem("Amethyst"); By the looks of it, there's no mention of the item in the console.
July 28, 20196 yr 4 minutes ago, SeptemberBlue said: By the looks of it, there's no mention of the item in the console. Put a System.out.println in your registry method to see if it is called. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 28, 20196 yr Author 2 minutes ago, Animefan8888 said: Put a System.out.println in your registry method to see if it is called. nothing was outputted.
July 28, 20196 yr 4 minutes ago, SeptemberBlue said: nothing was outputted. Is your mod loading check the mods list on the main menu. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 28, 20196 yr Author 6 minutes ago, Animefan8888 said: Is your mod loading check the mods list on the main menu. Two things. First off, the mod doesn't seem to have anything set. It's still called example mod, despite the name, version, modid and whatnot set in the Main class. The other thing is that the mod's disabled. EDIT: I'll wait and see if I get this resolved, but if not, I'll just go back to the tutorial I used first and use the code from that to create functional items, as whatever code I have now clearly does not work, and I don't really know why either. Edited July 28, 20196 yr by SeptemberBlue
July 28, 20196 yr 2 minutes ago, SeptemberBlue said: The other thing is that the mod's disabled. Ok your mod isn't being loaded. You need to right click on the forge project Build Path->Configure Build Path->Order and Export->Select All->Apply and Close VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 28, 20196 yr Author Just now, Animefan8888 said: Ok your mod isn't being loaded. You need to right click on the forge project Build Path->Configure Build Path->Order and Export->Select All->Apply and Close already did it, one of the first steps of your tutorial.
July 28, 20196 yr 3 minutes ago, SeptemberBlue said: already did it, one of the first steps of your tutorial. Sometimes people skip parts lol. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 28, 20196 yr Author So I've gone and redone my code again, and I'm looking at the code for my registryhandler class. @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for (Item item:ModItems.ITEMS) { Main.proxy.registerItemRenderer(item, 0, "inventory"); } for (Block block:ModBlocks.BLOCKS) { Main.proxy.registerItemRenderer(Item.getItemFromBlock(block), 0, "inventory"); } } Is there a better way to rewrite this code or is this fine? EDIT: So I was working on my block, and while it does appear in the creative inventory, it's missing an inventory texture and its texture when dropped as an item (which I'm assuming is the same texture for the item when its held, as that is also missing). The block has the correct texture though when placed. I'm certain the json files are correct, so I'm not too sure at the moment what the issue would be. Edited July 28, 20196 yr by SeptemberBlue added the block for loop.
July 28, 20196 yr Look at (and/or post) your logs. 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.
July 28, 20196 yr Author 17 minutes ago, Draco18s said: Look at (and/or post) your logs. Logs being the text in the console, right? EDIT: [13:29:09] [main/ERROR] [FML]: Exception loading model for variant geg:amethyst_ore#inventory for item "geg:amethyst_ore", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model geg:amethyst_ore#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:296) ~[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:151) ~[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:559) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222] 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_222] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] EDIT: @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for (Item item:ModItems.ITEMS) { Main.proxy.registerItemRenderer(item, 0, "inventory"); } for (Block block:ModBlocks.BLOCKS) { Main.proxy.registerItemRenderer(Item.getItemFromBlock(block), 0, "inventory"); } } } Here's my registry class, if this is any help. Edited July 28, 20196 yr by SeptemberBlue
July 28, 20196 yr 22 minutes ago, SeptemberBlue said: Exception loading model for variant geg:amethyst_ore#inventory for item "geg:amethyst_ore" Look under this, see if there's another error starting with Caused By: Also post your 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.
July 28, 20196 yr Author 2 minutes ago, Draco18s said: Look under this, see if there's another error starting with Caused By: Also post your json files. all json files are named "amethyst_ore.json" blockstates: { "variants": { "normal": { "model": "geg:amethyst_ore" } } } block model: { "parent": "block/cube_all", "textures": { "all": "geg:blocks/amethyst_ore" } } item model: { "parent": "geg:block/amethyst_ore" } also, here's this: Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException
July 28, 20196 yr 1 hour ago, SeptemberBlue said: variant geg:amethyst_ore#inventory You don't have this. https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/resources/assets/harderores/blockstates/ore_limonite.json#L11-L16 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.
July 28, 20196 yr Author 15 minutes ago, Draco18s said: You don't have this. https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/resources/assets/harderores/blockstates/ore_limonite.json#L11-L16 EDIT: Alright, fixed blockstates. I'll just tweak it a bit, since I currently find it too cluttered. EDIT 2: Maybe it's just me, but when I run client, it feels like it's running more slowly than before. Should this concern me or no? If so, I think it has something to do with how I'm registering stuff. Speaking of which, do you just have 1 json per block? Because the 3 jsons I posted above were 3 seperate jsons. Edited July 28, 20196 yr by SeptemberBlue
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.