NBT Tags for Pig in Minecraft (Java Edition 1.11/1.12)
This Minecraft tutorial explains the NBT tags (formerly called data tags) that you can use for a pig in Minecraft Java Edition (PC/Mac) 1.11 and 1.12.
TIP: If you are not running Minecraft Java Edition (PC/Mac) 1.11/1.12, find NBT tags for pig in another version of Minecraft:
Background
In Minecraft Java Edition 1.11 and 1.12, the entity value for a pig is pig
. The pig
entity has a unique set of data tags that can be used in Minecraft commands such as: /summon, /entitydata, /give, /fill, /setblock, /testfor.
What are NBT tags (formerly called Data Tags)?
NBT tags allow you to set certain properties of an entity (such as pig
). The NBT tag is always surrounded in {} such as {CustomName:Sloppy}. If there is more than one NBT tag used in a game command, the NBT tags are separated by a comma such as {CustomName:Sloppy, Age:-25000}.
List of NBT Tags
Here is a list of the NBT tags that you can use for pig
in Minecraft Java Edition (PC/Mac) 1.11 and 1.12:
NBT Tag | Value (Description) | Works With |
---|---|---|
Saddle | 0 (The pig is not wearing a saddle) Example |
/summon /entitydata |
InLove | ticks (The number of game ticks that the pig is in love mode and will try to breed with another pig) Example |
/summon /entitydata |
Age | ticks (The age of the pig in game ticks. Use 0 or higher for an adult. Use a negative number such as -25000 for a baby.) Example |
/summon /entitydata |
ForcedAge | ticks (When a baby pig matures, the Age data tag will be set to ForcedAged. However, there have been bugs with this data tag so it may not work properly.) Example |
/summon /entitydata |
Leashed | 0b (The pig is not leashed) Example |
/summon /entitydata |
Leash | Used with the Leashed data tag. Indicates the coordinates of the fence that the pig is leashed to. Example |
/summon /entitydata |
CustomName | name (The name to assign to the pig. If the name has spaces, you need to surrounded the name value in "".) Example |
/summon /entitydata |
Health | number (The number of health points the pig has) Example |
/summon /entitydata |
AbsorptionAmount | number (The number of absorption health points the pig has) Example |
/summon /entitydata |
Invulnerable | 0 (The pig will take damage like normal) Example |
/summon /entitydata |
PersistenceRequired | 0 (The pig will despawn naturally) Example |
/summon /entitydata |
NoAI | 0 (The pig will have artificial intelligence and will move/behave like normal) Example |
/summon /entitydata |
Silent | 0 (The pig will make its usual noises in the game) Example |
/summon /entitydata |
Fire | ticks (The number of game ticks until the pig is no longer on fire - there are 20 ticks in a second) Example |
/summon /entitydata |
PortalCooldown | ticks (The number of game ticks until the pig can go through a portal again - there are 20 ticks in a second) Example |
/summon /entitydata |
Air | ticks (The number of game ticks the pig has air left for) Example |
/summon /entitydata |
ArmorItems | Since a pig does not wear armor, you can use this data tag to list 4 items that you want the pig to drop when it is killed (4 custom drops) Syntax Example |
/summon /entitydata |
ArmorDropChances | The drop chances for each of the 4 items listed in ArmorItems. A value of 1.0f means 100% chance of the item being dropped when the pig is killed, 0.5f means 50%, 0.2f means 20%, and so on. Example |
/summon /entitydata |
UUIDLeast | A number that specifies the right half of the UUID for the pig (use UUIDLeast and UUIDMost to target/find a particular pig in the game) Example |
/summon /entitydata |
UUIDMost | A number that specifies the left half of the UUID for the pig (use UUIDLeast and UUIDMost to target/find a particular pig in the game) Example |
/summon /entitydata |
id | pig (The entity value used to represent a pig in the EntityTag or Passengers tag) Example |
/summon /give |
Passengers | The mob that is riding on the pig. Use the entity value for the passenger mob Example of skeleton as passenger |
/summon /entitydata |
NBT Tag Examples
To summon a pig that is named Sloppy:
/summon pig ~ ~ ~ {CustomName:Sloppy}
To summon a baby pig that is named Cutie:
/summon pig ~ ~ ~ {CustomName:Cutie, Age:-25000}
To summon a pig that has 4 custom drops (3 redstone, 1 gold horse armor, 2 iron ingot and 7 gold ingot):
/summon pig ~ ~1 ~ {ArmorItems:[{Count:3,id:redstone}, {Count:1,id:golden_horse_armor}, {Count:2,id:iron_ingot}, {Count:7,id:gold_ingot}], ArmorDropChances:[1.0f,1.0f,1.0f,1.0f]}
To give the closest player a pig spawn egg in Minecraft Java Edition (PC/Mac) 1.11 and 1.12:
/give @p spawn_egg 1 0 {EntityTag:{id:minecraft:pig}}
Target Selectors
Before we finish discussing data tags, let's quickly explore how to use the @e target selector. The @e target selector allows you to target entities in your commands. If you use the type=pig
value, you can target pigs:
@e[type=pig]
You can also add a radius value to target pigs within a certain radius of blocks (for example, r=5
lets you target pigs within a 5 block radius of where the command is run):
@e[type=pig,r=5]
Target Selector Examples
To change all pigs to baby pigs within a 5 block radius:
/entitydata @e[type=pig,r=5] {Age:-25000}
To test for all pigs within a 50 block radius:
/testfor @e[type=pig,r=50]
To summon a lightning bolt at all pigs turning them into zombie pigman:
/execute @e[type=pig] ~ ~ ~ /summon lightning_bolt
To kill all pigs:
/kill @e[type=pig]
Next, learn how to use the game commands in Minecraft.
Command Examples
Here are some game command examples for a pig in Minecraft:
Command Generators
If you need help, you can use these tools to automatically generate commands for you:
Advertisements