Dropitem
Description
Drops a set of items or optionally a DropTable.
Attributes
| Attribute | Aliases | Description | Default |
|---|---|---|---|
| items | item, i | Items to drop. Can be a comma-separated list of items, or a DropTable. You can specify an amount by putting a space and a number after the item name. | NONE |
| naturally | natural, n | Whether the items should be dropped naturally | true |
| onDropSkill | onDrop, then | Metaskill to be execute when the item drops. Inherits the dropped item entity as the target(s) | |
| dynamic | fd | Forces the drop to be parsed as a dynamic item each time | false |
| owner | UUID of the player who owns the dropped items. Only that player can pick them up, see Item Owner |
Item Owner
The owner attribute sets the vanilla owner of every item entity the mechanic drops. Only the player with that UUID can pick the item up, for as long as the item has an owner. The owner does not expire on its own. Use RemoveOwner to clear it (see the examples below). Mobs and hoppers ignore the owner and can still pick the item up. Placeholders in the value are parsed for each target, so owner=<target.uuid> gives every target a drop of their own. If the value is not a valid UUID, the mechanic logs an error and drops nothing.
To read or change the owner after the drop, make the dropped item cast a metaskill with SudoSkill, for example from onDropSkill:
- SetOwner and RemoveOwner change the owner of the casting item
- @Owner and @OwnerLocation target the owner of the casting item
- the Owner condition and the
<owner.*>placeholders use the owner of the casting item - HasOwner and OwnerIsOnline check a dropped item when it is the target
Examples
Example of dropping specific items.
Skills:
- dropitem{i=diamond_sword,diamond} @self ~onDeath
- ...
The below example will drop a Diamond Sword and 5 Diamonds
Skills:
- dropitem{i=diamond_sword,diamond 5} @self ~onDeath
- ...
Example of dropping items from a DropTable.
Skills:
- dropitem{i=SkeletonKingDrops} @self ~onSpawn
- ...
Example of a drop that only the nearest player can pick up.
DropForNearest:
Skills:
- dropitem{i=DIAMOND;owner=<target.uuid>} @PIR{r=5;limit=1;sort=nearest}
The diamond drops at the nearest player within 5 blocks of the caster, and only that player can pick it up
Example of a drop that belongs to the nearest player for 5 seconds.
RewardNearest:
Skills:
- dropitem{i=DIAMOND;owner=<target.uuid>;onDrop=ClearRewardOwner} @PIR{r=5;limit=1;sort=nearest}
ClearRewardOwner:
Skills:
- sudoskill{s=ClearRewardOwnerItem}
ClearRewardOwnerItem:
Skills:
- delay 100
- removeowner
After 100 ticks the diamond loses its owner, and any player can pick it up
Aliases
- drop
- dropitems
- itemdrop