Hello, I was trying to make player not pickup anything on pickup event, effectively erasing picked up item, but I was not able to do that. I tried event.getItem().setItemStack(), but it always throws NPE when I modify item in any way, and player connected to the event with Internal server error message. Is this even possible ?
so you want him to be able to remove it from the ground but instead of going into his inventory, it vanishes?
I will try that, but it needs to meet few conditions. I will post again if something goes wrong. I have run into a problem. How to change entity involved in the event ? This does not work: Code: int rem = event.getRemaining(); if(rem > 0) { ItemStack newit = item.clone(); newit.setAmount(rem); event.getItem().setItemStack(newit); } else { event.getItem().remove(); } event.setCancelled(true); What I am trying to do here is partially remove items from dropped item but changing amount does not work. How can it be changed ? edit: item is item from getItemStack(), so it represents item on the ground (it really does) I found solution I am fine with. Whenever only part of the stack is picked up, it removes it completely and spawns new item_drop with remaining amount at the same location. Item also jumps a little, which looks like ripping part of it away. EDIT by Moderator: merged posts, please use the edit button instead of double posting.