Jump to content

tehstone

Members
  • Posts

    4
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

tehstone's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Yeah... I just realized that I could do that. I thought for some reason that it wouldn't work. Thanks for the help =)
  2. Yes, I copied most of the methods from ItemFood including the onEating and onRightClick. It seems that the problem is in this line: par3EntityPlayer.getFoodStats().addStats(this); As far as I can tell, this is the line that actually changes the hunger bar. The problem is, addStats requires a parameter of type ItemFood but since I'm passing it 'this' it's receiving an item of the type I've created. Is it acceptable to make changes in classes from Minecraft? I'd rather not make a copy of EntityPlayer just to overload addStats to accept my food class...
  3. Hmm, it seems I was confused after looking at both of these things. ItemFood has: public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 32; } and no setMaxItemUseDuration, that was the primary reason I wanted to make a new class. Item.java has protected int maxStackSize = 64; which confused me at first, but it does have the setter you mentioned so I can work with that.
  4. I want to be able to change the max stack size of some custom food items I'm creating to be higher than 64 and change the item use duration. My first thought was to simply extend the class, but the max stack size is hard coded into Item.java and the item use duration is hard coded into ItemFood.java. I decided I could do without changing the stack size, so I extended Item and copied most of the methods from ItemFood into my new class, and added constructors, plus methods to handle the use duration. When I tested this, the character was able to eat food but the food did not replenish the hunger bar at all. The food item (bacon) I created was previously of type ItemFood and it replenished 2 hunger bars. The eating animation still occurs, so what am I missing?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.