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.
BuiltinEntryTypes.EMPTY
- Empty Entry TypeClientBuiltinEntryTypes.RENDERER
- Entry Type for RendererVanillaEntryTypes.ITEM
- Entry Type for ItemStackVanillaEntryTypes.FLUID
- Entry Type for FluidStack<aside>
💡 Learn about constructing EntryStack
and EntryIngredient
in Entry Stacks
</aside>
Define the Entry Type as a static final constant set as EntryType.deferred(…)
. We will be using this to construct our entries.
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>
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.