Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

What everything imports

Verified against Minecraft 26.3 · Maps · The thirty most-imported Mojang classes: how many files name each one in an import statement.

One file in six imports BlockPos. That is the least surprising fact on this page; the next one is not. The chart counts Mojang imports only — net.minecraft and com.mojang — because the JDK’s List and the nullability annotation outrank everything on it and say nothing about the game. Under that rule the second most-imported type is not Minecraft’s: it is Codec, from Mojang’s DataFixerUpper library, imported by 943 files, with MapCodec sixth and RecordCodecBuilder seventh. Three of the seven classes the game most depends on are the serialisation vocabulary that turns objects into NBT and JSON and back, which is why Part II teaches codecs before anything a player can see.

The 30 most-imported classes of 26.3: how many files import each BlockPos (core): 1,229 importing files BlockPos core 1,229 Codec (com.mojang.serialization): 943 importing files Codec com.mojang.serialization 943 Identifier (resources): 914 importing files Identifier resources 914 BlockState (world.level.block.state): 864 importing files BlockState world.level.block.state 864 Holder (core): 826 importing files Holder core 826 MapCodec (com.mojang.serialization): 806 importing files MapCodec com.mojang.serialization 806 RecordCodecBuilder (com.mojang.serialization.codecs): 797 importing files RecordCodecBuilder com.mojang.serialization.codecs 797 RandomSource (util): 793 importing files RandomSource util 793 Component (network.chat): 777 importing files Component network.chat 777 Level (world.level): 761 importing files Level world.level 761 ServerLevel (server.level): 735 importing files ServerLevel server.level 735 Mth (util): 703 importing files Mth util 703 ItemStack (world.item): 691 importing files ItemStack world.item 691 Entity (world.entity): 668 importing files Entity world.entity 668 Vec3 (world.phys): 585 importing files Vec3 world.phys 585 Direction (core): 584 importing files Direction core 584 StreamCodec (network.codec): 547 importing files StreamCodec network.codec 547 LivingEntity (world.entity): 536 importing files LivingEntity world.entity 536 LogUtils (com.mojang.logging): 488 importing files LogUtils com.mojang.logging 488 Registries (core.registries): 473 importing files Registries core.registries 473 Util (util): 457 importing files Util util 457 Player (world.entity.player): 445 importing files Player world.entity.player 445 ResourceKey (resources): 419 importing files ResourceKey resources 419 Schema (com.mojang.datafixers.schemas): 404 importing files Schema com.mojang.datafixers.schemas 404 ByteBufCodecs (network.codec): 327 importing files ByteBufCodecs network.codec 327 SoundEvents (sounds): 320 importing files SoundEvents sounds 320 BlockBehaviour (world.level.block.state): 313 importing files BlockBehaviour world.level.block.state 313 Blocks (world.level.block): 299 importing files Blocks world.level.block 299 Packet (network.protocol): 290 importing files Packet network.protocol 290 DSL (com.mojang.datafixers): 289 importing files DSL com.mojang.datafixers 289
The thirty most-imported Mojang classes of 26.3, counting only imports from Mojang's own packages. Blue ships in both jars and grey is a library outside the decompile; none of the thirty is client-only. Click to enlarge.

Seven ideas, and where the book teaches them

The hubs are not thirty ideas; twenty-five of them are seven. The table below groups them, reading down the sixty rows rather than the thirty the figure draws, so that a family is not broken in half by the cut-off — ByteBufCodecs and PacketType are the wire’s vocabulary whether or not they clear it. So the table holds thirty-two names: twenty-five of the thirty, plus seven more from ranks 31 to 60 that their families would be incomplete without. The five of the thirty it leaves out are the two paragraphs after it, two and three.

Part II teaches three of the seven, Reference two, Part IX one, and the seventh — the world’s nouns — is the rest of the book. That is the more useful fact than Part II teaches the vocabulary: the classes a reader must know are not one part’s worth.

ideathe hubswhere the book teaches it
a positionBlockPos, Vec3, Direction, MthMath and primitives
a name and a registryIdentifier, ResourceKey, Registries, BuiltInRegistries, HolderIdentifiers and registries
a shape on diskCodec, MapCodec, RecordCodecBuilderCodecs, NBT and JSON, and for MapCodec the data-driven type pattern
a shape on the wireStreamCodec, ByteBufCodecs, RegistryFriendlyByteBuf, Packet, PacketTypePackets and stream codecs
textComponentText components
chanceRandomSourceMath and primitives
the world’s nounsLevel, ServerLevel, BlockState, Block, Blocks, Entity, LivingEntity, Player, EntityType, ItemStack, SoundEvents, SoundEvent, DataComponentsParts II to X

