tutorial:spawn_egg
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
tutorial:spawn_egg [2022/10/21 17:21] – nexus-dino | tutorial:spawn_egg [2023/01/15 01:31] – [Giving the Spawn Egg a Texture] solidblock | ||
---|---|---|---|
Line 7: | Line 7: | ||
<code java> | <code java> | ||
public class ExampleMod implements ModInitializer { | public class ExampleMod implements ModInitializer { | ||
- | public static final Item IRON_GOLEM_SPAWN_EGG = new SpawnEggItem(EntityType.IRON_GOLEM, | + | public static final Item IRON_GOLEM_SPAWN_EGG = new SpawnEggItem(EntityType.IRON_GOLEM, |
} | } | ||
</ | </ | ||
- | The spawn egg item takes an entity type, a primary and secondary color, and an item settings option.\\ It also uses decimal coloring for the spawn egg colors. Not hexadecimal, | + | :!:This example is used for versions //before// 1.19.3, as Minecraft 1.19.3 directly added iron golem spawn eggs. However, you can create spawn eggs for other entity types. In 1.19.3, remember to remove the '' |
- | You can also [[https:// | + | |
+ | The spawn egg item takes an entity type, a primary and secondary color, and an item settings option. | ||
After you've done that, you will need to register your item: | After you've done that, you will need to register your item: | ||
Line 17: | Line 18: | ||
public class ExampleMod implements ModInitializer { | public class ExampleMod implements ModInitializer { | ||
- | public static final Item IRON_GOLEM_SPAWN_EGG = new SpawnEggItem(EntityType.IRON_GOLEM, | + | public static final Item IRON_GOLEM_SPAWN_EGG = new SpawnEggItem(EntityType.IRON_GOLEM, |
@Override | @Override | ||
public void onInitialize() { | public void onInitialize() { | ||
- | Registry.register(Registry.ITEM, | + | Registry.register(Registry.ITEM, |
+ | // For versions above 1.19.3, replace '' | ||
} | } | ||
} | } | ||
Line 28: | Line 30: | ||
=====Giving the Spawn Egg a Texture===== | =====Giving the Spawn Egg a Texture===== | ||
If you ran the game now, your spawn egg wouldn' | If you ran the game now, your spawn egg wouldn' | ||
- | <file javascript src/ | + | <file javascript src/ |
{ | { | ||
" | " | ||
Line 34: | Line 36: | ||
</ | </ | ||
- | Make sure to also add this to your lang file. | + | Make sure to also add this to your [[lang]] file. |
- | <file javascript src/ | + | <file javascript src/ |
{ | { | ||
- | "item.modid.iron_golem_spawn_egg": | + | "item.tutorial.iron_golem_spawn_egg": |
} | } | ||
</ | </ |
tutorial/spawn_egg.txt · Last modified: 2023/01/15 01:33 by solidblock