Results 1 to 3 of 3
- 08-23-2011, 08:31 PM #1
Member
- Join Date
- Aug 2011
- Posts
- 2
- Rep Power
- 0
Invalid method declaration; return type required? Please Help!
I am currenltly making a modification on a game and i have ran into this error please may u guys tell me what is wrong with my code?
It may be something really obvious but i am new to java so please help :)package net.minecraft.src;
public class ItemPorkScratching extends Item
{
private int healAmount;
public ItemScratching(int i) {
super (i);
maxStackSize = 1;
healAmount = 1.5;
}
public int getHealAmount()
{
return healAmount;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
itemstack.stackSize--;
entityplayer.heal(healAmount);
return itemstack;
}
}Last edited by paccerz; 08-23-2011 at 08:33 PM.
- 08-23-2011, 08:49 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
The constructor name must be identical to the class name, otherwise the compiler thinks it's a method, and the form of a cosntructor is invalid for a method declaration.
- 08-23-2011, 10:43 PM #3
Senior Member
- Join Date
- Nov 2010
- Posts
- 210
- Rep Power
- 3
Similar Threads
-
JavaBean - invalid method declaration and return type required
By jprog in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 05-07-2011, 06:13 PM -
Invalid Method Declaration; Return Type Required
By bremzb in forum AWT / SwingReplies: 3Last Post: 05-05-2011, 10:12 PM -
Err: invalid method declaration; return type required
By Die The Villain in forum New To JavaReplies: 12Last Post: 04-15-2011, 12:44 AM -
invalid method declaration; return type required
By XaviannNJ in forum JCreatorReplies: 7Last Post: 11-25-2010, 01:59 PM -
Error: invalid method declaration; return type required
By silvia in forum AWT / SwingReplies: 3Last Post: 06-05-2010, 08:05 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks