Create Mod Documentation

repository·mc1.21.1/dev·Indexed 26 days ago

https://github.com/creators-of-create/create

A Minecraft mod focused on aesthetic automation and physical contraptions using animated components. This documentation covers technical details including packet limits for contraptions (NBT and byte limits), Basin recipe lookup optimizations using sparse trie maps, client and server-side commands (/create, /angle, /camera), and contribution guidelines via Crowdin.

Tokens
4.5K
Snippets
2
Records
47
Agent score
88%

What's inside Create

  1. Overview of Create mod

    mc1.21.1/dev

    Create is a Minecraft mod that provides tools and blocks for building, decoration, and aesthetic automation. Unlike many tech mods that rely heavily on user interfaces (UIs), Create focuses on physical contraptions made of animated components that work together in various arrangements.

    To learn how specific mechanics and gadgets work, use the in-game visual documentation system called Ponder.

  2. Understand data limits for contraptions

    mc1.21.1/dev

    To prevent clients from being 'chunkbanned' due to oversized contraptions, be aware of four distinct packet limits. Note that the NBT limit is measured in NBT size units, while the others are measured in bytes. Because of this, the NBT limit is typically the first threshold encountered.

    Packet Limits:

    • NBT limit: 2_097_152 (measured in NBT size units, enforced by FriendlyByteBuf.readNbt())
    • Clientbound custom payload limit: 1_048_576 bytes (applies to ClientboundCustomPayloadPacket)
    • Serverbound custom payload limit: 32767 bytes (applies to ServerboundCustomPayloadPacket)
    • Packet limit: 8_388_608 bytes (applies to all packets)
  3. Understand the Basin Recipe Lookup optimization

    mc1.21.1/dev
    The Basin recipe lookup system uses a sparse trie map to optimize finding recipes in a Basin. Instead of checking every recipe against a Basin's contents, the system pre-constructs a trie map from sorted AbstractVariant IDs to a list of Recipe<?>s. This allows for efficient subset matching using a SuperBasin representation.
  4. Manage data limits during Sync

    mc1.21.1/dev
    When syncing contraption data, the primary constraint is the clientbound custom payload limit (1_048_576 bytes). While the NBT limit is technically relevant, client-side deserialization typically bypasses it. Syncing is generally less prone to hitting limits than Pickup because significant portions of data can be skipped during the sync process.
  5. Manage data limits during Pickup

    mc1.21.1/dev

    When handling contraption pickup, the NBT limit is the most critical constraint and is usually the first to be hit. If other mods increase the NBT limit, the packet limit (8_388_608 bytes) may become the next relevant bottleneck.

    Note: The custom payload limit is not relevant for item sync during pickup, as item sync utilizes the vanilla ClientboundContainerSetSlotPacket.

  6. Implement Basin recipe lookups using the Trie solution

    mc1.21.1/dev

    To perform an optimized recipe lookup, follow these steps:

    1. Convert the Basin to a SuperBasin: A Basin (a set of AbstractVariants) is converted into a SuperBasin (a set of AbstractIngredients). A SuperBasin contains all AbstractIngredients that can be satisfied by at least one AbstractVariant in the Basin. Caching this conversion can improve performance.
    2. Traverse the Trie: Use the SuperBasin to traverse the pre-constructed sparse trie map.
    3. Retrieve Recipes: The traversal identifies all satisfiable AbstractRecipes whose ingredient sets are subsets of the SuperBasin.
    4. Final Conversion: Convert the resulting AbstractRecipes into concrete Recipe<?> objects.
  7. Contribute translations via Crowdin

    mc1.21.1/dev

    Localization for Create is managed through Crowdin. To contribute translations, create a Crowdin account and join the project using the official invite link. Avoid submitting translation changes via Pull Requests (PRs) or modified .json files directly to the repository; use the Crowdin platform instead.

    https://translate.createmod.net/project/createmod/invite?h=64e492afe2ffbc180e3419654374135f1536385
  8. Differentiate between NBT Size and Bytes

    mc1.21.1/dev

    When managing contraption data, distinguish between NBT Size and Bytes:

    • NBT Size: Used by the NBT limit. It is measured using an NbtAccounter. It is not exactly bits, but it is a similar unit.
    • Bytes: Used by the custom payload and packet limits. The byte size can be determined by writing a tag to a buffer and checking its writerIndex.
  9. Reference: Basin and Recipe terminology

    mc1.21.1/dev

    The following terms define the data structures used in the recipe lookup optimization:

    • Recipe<?>: A Minecraft recipe.
    • AbstractVariant: A representation of a "thing" (e.g., an item or a fluid).
    • AbstractIngredient: A set of AbstractVariants (satisfied by any AbstractVariant it contains - OR semantics).
    • AbstractRecipe: A set of AbstractIngredients, mapping one-to-many to Recipe<?> (satisfied by a set containing all its AbstractIngredients - AND semantics).
    • Basin: A set of AbstractVariants.
    • SuperBasin: A set of AbstractIngredients constructed from a Basin by defining it as the set of all AbstractIngredients that can be satisfied by at least one AbstractVariant in the Basin.