Skip to content

minecraft-decompiled covers only net.minecraft.network, which is where none of the item codecs are #964

Description

@andrewgazelka

nix build .#minecraft-decompiled decompiles only net/minecraft/network. That is deliberate and documented in nix/minecraft-data.nix:

# Only the networking tree is decompiled. Decompiling all 7445 classes
# costs minutes and adds nothing the extractor reads.

It is true for the extractor, but not for anyone hand-writing a codec. Implementing ItemStack and the data component system needed the StreamCodec for all 111 component types, and none of them live under network/. The classes actually required were:

  • net/minecraft/core/component/** (DataComponents, DataComponentPatch, DataComponentType, TypedDataComponent, the predicates)
  • net/minecraft/world/item/** (ItemStack, ItemStackTemplate, component/**, enchantment/**, equipment/**, alchemy/**, consume_effects/**)
  • net/minecraft/world/food, world/effect, world/entity/ai/attributes, world/entity/animal/**, world/level/block/entity/**, world/level/saveddata/maps, advancements/predicates/**, core/{BlockPos,UUIDUtil,Holder,GlobalPos,ClientAsset}, resources/ResourceKey, sounds/**, util/Unit, server/network/Filterable, world/entity/{EquipmentSlot,EquipmentSlotGroup,EntityType,player/PlayerSkin}

That is 522 classes, about 3.5 seconds of cfr on top of the existing run. Doing it by hand outside the flake cost maybe twenty minutes of finding class files one error at a time, and the result is not reproducible for the next person.

Two smaller things found on the way, both worth a comment in the same file:

  1. Bootstrap.bootStrap() is not enough to get an ItemStack. Item default components come from the datapack layer in 26.x, so constructing one throws NullPointerException: Components not bound yet. Applying BuiltInRegistries.DATA_COMPONENT_INITIALIZERS.build(access) then gets IllegalStateException: Missing tag minecraft:is_fire, because the initializers reference tags from the built-in pack. Anything wanting real item bytes out of the jar has to load that pack first.
  2. Entity and block-entity type constants moved: EntityType.PIG is now EntityTypes.PIG, BlockEntityType.CHEST is now BlockEntityTypes.CHEST.

Suggested fix

Widen decompiledSources to take a list of package prefixes, defaulting to the current net/minecraft/network plus the item and component trees. Or split a second minecraft-decompiled-all output for people writing codecs by hand, since the cost is bounded and paid once per version bump.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions