Posted April 20, 201312 yr I want to create a spear for my mod, Mo Tools, and I was wondering how to create an ItemSpear.class to save myself the time of declaring all the properties individually in my IitemWoodenSpear.class, ItemStoneSpear.class etc.. Can anyone give me a hand? ~ Hydro
April 20, 201312 yr Author I want to create a spear for my mod, Mo Tools, and I was wondering how to create an ItemSpear.class to save myself the time of declaring all the properties individually in my IitemWoodenSpear.class, ItemStoneSpear.class etc.. Can anyone give me a hand? ~ Hydro
April 20, 201312 yr Each item type can get it's own instance you could do something like public class Spear extends Item{ public final int damage; public Spear(int id, int dmg){ damage = dmg } } and then set the values on init Item spearWood = new ItemSpear(woodSpearID, 2); Item spearDiamond = new ItemSpear(diamSpearID, ; I think its my java of the variables.
April 20, 201312 yr Each item type can get it's own instance you could do something like public class Spear extends Item{ public final int damage; public Spear(int id, int dmg){ damage = dmg } } and then set the values on init Item spearWood = new ItemSpear(woodSpearID, 2); Item spearDiamond = new ItemSpear(diamSpearID, ; I think its my java of the variables.
April 20, 201312 yr Author So... public class ItemSpear extends Item{ public final int damage; public ItemSpear(int id, int dmg){ damage = dmg } } is my ItemSpear.class, yes? I'm probably going to sound like a complete idiot here but; How, then, do I add textures to the individual spears?
April 20, 201312 yr Author So... public class ItemSpear extends Item{ public final int damage; public ItemSpear(int id, int dmg){ damage = dmg } } is my ItemSpear.class, yes? I'm probably going to sound like a complete idiot here but; How, then, do I add textures to the individual spears?
April 20, 201312 yr well you will need to set the unlocalized name per item, and you can use that to access the file, if the file is directly related to the unlocalized name, otherwise you could create an if statement or add it to your constructor(not recommended due to side differences) so something like //pseudo code public void registerIcon(IconRegister i){ //if using unlocalized i.registerIcon("yourmod:" + getUnlocalizedName()); //item id switch switch(itemID){ case(woodSpearID): i.registerIcon("yourmod:wooden spear"; break; case(diamondSpearID): i.registerIcon("yourmod:diamond spear"; break; default: break } } I think its my java of the variables.
April 20, 201312 yr well you will need to set the unlocalized name per item, and you can use that to access the file, if the file is directly related to the unlocalized name, otherwise you could create an if statement or add it to your constructor(not recommended due to side differences) so something like //pseudo code public void registerIcon(IconRegister i){ //if using unlocalized i.registerIcon("yourmod:" + getUnlocalizedName()); //item id switch switch(itemID){ case(woodSpearID): i.registerIcon("yourmod:wooden spear"; break; case(diamondSpearID): i.registerIcon("yourmod:diamond spear"; break; default: break } } I think its my java of the variables.
April 20, 201312 yr Author And that would go in my load event? Sorry for all the questions, forge modding isn't my strong point.
April 20, 201312 yr Author And that would go in my load event? Sorry for all the questions, forge modding isn't my strong point.
April 20, 201312 yr Icon registry happens in the ItemSpear.class so it goes there I think its my java of the variables.
April 20, 201312 yr Icon registry happens in the ItemSpear.class so it goes there I think its my java of the variables.
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.