DisableDrop tag for items
I thought of an item tag that would be useful to map makers, for custom items. It would be a boolean value, like this: DisableDrop:1
When set as shown above, if the item is in a player's inventory or a container, they can't drop the item. (Only affects manual dropping; the item drops as normal on death.)
This is useful for situations where the map-maker wants the player to have a custom item at all times, and doesn't want it to be accidentally dropped.
Players freely dropping items proves to be a problem in a couple of projects I've been working on. I'll use one of them as an example.
The player has to wear a mob head that modifies attributes, such as max health and movement speed. To prevent them from removing their mod head to gain health and move faster, I came up with a system to give players a consequence for removing their mob head, in the form of giving them slowness and blindness. However, if the player drops their mob head, they won't be able to move in order to pick it back up.
Another problem is that players can trade items or drop them accidentally. I wouldn't want to kill all dropped items because that would leave the players without the items they need for the rest of the round. An automatic resupply wouldn't work, because merely removing the item from a slot counts as the item not being in a player's inventory. The "hovering" item (held by the cursor) can't be detected by commands. A manual resupply wouldn't work either, because there isn't any good way to make sure all players know about it.
So you can see how this causes all sorts of problems that are difficult or impractical to work around. Simply disabling the ability to drop the item fixes everything.
Posted Jan 16, 2016, 12:46 AM UTC · edited
l believe that if you rapidly /entitydata items to have an extremely high pickup delay, they will be unable to drop items.
Looks like you didn't read it, at the very start he explains: a tag for items, so you cannot drop it out of your inventory
I did read it. This is just a solution if you want no items to be droppable with Q. This could come in handy if you wanted only some items to be droppable,which is why I still upvoted it.
this does the exact opposite, setting to 0 will make it pick up-able, higher then 0 and it won't be able to be picked up
I seem to remember something like that, now that you mention it. It set the item's
PickupDelaytag to 0, so players would pick up the item as soon as they dropped it.The only foreseeable problem with that is if two players are in the exact same spot and one of them drops an item, the other player might pick it up. I'm not sure if that happens or not.
But it's a suitable solution in case
DisableDropisn't added. It's possible to make it apply only to certain items, too.