Jump to content

odd inventory bug in my mod


Tristan Perotti

Recommended Posts

I've got an item class that consumes items from the inventory, like the bow consumes arrows.  I had no trouble identifying which itemstack is to be considered usable in this way, and I've pretty much copied the implementation from bow and sling.  I have the proper MarkDirty() call and a BroadcastHotbarSlot() call for good measure.  When I use the item, in OnHeldInteractStop, based on secondsUsed, that many consumables are taken out of their slot via TakeOut(int itemsConsumed).  This works fine and the new number is rendered in the inventory slot.  But if I click on the consumable item to pick it up or move it to a new slot, or right click it to put it into the hotbar, it reverts back to the original number of items in the stack.  What am I doing wrong?  What am I not understanding about the inventory?  Like I said, I pretty much copied the implementation right from BowItem.  The only thing I'm not doing is the renderVariant bit because I don't want the number to change until after the interact has stopped.  I'm guessing that piece takes the arrow out of inventory when drawing the bow and puts it back if you cancel, but that doesn't matter for what I'm trying to do.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.