Absithium_gamer Posted October 14, 2017 Posted October 14, 2017 Learningmod.java package Com.absithiumgamer.learningmod; import Com.absithiumgamer.learningmod.proxy.CommonProxy; import init.ModItems; 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; @Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VESRIONS) public class learningmod { @Instance public static learningmod instance; @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { ModItems.init(); ModItems.register(); } @EventHandler public void Init(FMLInitializationEvent event) { proxy.init(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } Reference package Com.absithiumgamer.learningmod; public class Reference { public static final String MOD_ID = "alm"; public static final String NAME = "Learning Mod"; public static final String VERSION="1.0"; public static final String ACCEPTED_VESRIONS = "[1.11.2]"; public static final String CLIENT_PROXY_CLASS = "Com.absithiumgamer.learningmod.proxy.ClientProxy"; public static final String SERVER_PROXY_CLASS = "Com.absithiumgamer.learningmod.proxy.Serverproxy"; public static enum learningmodItems{ OBSIDIANINGOT("obsidianingot","ItemObsidianingot"); private String unlocalizedName; private String registryName; learningmodItems(String unlocalizedName,String registryName) { this.unlocalizedName = unlocalizedName; this.registryName = registryName; } public String getUnlocalizedName() { return unlocalizedName; } public String getRegistryName() { return registryName; } } } ModItems.java package init; import items.ItemObsidianingot; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModItems { public static Item obsidianingot; public static void init () { obsidianingot = new ItemObsidianingot(); } public static void register() { GameRegistry.register(obsidianingot); } public static void registerRenders() { registerRender(obsidianingot); } private static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } } ItemObsidianingot package items; import Com.absithiumgamer.learningmod.Reference; import net.minecraft.item.Item; public class ItemObsidianingot extends Item { public ItemObsidianingot() { setUnlocalizedName(Reference.learningmodItems.OBSIDIANINGOT.getUnlocalizedName()); setRegistryName(Reference.learningmodItems.OBSIDIANINGOT.getRegistryName()); } } itemobsidianingot { "parent": "item/generated", "textures": { "layer0": "alm:item/obsidianingot" }, "display": { "thirdperson": { "rotation": [-90,0,0], "translation": [0,1,-3], "scale": [0.55,0.55,0.55] }, "firstperson": { "rotation": [0,-135,25], "translation": [0,4,2], "scale": [1.7,1.7,1.7] } } } en_US.lang item.obsidianingot.name=Obsidian Ingot Any help would be appreciated the problem is that the item texture does not display in the game Quote
Absithium_gamer Posted October 15, 2017 Author Posted October 15, 2017 2 hours ago, diesieben07 said: Do not use the ItemModelMesher. Use ModelLoader.setCustomModelResourceLocation in ModelRegistryEvent. Use the registry events to register your blocks and items. can you give an example how to do that Quote
Absithium_gamer Posted October 15, 2017 Author Posted October 15, 2017 Just now, diesieben07 said: Which part? how to change item model mesher to modelloader Quote
ModMCdl Posted October 15, 2017 Posted October 15, 2017 4 hours ago, diesieben07 said: You just use setCustomModelResourceLocation instead of the ItemModelMesher method. Coming from someone who updated all of his projects quite recently, I actually had a lot of trouble trying to update. I can understand why they are confused. I'd offer to help, but my "patchwork" is shoddy on that bit. I often just update ItemModelMesher on my old mods to match the current syntax, and just use ModelLoader on new projects. ItemModelMesher works, but it doesn't work well. ModelLoader is a lot more stable. 1 Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
Draco18s Posted October 15, 2017 Posted October 15, 2017 10 hours ago, ModMCdl said: ItemModelMesher works, but it doesn't work well. ModelLoader is a lot more stable. This is because the ModelMesher is Mojang's code and must be called at a very specific point during startup, whereas the ModelLoader is Forge supplied so that you (as a modder) can't fuck up. 1 Quote 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.
Absithium_gamer Posted October 18, 2017 Author Posted October 18, 2017 private static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().setcustommodelresourcelocation().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } } i replaced them but get the error method.setcustommodelresourcelocation()cant be resolved Quote
Absithium_gamer Posted October 18, 2017 Author Posted October 18, 2017 Cant figure it out can you give the string to see how it was done Quote
Draco18s Posted October 18, 2017 Posted October 18, 2017 ModelLoader is a static class. That means in stead of: Minecraft.getMinecraft().getRenderItem() You put ModelLoader And then because method names are case-sensitive, you need to use: setCustomModelResourceLocation instead of setcustommodelresourcelocation This really isn't that hard. Quote 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.
Absithium_gamer Posted October 18, 2017 Author Posted October 18, 2017 (ModelLoader).setCustomModelResourceLocation(obsidianingot, 0, null).register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); i got this but it says model loader cannot be resolved to a variable and line breakpoint: mod items line 26 register render(items) Quote
Jay Avery Posted October 18, 2017 Posted October 18, 2017 It looks like you might need to study some Java fundamentals, because this is fairly basic syntax that you seem to be having trouble with. The correct line is: ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); Quote
Absithium_gamer Posted October 18, 2017 Author Posted October 18, 2017 thx and yea probably new to java script Quote
Draco18s Posted October 18, 2017 Posted October 18, 2017 12 minutes ago, Absithium_gamer said: thx and yea probably new to java script Java is to Javascript as Car is to Carpet. 2 Quote 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.
ModMCdl Posted October 19, 2017 Posted October 19, 2017 6 hours ago, Draco18s said: Java is to Javascript as Car is to Carpet. You made my day, Draco But seriously, yes. Brush up on at least basic Java first. Minecraft Modding is a wonderful way to learn how to program in Java, but you need to know the fundamentals first, otherwise you will have no idea what anything you're doing actually means. Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted October 20, 2017 Posted October 20, 2017 11 hours ago, diesieben07 said: It most definitely is not. Minecraft Modding is a giant mess of hacks on top of hacks and a minefield of horrible practices and undocumented code. This is not how "real world" development should work (and if it does at your company, run!). It actually is. While it may not suit you in particular, I know several friends who really got down to it and used Minecraft Modding as a way to implement what they were learning in Java. It isn't an independent way to learn, but it allows an outlet to take what you learn and utilize it and build up off of it. Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
Draco18s Posted October 20, 2017 Posted October 20, 2017 4 minutes ago, ModMCdl said: but it allows an outlet to take what you learn and utilize it and build up off of it. That is not "learning Java" that's "taking what you know and utilizing it." Quote 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.
ModMCdl Posted October 21, 2017 Posted October 21, 2017 19 hours ago, Draco18s said: That is not "learning Java" that's "taking what you know and utilizing it." Which is a major step of the learning process. I guess my initial statement was a bit vague. I was trying to emphasize that an underlying understanding of java must be known first. Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
Draco18s Posted October 23, 2017 Posted October 23, 2017 6 hours ago, diesieben07 said: My statement still stands. Taking practices from Minecraft Modding and applying them to "real-world programming" is a bad idea. (I'll point out that Minecraft practices were better than what I was doing before because I was never taught any sort of organizational schema...) Quote 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.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.