Skip to content

How can I register a spawn egg for an entity type? #1591

Discussion options

You must be logged in to vote

Note

This example has been created with Minecraft 1.20.1 in mind. Please reply if you are using a later version and the example seems outdated.

Constructing SpawnEggItem

The first step to registering a spawn egg item is to construct an item instance. Spawn eggs in particular use the SpawnEggItem class.

The constructor takes four parameters:

  • type: The entity type to spawn
  • primaryColor: The primary color for the item model
  • secondaryColor: The secondary color for the item model
  • settings: The general item settings

Altogether, constructing a SpawnEggItem should look like this:

public static final Item CUSTOM_ENTITY_SPAWN_EGG = new SpawnEggItem(ModEntityTypes.CUSTOM_ENTITY, 0xFF0000, 0x00FF00

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by haykam821
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant