From 53b45e8d3f9535a16e25ce41ac0863ced873a1e4 Mon Sep 17 00:00:00 2001 From: Darthsae Date: Sat, 29 Jun 2024 19:48:10 -0400 Subject: [PATCH] Spawn Eggs --- .../java/com/sockmit2007/omniaetnihil/OmniaEtNihil.java | 6 ++++++ src/main/resources/assets/omniaetnihil/lang/en_us.json | 2 ++ .../omniaetnihil/models/item/example_entity_spawn_egg.json | 6 ++++++ 3 files changed, 14 insertions(+) create mode 100644 src/main/resources/assets/omniaetnihil/models/item/example_entity_spawn_egg.json diff --git a/src/main/java/com/sockmit2007/omniaetnihil/OmniaEtNihil.java b/src/main/java/com/sockmit2007/omniaetnihil/OmniaEtNihil.java index 6c2030b..84434eb 100644 --- a/src/main/java/com/sockmit2007/omniaetnihil/OmniaEtNihil.java +++ b/src/main/java/com/sockmit2007/omniaetnihil/OmniaEtNihil.java @@ -20,6 +20,7 @@ import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; +import net.minecraft.world.item.SpawnEggItem; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.MapColor; @@ -35,6 +36,7 @@ import net.neoforged.neoforge.attachment.AttachmentType; import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; import net.neoforged.neoforge.client.event.EntityRenderersEvent; +import net.neoforged.neoforge.common.DeferredSpawnEggItem; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent; @@ -75,6 +77,9 @@ public class OmniaEtNihil { () -> EntityType.Builder.of(ExampleEntity::new, MobCategory.MONSTER).sized(0.9F, 0.9F) .clientTrackingRange(10).build("example_entity")); + public static final DeferredItem EXAMPLE_ENTITY_SPAWN_EGG = ITEMS.register("example_entity_spawn_egg", + () -> new DeferredSpawnEggItem(EXAMPLE_ENTITY, 0xDFDFDF, 0x99CFE8, new Item.Properties())); + public static final DeferredItem EXAMPLE_ITEM = ITEMS.registerSimpleItem("example_item", new Item.Properties().food(new FoodProperties.Builder() .alwaysEdible().nutrition(1).saturationModifier(2f).build())); @@ -99,6 +104,7 @@ public class OmniaEtNihil { output.accept(EXAMPLE_BLOCK_ITEM.get()); output.accept(GRABBER_JAR.get()); output.accept(HURT_BLOCK_ITEM.get()); + output.accept(EXAMPLE_ENTITY_SPAWN_EGG.get()); }).build()); public OmniaEtNihil(IEventBus modEventBus, ModContainer modContainer, Dist dist) { diff --git a/src/main/resources/assets/omniaetnihil/lang/en_us.json b/src/main/resources/assets/omniaetnihil/lang/en_us.json index c55bffb..81412a6 100644 --- a/src/main/resources/assets/omniaetnihil/lang/en_us.json +++ b/src/main/resources/assets/omniaetnihil/lang/en_us.json @@ -3,6 +3,8 @@ "item.omniaetnihil.example_block": "Example Block", "item.omniaetnihil.grabber_jar": "Grabber Jar", "item.omniaetnihil.hurt_block": "Hurt Block", + "item.omniaetnihil.example_entity_spawn_egg": "Example Entity", + "entity.omniaetnihil.example_entity": "Example Entity", "block.omniaetnihil.hurt_block": "Hurt Block", "block.omniaetnihil.example_block": "Example Block", "itemGroup.omniaetnihil.omniaetnihil_tab": "Omnia Et Nihil" diff --git a/src/main/resources/assets/omniaetnihil/models/item/example_entity_spawn_egg.json b/src/main/resources/assets/omniaetnihil/models/item/example_entity_spawn_egg.json new file mode 100644 index 0000000..5a20500 --- /dev/null +++ b/src/main/resources/assets/omniaetnihil/models/item/example_entity_spawn_egg.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "omniaetnihil:item/example_item" + } +} \ No newline at end of file