Skip to content

Commit

Permalink
Added spawn egg for goblin trader
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCrayfish committed Feb 23, 2020
1 parent db8e8e8 commit 3d07114
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
40 changes: 40 additions & 0 deletions src/main/java/com/mrcrayfish/goblintraders/init/ModItems.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.mrcrayfish.goblintraders.init;

import com.mrcrayfish.goblintraders.Reference;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.SpawnEggItem;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.IForgeRegistry;

import java.util.ArrayList;
import java.util.List;

/**
* Author: MrCrayfish
*/
@Mod.EventBusSubscriber(modid = Reference.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModItems
{
private static final List<Item> ITEMS = new ArrayList<>();

public static final Item GOBLIN_TRADER_SPAWN_EGG = build(new ResourceLocation(Reference.MOD_ID, "goblin_trader_spawn_egg"), new SpawnEggItem(ModEntities.GOBLIN_TRADER, 0x4da744, 0x316f5d, new Item.Properties().group(ItemGroup.MISC)));

private static Item build(ResourceLocation id, Item item)
{
item.setRegistryName(id);
ITEMS.add(item);
return item;
}

@SubscribeEvent
@SuppressWarnings("unused")
public static void registerTypes(final RegistryEvent.Register<Item> event)
{
IForgeRegistry<Item> registry = event.getRegistry();
ITEMS.forEach(registry::register);
}
}
3 changes: 2 additions & 1 deletion src/main/resources/assets/goblintraders/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"entity.goblintraders.goblin_trader": "Goblin Trader",
"subtitle.goblintraders.goblin_trader.annoyed_grunt": "Annoyed Grunt",
"subtitle.goblintraders.goblin_trader.idle_grunt": "Idle Grunt"
"subtitle.goblintraders.goblin_trader.idle_grunt": "Idle Grunt",
"item.goblintraders.goblin_traders_spawn_egg": "Goblin Trader Spawn Egg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "minecraft:item/template_spawn_egg"
}

0 comments on commit 3d07114

Please sign in to comment.