Search in sources :

Example 6 with IBloodOrb

use of WayofTime.bloodmagic.orb.IBloodOrb in project BloodMagic by WayofTime.

the class BloodMagicRecipeRegistrar method addTartaricForge.

public void addTartaricForge(@Nonnull ItemStack output, @Nonnegative double minimumSouls, @Nonnegative double soulDrain, @Nonnull Object... input) {
    Preconditions.checkNotNull(output, "output cannot be null.");
    Preconditions.checkArgument(minimumSouls >= 0, "minimumSouls cannot be negative.");
    Preconditions.checkArgument(soulDrain >= 0, "soulDrain cannot be negative.");
    Preconditions.checkNotNull(input, "input cannot be null.");
    List<Ingredient> ingredients = Lists.newArrayList();
    for (Object object : input) {
        if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) {
            ingredients.add(new IngredientBloodOrb(((IBloodOrb) ((ItemStack) object).getItem()).getOrb((ItemStack) object)));
            continue;
        }
        ingredients.add(CraftingHelper.getIngredient(object));
    }
    addTartaricForge(output, minimumSouls, soulDrain, ingredients.toArray(new Ingredient[0]));
}
Also used : IngredientBloodOrb(WayofTime.bloodmagic.core.recipe.IngredientBloodOrb) Ingredient(net.minecraft.item.crafting.Ingredient) IBloodOrb(WayofTime.bloodmagic.orb.IBloodOrb) ItemStack(net.minecraft.item.ItemStack)

Example 7 with IBloodOrb

use of WayofTime.bloodmagic.orb.IBloodOrb in project BloodMagic by WayofTime.

the class BloodMagicRecipeRegistrar method addAlchemyTable.

public void addAlchemyTable(@Nonnull ItemStack output, @Nonnegative int syphon, @Nonnegative int ticks, @Nonnegative int minimumTier, @Nonnull Object... input) {
    Preconditions.checkNotNull(output, "output cannot be null.");
    Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative.");
    Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative.");
    Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative.");
    Preconditions.checkNotNull(input, "input cannot be null.");
    List<Ingredient> ingredients = Lists.newArrayList();
    for (Object object : input) {
        if (object instanceof ItemStack && ((ItemStack) object).getItem() instanceof IBloodOrb) {
            ingredients.add(new IngredientBloodOrb(((IBloodOrb) ((ItemStack) object).getItem()).getOrb((ItemStack) object)));
            continue;
        }
        ingredients.add(CraftingHelper.getIngredient(object));
    }
    addAlchemyTable(output, syphon, ticks, minimumTier, ingredients.toArray(new Ingredient[0]));
}
Also used : IngredientBloodOrb(WayofTime.bloodmagic.core.recipe.IngredientBloodOrb) Ingredient(net.minecraft.item.crafting.Ingredient) IBloodOrb(WayofTime.bloodmagic.orb.IBloodOrb) ItemStack(net.minecraft.item.ItemStack)

Example 8 with IBloodOrb

use of WayofTime.bloodmagic.orb.IBloodOrb in project BloodMagic by WayofTime.

the class BlockAltar method getComparatorInputOverride.

@Override
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
    if (world.isRemote)
        return 0;
    TileEntity tile = world.getTileEntity(pos);
    if (tile != null && tile instanceof TileAltar) {
        TileAltar altar = (TileAltar) tile;
        ItemStack orbStack = altar.getStackInSlot(0);
        if (world.getBlockState(pos.down()).getBlock() instanceof BlockDecorative) {
            if (orbStack.getItem() instanceof IBloodOrb && orbStack.getItem() instanceof IBindable) {
                BloodOrb orb = ((IBloodOrb) orbStack.getItem()).getOrb(orbStack);
                Binding binding = ((IBindable) orbStack.getItem()).getBinding(orbStack);
                if (orb != null && binding != null) {
                    SoulNetwork soulNetwork = NetworkHelper.getSoulNetwork(binding);
                    int maxEssence = orb.getCapacity();
                    int currentEssence = soulNetwork.getCurrentEssence();
                    int level = currentEssence * 15 / maxEssence;
                    return Math.min(15, level) % 16;
                }
            }
        } else {
            int maxEssence = altar.getCapacity();
            int currentEssence = altar.getCurrentBlood();
            int level = currentEssence * 15 / maxEssence;
            return Math.min(15, level) % 16;
        }
    }
    return 0;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Binding(WayofTime.bloodmagic.core.data.Binding) IBindable(WayofTime.bloodmagic.iface.IBindable) IBloodOrb(WayofTime.bloodmagic.orb.IBloodOrb) BloodOrb(WayofTime.bloodmagic.orb.BloodOrb) SoulNetwork(WayofTime.bloodmagic.core.data.SoulNetwork) IBloodOrb(WayofTime.bloodmagic.orb.IBloodOrb) ItemStack(net.minecraft.item.ItemStack) TileAltar(WayofTime.bloodmagic.tile.TileAltar)

Aggregations

IBloodOrb (WayofTime.bloodmagic.orb.IBloodOrb)8 ItemStack (net.minecraft.item.ItemStack)8 Binding (WayofTime.bloodmagic.core.data.Binding)3 SoulNetwork (WayofTime.bloodmagic.core.data.SoulNetwork)3 IBindable (WayofTime.bloodmagic.iface.IBindable)3 BloodOrb (WayofTime.bloodmagic.orb.BloodOrb)3 RecipeBloodAltar (WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar)2 IngredientBloodOrb (WayofTime.bloodmagic.core.recipe.IngredientBloodOrb)2 TileAltar (WayofTime.bloodmagic.tile.TileAltar)2 Ingredient (net.minecraft.item.crafting.Ingredient)2 BloodMagicCraftedEvent (WayofTime.bloodmagic.api.event.BloodMagicCraftedEvent)1 ItemBindEvent (WayofTime.bloodmagic.event.ItemBindEvent)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Slot (net.minecraft.inventory.Slot)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1 WorldServer (net.minecraft.world.WorldServer)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1