How to Detect When a Player Is Holding an Item in Minecraft 1.14
NBT Tags for Player in Minecraft (Java Edition 1.16/1.17)
This Minecraft tutorial explains the NBT tags (formerly called data tags) that you can use for a player in Minecraft Java Edition (PC/Mac) 1.16 and 1.17.
Background
Players have a unique set of NBT tags that can be used in Minecraft commands such as: /data and /scoreboard.
What are NBT tags (formerly called Data Tags)?
NBT tags (formerly called data tags) allow you to set certain properties of a player. The NBT tag is always surrounded in {} such as {Dimension:"minecraft:the_nether"}. If there is more than one NBT tag used in a game command, the NBT tags are separated by a comma such as {Dimension:"minecraft:the_nether", foodLevel:20}.
List of NBT Tags
Here is a list of the NBT tags that you can use for a player in Minecraft Java Edition (PC/Mac) 1.16 and 1.17:
NBT Tag | Value (Description) |
---|---|
abilities | data (The abilities that the the player has.)
Example |
AbsorptionAmount | number (The number of absorption health points the player has) Example |
Air | ticks (The number of game ticks the player has air left for) Example |
DataVersion | version (The version of the player's NBT structure. Each version/snapshot of Minecraft has its own unique version number. Minecraft 1.16 rc-1 has a DataVersion value of 2565) Example |
DeathTime | number (The number of game ticks that the player has been dead. When alive, DeathTime has a value of 0) Example |
Dimension | minecraft:the_nether (The player is the Nether) Example |
EnderItems | data (An item in the player's ender chest) Example |
enteredNetherPosition | coordinate (The xyz coordinate value where the player entered the Nether dimension) Example |
FallDistance | number (The distance that the player has fallen) Example |
FallFlying | 0 (The player is not allowed to use elytra when falling) Example |
Fire | ticks (The number of game ticks until the player is no longer on fire - there are 20 ticks in a second. When the player is not on fire, the default is -20) Example |
foodLevel | number (The level in the Hunger bar. A full Hunger bar has a value of 20) Example |
foodExhaustionLevel | number (The level of exhaustion) Example |
foodSaturationLevel | number (The current level of saturation) Example |
foodTickTimer | ticks (The value of the Food timer in game ticks) Example |
Health | number (The number of health points the player has) Example |
HurtTime | ticks (The number of game ticks that the player turns red after being hurt) Example |
Inventory | data (An item in the player's inventory) Example |
Invulnerable | 0 (The player will take damage like normal) Example |
OnGround | 0 (The player is not on the ground) Example |
playerGameType | 0 (The player is in Survival mode) Example |
PortalCooldown | ticks (The number of game ticks until the player can go through a portal again - there are 20 ticks in a second) Example |
Pos | coordinate (The xyz coordinate value where the player is currently positioned) Example |
previousPlayerGameType | 0 (The player was previously in Survival mode) Example |
recipeBook | data (A list of the recipes the player knows how to craft) Example |
SelectedItem | data (The item that is currently selected in the hotbar) Example |
Score | number (The value that will be displayed as the Score when the player dies) Example |
seenCredits | 0 (The player has not yet gone into the final portal that ends the game and seen the credits) Example |
selectedItemSlot | 0 (The player has the slot #1 selected in the hot bar) Example |
ShoulderEntityLeft | data (The entity sitting on the player's left shoulder. Currently, this can only be a parrot) Example |
ShoulderEntityRight | data (The entity sitting on the player's right shoulder. Currently, this can only be a parrot) Example |
SleepingX | number (The X coordinate of where the player is sleeping) Example |
SleepingY | number (The Y coordinate of where the player is sleeping) Example |
SleepingZ | number (The Z coordinate of where the player is sleeping) Example |
SleepTimer | ticks (The number of game ticks that the player has been sleeping in a bed) Example |
SpawnDimension | minecraft:the_nether (The player will spawn in the Nether) Example |
SpawnForced | 0 (The player will not spawn if no bed is found) Example |
SpawnX | number (The X coordinate of the player's bed or spawn point) Example |
SpawnY | number (The Y coordinate of the player's bed or spawn point) Example |
SpawnZ | number (The Z coordinate of the player's bed or spawn point) Example |
XpLevel | number (The level on the experience bar) Example |
XpP | number (The percentage on the experience bar until the next level) Example |
XpSeed | number (The seed that will be used for the next enchantment when using an enchanting table) Example |
XpTotal | number (The total XP earned during the current life. This value is displayed as the Score when player dies) Example |
NBT Tag Examples
To get the NBT tags (or data tags) for the nearest player:
/data get entity @p
Next, learn how to use the game commands in Minecraft.
Other NBT Tags
Here are some of the other NBT tags (formerly called data tags) in Minecraft:
How to Detect When a Player Is Holding an Item in Minecraft 1.14
Source: https://www.digminecraft.com/data_tags/player.php
0 Response to "How to Detect When a Player Is Holding an Item in Minecraft 1.14"
Post a Comment