Posted March 17, 201510 yr Hi everyone just wondering if anyone could point me in the right direction im tring to create a sword now ive done the texturing the naming and everything else however i want to apply custom attributes and im unsure where to put it in. Ive create public static ToolMaterial test = EnumHelper.addToolMaterial("The Killer", 0, 1, 12.0F, 4.0F, 22); However im unsure where to put it in all this ... package com.colc.tutorial.init; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.LanguageRegistry; import com.colc.tutorial.reference; public class tutorialsword { public static Item test_sword; public static ToolMaterial test = EnumHelper.addToolMaterial("The Killer", 0, 1, 12.0F, 4.0F, 22); public static void init(){ test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat); } public static void register(){ GameRegistry.registerItem(test_sword, test_sword.getUnlocalizedName().substring(5));//tile.test_item LanguageRegistry.addName(test_sword, "Jedi Sword"); } public static void registerrenders() { registerrender(test_sword); } public static void registerrender(Item item){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5),"inventory"));; } }
March 17, 201510 yr Well, you don't have a main mod file (or haven't shown it) so that code is never being called. 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.
March 17, 201510 yr Author Sorry here is my main file package com.colc.tutorial; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; 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 net.minecraftforge.fml.common.registry.GameRegistry; import com.colc.tutorial.init.tutorialblocks; import com.colc.tutorial.init.tutorialitems; import com.colc.tutorial.init.tutorialsword; import com.colc.tutorial.proxy.CommonProxy; @Mod(modid = reference.MOD_ID, name = reference.MOD_Name,version = reference.VERSION ) public class tutorialmod { @SidedProxy(clientSide = reference.CLIENT_PROXY_CLASS,serverSide = reference.SERVER_PROXY_CLASS) public static CommonProxy proxy ; @EventHandler public void init(FMLInitializationEvent event) { //******* Recipes Section Call Function************** CraftingRecipies(); //////*******END Recipes Section****************///// //******* Smelting Section Call Function************* Smelting(); //////*******END Smelting Section****************///// proxy.registerrenders(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } @EventHandler public void preInit(FMLPreInitializationEvent event) { tutorialitems.init(); tutorialitems.register(); tutorialblocks.init(); tutorialblocks.register(); tutorialsword.init(); tutorialsword.register(); } /////// this is where all your recipes will go//////// public void CraftingRecipies(){ GameRegistry.addRecipe(new ItemStack(Blocks.obsidian,64),new Object[]{ "ddd", "sss", "ddd", Character.valueOf('d'),Blocks.dirt, Character.valueOf('s'),Items.apple}); GameRegistry.addShapelessRecipe(new ItemStack(Items.diamond,64 ),new ItemStack(Blocks.dirt)); } /////// this is where all your Smelting recipes will go//////// public void Smelting(){ GameRegistry.addSmelting(Blocks.cobblestone, new ItemStack(Items.iron_ingot), 200); GameRegistry.addSmelting(tutorialblocks.test_block,new ItemStack(tutorialitems.test_item), 200); } }
March 17, 201510 yr If you want your Item to be Sword you need to use ItemSword (or ItemTool) which has ToolMaterial field in it. Item.class is used mostly for very basic items or as a base for extending classes (like food). 1.7.10 is no longer supported by forge, you are on your own.
March 17, 201510 yr Author If you want your Item to be Sword you need to use ItemSword (or ItemTool) which has ToolMaterial field in it. Item.class is used mostly for very basic items or as a base for extending classes (like food). where would I place it thou would I need to make a whole new class ?
March 17, 201510 yr where would I place it thou would I need to make a whole new class ? Uh...yeah... 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.
March 17, 201510 yr Yes, you need a class to represent the sword. To do this, you'd make a new class that extends Item. Also, I should have you know that you are reading my signature.
March 17, 201510 yr OR use ItemSword. Anyone? No? Okay... ;_; p.s: lel. 1.7.10 is no longer supported by forge, you are on your own.
March 17, 201510 yr basicaly, change: public class tutorialsword { to: public class tutorialsword extends ItemSword { and add: public tutorialsword(){ super(test); } to the tutorialsword class. (Sorry if I am wrong about something, I havn't actually tried coding in 1.8 before) If I ever say something stupid, or simply incorrect, please excuse me. I don't know anything about 1.8 modding, and I don't know much about entities either, But I try to help when I can.
March 18, 201510 yr Author basicaly, change: public class tutorialsword { to: public class tutorialsword extends ItemSword { and add: public tutorialsword(){ super(test); } to the tutorialsword class. (Sorry if I am wrong about something, I havn't actually tried coding in 1.8 before) okay so I treid all of that now this is my class for the sword package com.colc.tutorial.init; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemSword; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.LanguageRegistry; import com.colc.tutorial.reference; public class tutorialsword extends ItemSword { public static Item test_sword; public static ToolMaterial test = EnumHelper.addToolMaterial("The Killer", 0, 1, 12.0F, 4.0F, 22); public tutorialsword(){ super(test); } public static void init(){ test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat); } public static void register(){ GameRegistry.registerItem(test_sword, test_sword.getUnlocalizedName().substring(5));//tile.test_item LanguageRegistry.addName(test_sword, "COLC Sword"); } public static void registerrenders() { registerrender(test_sword); } public static void registerrender(Item item){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5),"inventory"));; } } However it is still not working :-( I hate this change to 1.8 :-(
March 18, 201510 yr However it is still not working :-( I hate this change to 1.8 :-( Your problem is modding concepts in general. I don't think too much from this thread is really 1.8 specific. If you are following a tutorial, follow are steps really carefully. just you wait!
March 18, 201510 yr Author However it is still not working :-( I hate this change to 1.8 :-( Your problem is modding concepts in general. I don't think too much from this thread is really 1.8 specific. If you are following a tutorial, follow are steps really carefully. There are no tutorials on this that's why I am struggling and if you could point out the errors of my way that would be great
March 18, 201510 yr Basically: Why the hell did you smash main-mod-file things into your sword class? What the fuck is this line? test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat); Where's your @Mod annotation? 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.
March 18, 201510 yr Author Basically: Why the hell did you smash main-mod-file things into your sword class? What the fuck is this line? test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat); Where's your @Mod annotation? Thank you for your reply and to answer you questions 1. Why the hell did you smash main-mod-file things into your sword class? A : I have no idea what you are referring to... 2: What the fuck is this line? test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat); A: Well that because I initialize all my objects in their own class unless there is a better way to do it that I havnt found. 3:Where's your @Mod annotation? That's in my main Class Hope this helps and thank you for helping.
March 18, 201510 yr Initialize your items in the init() method of your main file . that's the answer to the first two questions. If I ever say something stupid, or simply incorrect, please excuse me. I don't know anything about 1.8 modding, and I don't know much about entities either, But I try to help when I can.
March 18, 201510 yr Author Initialize your items in the init() method of your main file . that's the answer to the first two questions. Thank you this is all I needed thank you very much
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.