toothpick007 Posted March 17, 2015 Share Posted March 17, 2015 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"));; } } Quote Link to comment Share on other sites More sharing options...
Draco18s Posted March 17, 2015 Share Posted March 17, 2015 Well, you don't have a main mod file (or haven't shown it) so that code is never being called. 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. Link to comment Share on other sites More sharing options...
toothpick007 Posted March 17, 2015 Author Share Posted March 17, 2015 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); } } Quote Link to comment Share on other sites More sharing options...
Ernio Posted March 17, 2015 Share Posted March 17, 2015 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). Quote 1.7.10 is no longer supported by forge, you are on your own. Link to comment Share on other sites More sharing options...
toothpick007 Posted March 17, 2015 Author Share Posted March 17, 2015 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 ? Quote Link to comment Share on other sites More sharing options...
Draco18s Posted March 17, 2015 Share Posted March 17, 2015 where would I place it thou would I need to make a whole new class ? Uh...yeah... 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. Link to comment Share on other sites More sharing options...
tuskiomi Posted March 17, 2015 Share Posted March 17, 2015 Yes, you need a class to represent the sword. To do this, you'd make a new class that extends Item. Quote Also, I should have you know that you are reading my signature. Link to comment Share on other sites More sharing options...
Ernio Posted March 17, 2015 Share Posted March 17, 2015 OR use ItemSword. Anyone? No? Okay... ;_; p.s: lel. Quote 1.7.10 is no longer supported by forge, you are on your own. Link to comment Share on other sites More sharing options...
SuperKael Posted March 17, 2015 Share Posted March 17, 2015 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) Quote 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. Link to comment Share on other sites More sharing options...
toothpick007 Posted March 18, 2015 Author Share Posted March 18, 2015 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 :-( Quote Link to comment Share on other sites More sharing options...
jcranky Posted March 18, 2015 Share Posted March 18, 2015 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. Quote just you wait! Link to comment Share on other sites More sharing options...
toothpick007 Posted March 18, 2015 Author Share Posted March 18, 2015 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 Quote Link to comment Share on other sites More sharing options...
Draco18s Posted March 18, 2015 Share Posted March 18, 2015 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? 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. Link to comment Share on other sites More sharing options...
toothpick007 Posted March 18, 2015 Author Share Posted March 18, 2015 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. Quote Link to comment Share on other sites More sharing options...
SuperKael Posted March 18, 2015 Share Posted March 18, 2015 Initialize your items in the init() method of your main file . that's the answer to the first two questions. Quote 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. Link to comment Share on other sites More sharing options...
toothpick007 Posted March 18, 2015 Author Share Posted March 18, 2015 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 Quote Link to comment Share on other sites More sharing options...
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.