I successfully created a custom Bow for my mod but, neglected to put in (or add) the ".getIsRepairable". When I do this though, how do I specify a regular bow will work?
public boolean getIsRepairable(ItemStack par1, ItemStack par2)
{
//Using Items.bow here as par2 throws an error
}
The parameters for getIsRepairable are the ItemStack to repair and the ItemStack that is being used to repair it. Just return true if that second ItemStack's item is a regular bow or your own bow or whatever.
Rollback Post to RevisionRollBack
Click this banner for a list of illegal mod distributors -- only download from legal sites!
The parameters for getIsRepairable are the ItemStack to repair and the ItemStack that is being used to repair it. Just return true if that second ItemStack's item is a regular bow or your own bow or whatever.
I've tried that and, the error says "Incompatible operand types ItemStack and Item". How do I work around that?
this lets me use a Bow to repair but, I cant figure out the or part. I'd like to use either my bow, or the "Vanilla" Bow
Again, you should compare items, not itemstacks.
Since you're a new programmer, you should know that OR statements check all the conditions and return true if one (or more) succeed.
You're looking for something like this:
Since you're a new programmer, you should know that OR statements check all the conditions and return true if one (or more) succeed.
You're looking for something like this:
Not sure why you need to check the super, though...
You're right Sky, on both accounts.I am new and, I do know that OR statements check all the conditions and return true, or false if not met. I don't need to check the super, code works fine with out it, thank you. I just couldn't remember the "||", which is what I was trying to look for.
Greetings all,
I successfully created a custom Bow for my mod but, neglected to put in (or add) the ".getIsRepairable". When I do this though, how do I specify a regular bow will work?
The parameters for getIsRepairable are the ItemStack to repair and the ItemStack that is being used to repair it. Just return true if that second ItemStack's item is a regular bow or your own bow or whatever.
I've tried that and, the error says "Incompatible operand types ItemStack and Item". How do I work around that?
You have to create an ItemStack containing the Item.
I've created the new ItemStack referencing my bow. Now, how do I implement using my bow, or a regular bow, to repair my custom bow?
you have to test if par2 is equal to your ItemStack and return this value from getIsRepairable.
No, test if par2.getItem() is equal to the repair item. ItemStack equality is unreliable, whereas Item's are always singletons.
First, thank you for helping a new programmer.
Here's what I have so far.....
this lets me use a Bow to repair but, I cant figure out the or part. I'd like to use either my bow, or the "Vanilla" Bow
Again, you should compare items, not itemstacks.
Since you're a new programmer, you should know that OR statements check all the conditions and return true if one (or more) succeed.
You're looking for something like this:
Not sure why you need to check the super, though...
You're right Sky, on both accounts.I am new and, I do know that OR statements check all the conditions and return true, or false if not met. I don't need to check the super, code works fine with out it, thank you. I just couldn't remember the "||", which is what I was trying to look for.