Two of the thirty belong to no family and get no row above, and neither does the first class after them; each is worth a look. Minecraft (284) is thirty-first, the first client-only class on the list and just outside the figure — the client’s hub is a hub for the client-only side alone, which is under a third of the files, and the shared seven tenths never name it. And Schema (404) and DSL (289) are the migration tree talking to itself: all but ten of the files that import Schema are in util/datafix, and the ten are its sibling util/filefix. One pair inside the table earns the same second look: ServerLevel (735) is imported by nearly as many files as Level (761), because most code that touches the world knows it is on the server and says so in its types.

The remaining three of the thirty have no row either. LogUtils (488) is Mojang’s logging library, the one line at the top of a class that keeps a logger. Util (457) is where the executors and the static odds and ends live (threads) — a hub because it is where the unclassifiable went, not because it is an idea. And BlockBehaviour (313) is the world’s nouns seen one class higher — the same one-class-higher shape what extends what draws for the Block tree.

What the count misses

An import is counted once per file, so the chart says how many files name the class, not how often. It also undercounts every class used inside its own package, because that needs no import: the 260 files that import Block are the files outside world/level/block that use it, and the same is true of BlockBehaviour and Minecraft. A class’s true reach is this number plus its package.

The table

Sixty rows, of which the figure draws thirty. side is which jar ships the class, or library for a class outside the decompile.

classpackageimported byside
BlockPosnet.minecraft.core1229shared
Codeccom.mojang.serialization943library
Identifiernet.minecraft.resources914shared
BlockStatenet.minecraft.world.level.block.state864shared
Holdernet.minecraft.core826shared
MapCodeccom.mojang.serialization806library
RecordCodecBuildercom.mojang.serialization.codecs797library
RandomSourcenet.minecraft.util793shared
Componentnet.minecraft.network.chat777shared
Levelnet.minecraft.world.level761shared
ServerLevelnet.minecraft.server.level735shared
Mthnet.minecraft.util703shared
ItemStacknet.minecraft.world.item691shared
Entitynet.minecraft.world.entity668shared
Vec3net.minecraft.world.phys585shared
Directionnet.minecraft.core584shared
StreamCodecnet.minecraft.network.codec547shared
LivingEntitynet.minecraft.world.entity536shared
LogUtilscom.mojang.logging488library
Registriesnet.minecraft.core.registries473shared
Utilnet.minecraft.util457shared
Playernet.minecraft.world.entity.player445shared
ResourceKeynet.minecraft.resources419shared
Schemacom.mojang.datafixers.schemas404library
ByteBufCodecsnet.minecraft.network.codec327shared
SoundEventsnet.minecraft.sounds320shared
BlockBehaviournet.minecraft.world.level.block.state313shared
Blocksnet.minecraft.world.level.block299shared
Packetnet.minecraft.network.protocol290shared
DSLcom.mojang.datafixers289library
Minecraftnet.minecraft.client284client
EntityTypenet.minecraft.world.entity263shared
Blocknet.minecraft.world.level.block260shared
DataComponentsnet.minecraft.core.component258shared
PacketTypenet.minecraft.network.protocol245shared
RegistryFriendlyByteBufnet.minecraft.network239shared
Dynamiccom.mojang.serialization235library
SoundEventnet.minecraft.sounds235shared
ServerPlayernet.minecraft.server.level231shared
BuiltInRegistriesnet.minecraft.core.registries230shared
LevelReadernet.minecraft.world.level228shared
BlockGetternet.minecraft.world.level217shared
Itemsnet.minecraft.world.item215shared
SoundSourcenet.minecraft.sounds213shared
Paircom.mojang.datafixers.util212library
VoxelShapenet.minecraft.world.phys.shapes210shared
EntityTypesnet.minecraft.world.entity205shared
Itemnet.minecraft.world.item204shared
GuiGraphicsExtractornet.minecraft.client.gui200client
Registrynet.minecraft.core199shared
BlockTagsnet.minecraft.tags198shared
LootContextnet.minecraft.world.level.storage.loot196shared
ExtraCodecsnet.minecraft.util192shared
PoseStackcom.mojang.blaze3d.vertex192client
ModelPartnet.minecraft.client.model.geom191client
InteractionResultnet.minecraft.world190shared
CommandSyntaxExceptioncom.mojang.brigadier.exceptions188library
CommandSourceStacknet.minecraft.commands188shared
ValueOutputnet.minecraft.world.level.storage186shared
TypeRewriteRulecom.mojang.datafixers186library

Rules: names, never code · how the system works, not how the code reads · newest version only · every backticked name passes tools/verify_names.py.