Entry Types are deferred references to registered Entry Definitions.

There should only be one entry type instance for each entry type, entry type instances are compared by its reference.

Default Entry Types

<aside> 💡 Learn about constructing EntryStack and EntryIngredient in Entry Stacks

</aside>

Custom Entry Types

Defining the Entry Type

Define the Entry Type as a static final constant set as EntryType.deferred(…). We will be using this to construct our entries.

Creating our Entry Definition

Create a new class and implement EntryDefinition<T>, with T being the type of entry for this type.

Override getType(), and return the static entry type created above.

Override the required methods, there should be JavaDocs to guide you for what each method means.

Optionally, support the EntrySerializer standard by getSerializer() to allow serializing the entry stack into nbt tags for networking and persistent display histories.

<aside> 💡 Read about how to implement the equality of different values with Equality of Entry Stacks.

</aside>

Registering the Entry Definition for the type

In a server plugin (Constructing Plugins), override registerEntryTypes.

Given the EntryTypeRegistry, we will then register the definition, for example, this is the code in REI for registering items and fluids.