Search in sources :

Example 1 with AgriNuggetType

use of com.infinityraider.agricraft.reference.AgriNuggetType in project AgriCraft by AgriCraft.

the class ItemNugget method getSubItems.

@Override
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> varients) {
    for (AgriNuggetType type : AgriNuggetType.values()) {
        ItemStack stack = new ItemStack(item, 1, type.ordinal());
        OreDictionary.registerOre(type.nugget, stack);
        varients.add(stack);
    }
}
Also used : AgriNuggetType(com.infinityraider.agricraft.reference.AgriNuggetType) ItemStack(net.minecraft.item.ItemStack)

Example 2 with AgriNuggetType

use of com.infinityraider.agricraft.reference.AgriNuggetType in project AgriCraft by AgriCraft.

the class ItemNugget method registerRecipes.

@Override
public void registerRecipes() {
    for (AgriNuggetType type : AgriNuggetType.values()) {
        ItemStack nugget = new ItemStack(this, 9, type.ordinal());
        ItemStack ingot = OreDictHelper.getIngot(type.ingot);
        AgriCore.getLogger("agricraft").debug("Registering Nugget: {0} For: {1}", type.nugget, type.ingot);
        if (ingot != null) {
            GameRegistry.addRecipe(new ShapedOreRecipe(ingot, "nnn", "nnn", "nnn", 'n', type.nugget));
            GameRegistry.addRecipe(new ShapelessOreRecipe(nugget, type.ingot));
        }
    }
}
Also used : ShapedOreRecipe(net.minecraftforge.oredict.ShapedOreRecipe) ShapelessOreRecipe(net.minecraftforge.oredict.ShapelessOreRecipe) AgriNuggetType(com.infinityraider.agricraft.reference.AgriNuggetType) ItemStack(net.minecraft.item.ItemStack)

Example 3 with AgriNuggetType

use of com.infinityraider.agricraft.reference.AgriNuggetType in project AgriCraft by AgriCraft.

the class ItemNugget method registerRecipes.

@Override
public void registerRecipes(IForgeRegistry<IRecipe> registry) {
    for (AgriNuggetType type : AgriNuggetType.values()) {
        // 1) Ore Dictionary registration.
        AgriCore.getLogger("agricraft").info("Registering in Ore Dictionary: {0}", type.nugget);
        ItemStack oneNugget = new ItemStack(this, 1, type.ordinal());
        OreDictionary.registerOre(type.nugget, oneNugget);
        // 2) Conditional recipes. Only if the ingot exists, because AgriCraft doesn't add its own.
        ItemStack ingot = OreDictHelper.getIngot(type.ingot);
        if (!ingot.isEmpty()) {
            AgriCore.getLogger("agricraft").info("Adding a recipe to convert nine {0} into one {1}", type.nugget, type.ingot);
            final ResourceLocation group = new ResourceLocation(AgriCraft.instance.getModId(), "combine_nugget");
            final ResourceLocation name = new ResourceLocation(AgriCraft.instance.getModId(), "combine_nugget_" + type.name().toLowerCase());
            final ShapedOreRecipe recipe = new ShapedOreRecipe(group, ingot, "nnn", "nnn", "nnn", 'n', type.nugget);
            recipe.setRegistryName(name);
            AgriCore.getLogger("agricraft").info("Registering nugget recipe: {0}!", recipe.getRegistryName());
            registry.register(recipe);
        }
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) ShapedOreRecipe(net.minecraftforge.oredict.ShapedOreRecipe) AgriNuggetType(com.infinityraider.agricraft.reference.AgriNuggetType) ItemStack(net.minecraft.item.ItemStack)

Example 4 with AgriNuggetType

use of com.infinityraider.agricraft.reference.AgriNuggetType in project AgriCraft by AgriCraft.

the class ItemNugget method getSubItems.

@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> varients) {
    if (tab == this.getCreativeTab() || tab == CreativeTabs.SEARCH) {
        for (AgriNuggetType type : AgriNuggetType.values()) {
            ItemStack stack = new ItemStack(this, 1, type.ordinal());
            varients.add(stack);
        }
    }
}
Also used : AgriNuggetType(com.infinityraider.agricraft.reference.AgriNuggetType) ItemStack(net.minecraft.item.ItemStack)

Aggregations

AgriNuggetType (com.infinityraider.agricraft.reference.AgriNuggetType)4 ItemStack (net.minecraft.item.ItemStack)4 ShapedOreRecipe (net.minecraftforge.oredict.ShapedOreRecipe)2 ResourceLocation (net.minecraft.util.ResourceLocation)1 ShapelessOreRecipe (net.minecraftforge.oredict.ShapelessOreRecipe)1