Open Eufranio opened 6 years ago
With an ItemStack you cannot change the type. So probably a setter is better here.
So, if we want to simply decrease the stack size for example, we'd do event.setItemStack(event.getItemStack().setStackSize(event.getItemStack().getStackSize() - 1))
?
hum?
When we are listening to InteractItemEvents, we're probably expecting to do something with the ItemStack in use. In the current API, the event only provides a ItemStackSnapshot, so we cannot modify the ItemStack. An workaround would be getting the item in the hand of the player, but there's another problem where the interact may still have an ItemStack, but wasn't directly caused by a player.
I vote for add a new getter for the real ItemStack in the event, or change the return of the current
getItemStack
to the real ItemStack. Other than that, I don't really see the point of getting only a copy of the stack.