Restocking upgrade triggering on item pickup is completely wrong
DoomRater opened this issue ยท 9 comments
I understand the concern is lag issues, but there is at least one condition where this is absolutely the wrong behavior- when the item is being placed in world or consumed with no items returning to inventory. This happens a LOT- mass placing items, consuming Concentrated Essence Berries, just to name a few.
Is there an event for the player's inventory being updated? This event, if it catches every time a player's inventory has changed, would cover the situations we need. Sadly I don't know enough about what events are available in Minecraft and Forge to be able to tell.
Yes, I agree. This issue was already high on my list of priorities for the next version(s).
If I'm reading this page correct, the PlayerUseItemEvent is what we really want to be checking for restocking. Or at least, in addition.
I added that event so it now works when you eat food or drink a potion or something similar. But it still doesn't work when you, say, place a block, so more needs to be done. It is just a temporary addition and does not yet show the full functionality it should/will have.
I need to write a tick handler to catch all the events I want, but that will take some time and I am extremely busy at the current moment; this will have to do for now.
I am going to leave this issue open until I actually implement a more elegant and long-term solution.
http://imgur.com/a/nfmIk
I had 115 torches in the backpack to start out. You notice in the top image, I have a full stack of torches in my inventory. I place down 6 torches and then break them to pick them up. They go back into my inventory and get duplicated. As you can see I still have the original 115 torches in the backpack plus a couple additional duplicated stacks. I am using the basic backpack with the restock upgrade.
@blockbreaker1361: I made a new issue (#37), as the malfunctioning you noticed is different than the enhancement that this issue (#23) is concerned with.
I've just gotten around to manually updating Modsauce 2 modpack since I'm going to be playing with select friends, and I've noticed that the tic handler to catch events was never written. Seeing as this is the only event I saw the backpacks really needed a tic handler, might I suggest possibly taking a look at how Botania's Black Hole Talisman's handler is written and potentially importing that?
On my list of things to do for 1.10 already (and should be done relatively soon, after some bugfixing). Cleaning up the issue tracker, so I'm closing this.
Once Forge updates this PR, I can update my own code and call this issue officially fixed.
Opening again so I don't forget it.