Search in sources :

Example 1 with InfuserReagent

use of com.mart.solar.api.infusing.InfuserReagent in project Solar by Martacus.

the class TileRuneInfuser method endInfusing.

/*
    End the infusing in the appropriate way. This means the infusion has succeeded
     */
private void endInfusing() {
    if (this.world.isRemote) {
        return;
    }
    // set the rune to its infused state
    InfuserReagent reagent = InfuserReagentRegistry.getByRegistrationName(this.reagentName);
    ItemStack rune = new ItemStack(ModItems.RUNES, 1, reagent.getRuneType().ordinal());
    this.itemStackHandler.setStackInSlot(0, rune);
    // remove or down reagent
    this.reagentUses--;
    if (reagentUses <= 0) {
        this.reagentName = "";
        this.itemStackHandler.setStackInSlot(1, ItemStack.EMPTY);
    }
    infusing = false;
    currentDuration = 0;
    if (!this.world.isRemote) {
        notifyUpdate();
    }
}
Also used : InfuserReagent(com.mart.solar.api.infusing.InfuserReagent) ItemStack(net.minecraft.item.ItemStack)

Example 2 with InfuserReagent

use of com.mart.solar.api.infusing.InfuserReagent in project Solar by Martacus.

the class TileRuneInfuser method infuse.

public void infuse() {
    if (!getNearbyAltar()) {
        return;
    }
    if (!this.itemStackHandler.getStackInSlot(0).isEmpty() && !this.itemStackHandler.getStackInSlot(1).isEmpty()) {
        if (reagentName.equalsIgnoreCase("")) {
            for (InfuserReagent reagent : InfuserReagentRegistry.getWorldReagents(this.getWorld())) {
                if (reagent.getReagent() == this.itemStackHandler.getStackInSlot(1).getItem()) {
                    this.infusing = true;
                    this.reagentName = InfuserReagentRegistry.getNameByReagent(reagent);
                    this.reagentUses = reagent.getReagentUses();
                    break;
                }
            }
        } else {
            this.infusing = true;
        }
    }
}
Also used : InfuserReagent(com.mart.solar.api.infusing.InfuserReagent)

Example 3 with InfuserReagent

use of com.mart.solar.api.infusing.InfuserReagent in project Solar by Martacus.

the class ModRecipes method registerRecipes.

@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
    OreDictionary.registerOre("oreSilver", ModBlocks.SILVER_ORE);
    OreDictionary.registerOre("ingotSilver", ModItems.SILVER_INGOT);
    OreDictionary.registerOre("nuggetSilver", ModItems.SILVER_NUGGET);
    GameRegistry.addSmelting(ModBlocks.SILVER_ORE, new ItemStack(ModItems.SILVER_INGOT, 1), 1.5f);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(Items.BLAZE_POWDER, RuneType.FIRE, 2), "blaze_powder_fire", true);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(Items.COAL, RuneType.FIRE, 1), "coal_fire", true);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(Items.GUNPOWDER, RuneType.FIRE, 3), "gunpowder_fire", true);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(Items.POTIONITEM, RuneType.WATER, 1), "water_bottle_water", true);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(ItemBlock.getByNameOrId("stone"), RuneType.EARTH, 1), "stone_earth", true);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(Items.FEATHER, RuneType.WIND, 1), "feather_wind", true);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(Items.DIAMOND, RuneType.TIME, 2), "diamond_time", true);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(Items.BONE, RuneType.LIFE, 1), "bone_life", true);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(Items.GOLD_NUGGET, RuneType.SUN, 1), "gold_nugget_sun", true);
    InfuserReagentRegistry.registerReagent(new InfuserReagent(ModItems.SILVER_NUGGET, RuneType.MOON, 1), "silver_nugget_sun", true);
    AltarRecipeRegistry.registerRecipe(new AltarRecipe(Ingredient.fromItem(ModItems.DULL_AMULET), new ItemStack(ModItems.RITUAL_AMULET), 500), "ritual_amulet", true);
    AltarRecipeRegistry.registerRecipe(new AltarRecipe(Ingredient.fromItem(Item.getItemFromBlock(Blocks.PLANKS)), new ItemStack(ModItems.RUNES), 100), "rune", true);
    AltarRecipeRegistry.registerRecipe(new AltarRecipe(Ingredient.fromItem(Items.BOOK), new ItemStack(ModItems.JOURNAL), 100), "journal", true);
    AltarRecipeRegistry.registerRecipe(new AltarRecipe(Ingredient.fromItem(Item.getItemFromBlock(Blocks.STONE)), new ItemStack(Item.getItemFromBlock(ModBlocks.SUNBURNT)), 50), "sunburnt_stone", true);
    AltarRecipeRegistry.registerRecipe(new AltarRecipe(Ingredient.fromItem(Items.GOLD_INGOT), new ItemStack(ModItems.INFUSED, 1, 0), 400), "infused_gold", true);
    AltarRecipeRegistry.registerRecipe(new AltarRecipe(Ingredient.fromItem(ModItems.SILVER_INGOT), new ItemStack(ModItems.INFUSED, 1, 1), 400), "infused_silver", true);
    OfferingRecipeRegister.registerRecipe(new OfferingRecipe(new ItemStack(ModItems.RING_FLIGHT), Items.FEATHER, Items.FEATHER, Items.FEATHER, Items.FEATHER, Items.FEATHER, Items.FEATHER, Items.FEATHER, Items.FEATHER), "ring_of_flight", true);
}
Also used : OfferingRecipe(com.mart.solar.api.recipes.OfferingRecipe) InfuserReagent(com.mart.solar.api.infusing.InfuserReagent) AltarRecipe(com.mart.solar.api.recipes.AltarRecipe) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

InfuserReagent (com.mart.solar.api.infusing.InfuserReagent)3 ItemStack (net.minecraft.item.ItemStack)2 AltarRecipe (com.mart.solar.api.recipes.AltarRecipe)1 OfferingRecipe (com.mart.solar.api.recipes.OfferingRecipe)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1