UUIDs (Universally Unique IDentifiers) are 128 bit long numbers which are used by Minecraft to distinguish between separate instances.
Representation
- Hyphenated string: A hexadecimal representation of the UUID, with hyphens separating the different sections into individual numbers.
The hyphen are set to split the UUID into numbers of the format8-4-4-4-12
with each number marking the number of hexadecimal digits fitting into the corresponding section. Further detail follows in the Technical aspects section.
An example of this representation would bef81d4fae-7dec-11d0-a765-00a0c91e6bf6
.- Because every part is evaluated as an individual number, empty digits at the start of a section can be ignored.
For example,00000001-0002-0003-0004-000000000005
can be evaluated as the same as1-2-3-4-5
.
- Because every part is evaluated as an individual number, empty digits at the start of a section can be ignored.
- String: The same as the hyphenated string representation, but without the separation of the different sections.
An example for this representation would be00000001000200030004000000000005
, where it is impossible for the majority of empty digits to be removed as opposed to the regular String representation. - Most/Least: A separation of the 64 most significant bits from the 64 least significant bits. Each of the two numbers is stored separately and uses the
Long
data type in the game.
An example of this representation would beUUIDMost:-568210367123287600
paired withUUIDLeast:-6384696206158828554
. - int-array: A separation into four 32 bit numbers. Each part is stored in an integer array ordered from most significant to least significant.
An example of this representation would be[I;-132296786,2112623056,-1486552928,-920753162]
Occurences
The following table represents the situations in which UUIDs are used in places accessible by a player:[upcoming: JE 1.16]
Location (general) | Location (path) | Format | Use |
---|---|---|---|
All entities (NBT) | UUID |
int-array | Own UUID |
Attribute modifiers (NBT) | UUID |
int-array | Own UUID. Used when equipping and unequipping the item to identify which modifier to add or remove from the entity. |
Attribute modifiers (Loot table) | id |
String | Set UUID of modifier in set_attributes function
|
Tameable mobs (NBT) | Owner |
int-array | Owner |
Projectiles (NBT) | Owner |
int-array | Entity that shot the projectile |
Item entities (NBT) | Owner |
int-array | Target player for /give command
|
Item entities (NBT) | Thrower |
int-array | Player who dropped the item |
Shulker bullets (NBT) | Target |
int-array | Entity targeted for attack |
Conduits (NBT) | Target |
int-array | Entity targeted for attack |
Player heads (NBT) | SkullOwner.Id |
int-array | Owner of the skin |
Player heads (NBT) | SkullOwner.Properties.textures[].Value.ProfileId |
String without hyphens | Owner of the skin |
Mobs (NBT) | Leash.UUID |
int-array | Entity that leashed the mob |
Breedable mobs (NBT) | LoveCause |
int-array | Player who fed the mob |
Zombie Villagers (NBT) | ConversionPlayer |
int-array | Player who is converting the Zombie Villager |
Bees and Zombified Piglins (NBT) | HurtBy |
int-array | Entity that hurt the bee or Zombified Piglin |
Villagers (NBT) | Gossips[].Target |
int-array | Player who caused the gossip |
Target selectors (Commands) | - | String | Selected entity |
Instructions: 3
Technical aspects
Value range
A UUID can be expressed as a 128 bit number, which means that it supports all integer values from -(2^127)
to (2^127)-1
. It is important to note that this evaluation does not refer to the range of values generated by the game but instead focuses on the capacity of the format.
String format section names
String format UUIDs follow the pattern aaaaaaaa-bbbb-cccc-ddee-ffffffffffff
.
Section name | Used symbol | Bit range | ||
---|---|---|---|---|
From | To | Size | ||
time-low | a |
96 | 127 | 32 |
time-mid | b |
80 | 95 | 16 |
time-high-and-version | c |
54 | 79 | 16 |
clock-seq-and-reserved | d |
36 | 53 | 8 |
clock-seq-low | e |
48 | 45 | 8 |
node | f |
0 | 47 | 48 |
Generation
Minecraft uses variant 4 UUIDs, which means that the entire number with the exception of the bits used for metadata is randomly generated.
A table with the locations and values of the metadata:
Bitwise version
Collapsed version
Related tools
- Generate a random UUID from scratch: https://www.uuidgenerator.net/version4
- Convert different formats, with the exception of the String without hyphens format: https://www.soltoder.com/mc-uuid-converter/