Skip to content

Commit

Permalink
Spawn Eggs
Browse files Browse the repository at this point in the history
  • Loading branch information
Darthsae committed Jun 29, 2024
1 parent 5701857 commit 53b45e8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/sockmit2007/omniaetnihil/OmniaEtNihil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<SpawnEggItem> EXAMPLE_ENTITY_SPAWN_EGG = ITEMS.register("example_entity_spawn_egg",
() -> new DeferredSpawnEggItem(EXAMPLE_ENTITY, 0xDFDFDF, 0x99CFE8, new Item.Properties()));

public static final DeferredItem<Item> EXAMPLE_ITEM = ITEMS.registerSimpleItem("example_item",
new Item.Properties().food(new FoodProperties.Builder()
.alwaysEdible().nutrition(1).saturationModifier(2f).build()));
Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/omniaetnihil/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "omniaetnihil:item/example_item"
}
}

0 comments on commit 53b45e8

Please sign in to comment.