Skip to content

Instantly share code, notes, and snippets.

@eggohito
Last active December 17, 2022 07:08
Show Gist options
  • Save eggohito/8efea4138ea02033d0a976a4b1858e59 to your computer and use it in GitHub Desktop.
Save eggohito/8efea4138ea02033d0a976a4b1858e59 to your computer and use it in GitHub Desktop.

💡 The variables used are reset after, so you'll need to set them again if you wish to make it persist. 💡


Initial setup

To determine which entity initiated the pickpocket, you'll need to add the pickpocket.actor tag to the entity via the /tag command. Afterwards, you can execute the pickpocket:this function using the /function command as the entity you wish to pickpocket from.


Taking a specific amount of items

You can customize how many items can be taken (1 by default) by setting the score of the take score holder in the pickpocket scoreboard objective, like so:

#   This example will make the pickpocket power take 10
scoreboard players set take pickpocket 10

Targeting a slot from a list randomly

You can specify which slots will be potentially targeted (0 to 8 by default) by specifying an array of integers as the value for the slots NBT of the pickpocket:input command NBT storage, like so:

#   This example will make the power affect slots from slot 36 to slot 39
#   36 = feet, 37 = legs, 38 = chest and 39 = head
data modify storage pickpocket:input slots set value [36, 37, 38, 39]

Targeting a specific slot

You can make the pickpocket power only target a specific slot by specifying an integer as the value for the slots NBT of the pickpocket:input command NBT storage, like so:

#   This example will make the power only target the offhand slot of the target entity
data modify storage pickpocket:input slots set value 40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment