Search in sources :

Example 1 with AlchemyFlask

use of WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask in project BloodMagic by WayofTime.

the class ModItems method init.

public static void init() {
    weakBloodOrb = new EnergyBattery(5000).setUnlocalizedName("weakBloodOrb");
    apprenticeBloodOrb = new ApprenticeBloodOrb(25000).setUnlocalizedName("apprenticeBloodOrb");
    magicianBloodOrb = new MagicianBloodOrb(150000).setUnlocalizedName("magicianBloodOrb");
    masterBloodOrb = new MasterBloodOrb(1000000).setUnlocalizedName("masterBloodOrb");
    archmageBloodOrb = new ArchmageBloodOrb(10000000).setUnlocalizedName("archmageBloodOrb");
    transcendentBloodOrb = new TranscendentBloodOrb(30000000).setUnlocalizedName("transcendentBloodOrb");
    energyBlaster = new EnergyBlast().setUnlocalizedName("energyBlast");
    energySword = new EnergySword().setUnlocalizedName("energySword");
    lavaCrystal = new LavaCrystal().setUnlocalizedName("lavaCrystal");
    waterSigil = new SigilWater().setUnlocalizedName("waterSigil");
    lavaSigil = new SigilLava().setUnlocalizedName("lavaSigil");
    voidSigil = new SigilVoid().setUnlocalizedName("voidSigil");
    blankSlate = new AWBaseItems().setUnlocalizedName("blankSlate");
    reinforcedSlate = new AWBaseItems().setUnlocalizedName("reinforcedSlate");
    sacrificialDagger = new SacrificialDagger().setUnlocalizedName("sacrificialDagger");
    daggerOfSacrifice = new DaggerOfSacrifice().setUnlocalizedName("daggerOfSacrifice");
    airSigil = new SigilAir().setUnlocalizedName("airSigil");
    sigilOfTheFastMiner = new SigilOfTheFastMiner().setUnlocalizedName("sigilOfTheFastMiner");
    sigilOfElementalAffinity = new SigilOfElementalAffinity().setUnlocalizedName("sigilOfElementalAffinity");
    sigilOfHaste = new SigilOfHaste().setUnlocalizedName("sigilOfHaste");
    sigilOfHolding = new SigilOfHolding().setUnlocalizedName("sigilOfHolding");
    divinationSigil = new SigilDivination().setUnlocalizedName("divinationSigil");
    waterScribeTool = new WaterScribeTool().setUnlocalizedName("waterScribeTool");
    fireScribeTool = new FireScribeTool().setUnlocalizedName("fireScribeTool");
    earthScribeTool = new EarthScribeTool().setUnlocalizedName("earthScribeTool");
    airScribeTool = new AirScribeTool().setUnlocalizedName("airScribeTool");
    activationCrystal = new ActivationCrystal();
    boundPickaxe = new BoundPickaxe().setUnlocalizedName("boundPickaxe");
    boundAxe = new BoundAxe().setUnlocalizedName("boundAxe");
    boundShovel = new BoundShovel().setUnlocalizedName("boundShovel");
    boundHelmet = new BoundArmour(0).setUnlocalizedName("boundHelmet");
    boundPlate = new BoundArmour(1).setUnlocalizedName("boundPlate");
    boundLeggings = new BoundArmour(2).setUnlocalizedName("boundLeggings");
    boundBoots = new BoundArmour(3).setUnlocalizedName("boundBoots");
    weakBloodShard = new BloodShard().setUnlocalizedName("weakBloodShard");
    growthSigil = new SigilOfGrowth().setUnlocalizedName("growthSigil");
    blankSpell = new BlankSpell().setUnlocalizedName("blankSpell");
    alchemyFlask = new AlchemyFlask().setUnlocalizedName("alchemyFlask");
    standardBindingAgent = new StandardBindingAgent().setUnlocalizedName("standardBindingAgent");
    mundanePowerCatalyst = new MundanePowerCatalyst().setUnlocalizedName("mundanePowerCatalyst");
    averagePowerCatalyst = new AveragePowerCatalyst().setUnlocalizedName("averagePowerCatalyst");
    greaterPowerCatalyst = new GreaterPowerCatalyst().setUnlocalizedName("greaterPowerCatalyst");
    mundaneLengtheningCatalyst = new MundaneLengtheningCatalyst().setUnlocalizedName("mundaneLengtheningCatalyst");
    averageLengtheningCatalyst = new AverageLengtheningCatalyst().setUnlocalizedName("averageLengtheningCatalyst");
    greaterLengtheningCatalyst = new GreaterLengtheningCatalyst().setUnlocalizedName("greaterLengtheningCatalyst");
    incendium = new AlchemyReagent().setUnlocalizedName("incendium");
    magicales = new AlchemyReagent().setUnlocalizedName("magicales");
    sanctus = new AlchemyReagent().setUnlocalizedName("sanctus");
    aether = new AlchemyReagent().setUnlocalizedName("aether");
    simpleCatalyst = new AlchemyReagent().setUnlocalizedName("simpleCatalyst");
    crepitous = new AlchemyReagent().setUnlocalizedName("crepitous");
    crystallos = new AlchemyReagent().setUnlocalizedName("crystallos");
    terrae = new AlchemyReagent().setUnlocalizedName("terrae");
    aquasalus = new AlchemyReagent().setUnlocalizedName("aquasalus");
    tennebrae = new AlchemyReagent().setUnlocalizedName("tennebrae");
    demonBloodShard = new BloodShard().setUnlocalizedName("demonBloodShard");
    sigilOfWind = new SigilOfWind().setUnlocalizedName("sigilOfWind");
    telepositionFocus = new TelepositionFocus(1).setUnlocalizedName("telepositionFocus");
    enhancedTelepositionFocus = new EnhancedTelepositionFocus().setUnlocalizedName("enhancedTelepositionFocus");
    reinforcedTelepositionFocus = new ReinforcedTelepositionFocus().setUnlocalizedName("reinforcedTelepositionFocus");
    demonicTelepositionFocus = new DemonicTelepositionFocus().setUnlocalizedName("demonicTelepositionFocus");
    imbuedSlate = new AWBaseItems().setUnlocalizedName("imbuedSlate");
    demonicSlate = new AWBaseItems().setUnlocalizedName("demonicSlate");
    duskScribeTool = new DuskScribeTool().setUnlocalizedName("duskScribeTool");
    sigilOfTheBridge = new SigilOfTheBridge().setUnlocalizedName("sigilOfTheBridge");
    armourInhibitor = new ArmourInhibitor().setUnlocalizedName("armourInhibitor");
    creativeFiller = new CheatyItem().setUnlocalizedName("cheatyItem");
    demonPlacer = new DemonPlacer().setUnlocalizedName("demonPlacer");
    creativeDagger = new CreativeDagger().setUnlocalizedName("creativeDagger");
    weakFillingAgent = new WeakFillingAgent().setUnlocalizedName("weakFillingAgent");
    standardFillingAgent = new StandardFillingAgent().setUnlocalizedName("standardFillingAgent");
    enhancedFillingAgent = new EnhancedFillingAgent().setUnlocalizedName("enhancedFillingAgent");
    weakBindingAgent = new WeakBindingAgent().setUnlocalizedName("weakBindingAgent");
    itemRitualDiviner = new ItemRitualDiviner().setUnlocalizedName("ritualDiviner");
    sigilOfMagnetism = new SigilOfMagnetism().setUnlocalizedName("sigilOfMagnetism");
    itemKeyOfDiablo = new ItemDiabloKey().setUnlocalizedName("itemDiabloKey");
    energyBazooka = new EnergyBazooka().setUnlocalizedName("energyBazooka");
    itemBloodLightSigil = new SigilBloodLight().setUnlocalizedName("bloodLightSigil");
    itemComplexSpellCrystal = new ItemComplexSpellCrystal().setUnlocalizedName("itemComplexSpellCrystal");
    bucketLife = new LifeBucket(ModBlocks.blockLifeEssence).setUnlocalizedName("bucketLife").setContainerItem(Items.bucket).setCreativeTab(CreativeTabs.tabMisc);
    itemSigilOfEnderSeverance = (new SigilOfEnderSeverance()).setUnlocalizedName("itemSigilOfEnderSeverance");
    baseItems = new ItemComponents().setUnlocalizedName("baseItems");
    baseAlchemyItems = new ItemAlchemyBase().setUnlocalizedName("baseAlchemyItems");
    itemSigilOfSupression = new SigilOfSupression().setUnlocalizedName("itemSigilOfSupression");
    itemFluidSigil = new SigilFluid().setUnlocalizedName("itemFluidSigil");
    itemSeerSigil = new SigilSeer().setUnlocalizedName("itemSeerSigil");
    customTool = new ItemSpellMultiTool().setUnlocalizedName("multiTool");
    SpellParadigmTool.customTool = customTool;
    itemCombinationalCatalyst = new CombinationalCatalyst().setUnlocalizedName("itemCombinationalCatalyst");
    itemAttunedCrystal = new ItemAttunedCrystal().setUnlocalizedName("itemAttunedCrystal");
    itemTankSegmenter = new ItemTankSegmenter().setUnlocalizedName("itemTankSegmenter");
    itemDestinationClearer = new ItemDestinationClearer().setUnlocalizedName("destinationClearer");
    dawnScribeTool = new DawnScribeTool().setUnlocalizedName("dawnScribeTool");
    itemBloodPack = new ItemBloodLetterPack().setUnlocalizedName("itemBloodPack");
    itemHarvestSigil = new SigilHarvest().setUnlocalizedName("itemHarvestSigil");
    itemCompressionSigil = new SigilPackRat().setUnlocalizedName("itemCompressionSigil");
    itemAssassinSigil = new SigilOfTheAssassin().setUnlocalizedName("itemAssassinSigil");
    boundHelmetWater = new OmegaArmourWater(0).setUnlocalizedName("boundHelmetWater");
    boundPlateWater = new OmegaArmourWater(1).setUnlocalizedName("boundPlateWater");
    boundLeggingsWater = new OmegaArmourWater(2).setUnlocalizedName("boundLeggingsWater");
    boundBootsWater = new OmegaArmourWater(3).setUnlocalizedName("boundBootsWater");
    boundHelmetEarth = new OmegaArmourEarth(0).setUnlocalizedName("boundHelmetEarth");
    boundPlateEarth = new OmegaArmourEarth(1).setUnlocalizedName("boundPlateEarth");
    boundLeggingsEarth = new OmegaArmourEarth(2).setUnlocalizedName("boundLeggingsEarth");
    boundBootsEarth = new OmegaArmourEarth(3).setUnlocalizedName("boundBootsEarth");
    boundHelmetWind = new OmegaArmourWind(0).setUnlocalizedName("boundHelmetWind");
    boundPlateWind = new OmegaArmourWind(1).setUnlocalizedName("boundPlateWind");
    boundLeggingsWind = new OmegaArmourWind(2).setUnlocalizedName("boundLeggingsWind");
    boundBootsWind = new OmegaArmourWind(3).setUnlocalizedName("boundBootsWind");
    boundHelmetFire = new OmegaArmourFire(0).setUnlocalizedName("boundHelmetFire");
    boundPlateFire = new OmegaArmourFire(1).setUnlocalizedName("boundPlateFire");
    boundLeggingsFire = new OmegaArmourFire(2).setUnlocalizedName("boundLeggingsFire");
    boundBootsFire = new OmegaArmourFire(3).setUnlocalizedName("boundBootsFire");
    inputRoutingFocus = new InputRoutingFocus().setUnlocalizedName("inputRoutingFocus");
    outputRoutingFocus = new OutputRoutingFocus().setUnlocalizedName("outputRoutingFocus");
    itemIncense = new ItemIncense().setUnlocalizedName("bloodMagicIncenseItem");
    ritualDismantler = new ItemRitualDismantler().setUnlocalizedName("ritualDismantler");
}
Also used : SigilOfHaste(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHaste) SigilOfMagnetism(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfMagnetism) SigilBloodLight(WayofTime.alchemicalWizardry.common.items.sigil.SigilBloodLight) WeakFillingAgent(WayofTime.alchemicalWizardry.common.items.potion.WeakFillingAgent) SigilOfGrowth(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfGrowth) OmegaArmourEarth(WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourEarth) GreaterPowerCatalyst(WayofTime.alchemicalWizardry.common.items.potion.GreaterPowerCatalyst) ItemAttunedCrystal(WayofTime.alchemicalWizardry.common.items.energy.ItemAttunedCrystal) WeakBindingAgent(WayofTime.alchemicalWizardry.common.items.potion.WeakBindingAgent) MundanePowerCatalyst(WayofTime.alchemicalWizardry.common.items.potion.MundanePowerCatalyst) SigilOfHolding(WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding) SigilOfEnderSeverance(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfEnderSeverance) MundaneLengtheningCatalyst(WayofTime.alchemicalWizardry.common.items.potion.MundaneLengtheningCatalyst) SigilPackRat(WayofTime.alchemicalWizardry.common.items.sigil.SigilPackRat) SigilOfTheAssassin(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheAssassin) SigilAir(WayofTime.alchemicalWizardry.common.items.sigil.SigilAir) OmegaArmourWater(WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourWater) SigilVoid(WayofTime.alchemicalWizardry.common.items.sigil.SigilVoid) AlchemyFlask(WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask) OmegaArmourFire(WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourFire) SigilSeer(WayofTime.alchemicalWizardry.common.items.sigil.SigilSeer) CombinationalCatalyst(WayofTime.alchemicalWizardry.common.items.potion.CombinationalCatalyst) SigilOfTheFastMiner(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheFastMiner) ItemDestinationClearer(WayofTime.alchemicalWizardry.common.items.energy.ItemDestinationClearer) BoundArmour(WayofTime.alchemicalWizardry.common.items.armour.BoundArmour) SigilWater(WayofTime.alchemicalWizardry.common.items.sigil.SigilWater) StandardBindingAgent(WayofTime.alchemicalWizardry.common.items.potion.StandardBindingAgent) SigilDivination(WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination) EnhancedFillingAgent(WayofTime.alchemicalWizardry.common.items.potion.EnhancedFillingAgent) OutputRoutingFocus(WayofTime.alchemicalWizardry.common.items.routing.OutputRoutingFocus) AlchemyReagent(WayofTime.alchemicalWizardry.common.items.potion.AlchemyReagent) GreaterLengtheningCatalyst(WayofTime.alchemicalWizardry.common.items.potion.GreaterLengtheningCatalyst) StandardFillingAgent(WayofTime.alchemicalWizardry.common.items.potion.StandardFillingAgent) SigilOfSupression(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfSupression) AverageLengtheningCatalyst(WayofTime.alchemicalWizardry.common.items.potion.AverageLengtheningCatalyst) SigilFluid(WayofTime.alchemicalWizardry.common.items.sigil.SigilFluid) SigilOfElementalAffinity(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfElementalAffinity) OmegaArmourWind(WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourWind) ItemTankSegmenter(WayofTime.alchemicalWizardry.common.items.energy.ItemTankSegmenter) AveragePowerCatalyst(WayofTime.alchemicalWizardry.common.items.potion.AveragePowerCatalyst) SigilLava(WayofTime.alchemicalWizardry.common.items.sigil.SigilLava) SigilOfTheBridge(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheBridge) ItemSpellMultiTool(WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool) InputRoutingFocus(WayofTime.alchemicalWizardry.common.items.routing.InputRoutingFocus) SigilOfWind(WayofTime.alchemicalWizardry.common.items.sigil.SigilOfWind) SigilHarvest(WayofTime.alchemicalWizardry.common.items.sigil.SigilHarvest)

Example 2 with AlchemyFlask

use of WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask in project BloodMagic by WayofTime.

the class CombinedPotionRegistry method applyPotionEffect.

public static ItemStack applyPotionEffect(ItemStack stack) {
    if (stack == null || !(stack.getItem() instanceof AlchemyFlask)) {
        return null;
    }
    List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
    if (list == null) {
        return stack;
    }
    boolean isDone = false;
    for (AlchemyPotionHelper helper1 : list) {
        if (isDone) {
            continue;
        }
        for (int i = 0; i < list.size(); i++) {
            if (isDone) {
                continue;
            }
            AlchemyPotionHelper helper2 = list.get(i);
            PotionEffect potEffect = getResultantPotion(helper1, helper2);
            if (potEffect != null) {
                AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier());
                list.remove(helper1);
                list.remove(helper2);
                list.add(potHelper);
                isDone = true;
            }
        }
    }
    if (isDone) {
        AlchemyFlask.setEffects(stack, list);
        return stack;
    }
    return null;
}
Also used : AlchemyPotionHelper(WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper) PotionEffect(net.minecraft.potion.PotionEffect) AlchemyFlask(WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask)

Example 3 with AlchemyFlask

use of WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask in project BloodMagic by WayofTime.

the class TEWritingTable method updateEntity.

@Override
public void updateEntity() {
    int progressNeeded = 100;
    long worldTime = worldObj.getWorldTime();
    if (worldObj.isRemote) {
        return;
    }
    if (accelerationTime > 0) {
        accelerationTime--;
    }
    if (containsPotionFlask() && containsRegisteredPotionIngredient()) {
        if (containsCatalyst()) {
            if (getStackInSlot(6) == null) {
                progress++;
                if (worldTime % 4 == 0) {
                    SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
                }
                if (progress >= progressNeeded) {
                    ItemStack flaskStack = inv[this.getPotionFlaskPosition()];
                    ItemStack ingredientStack = inv[this.getRegisteredPotionIngredientPosition()];
                    ItemStack catalystStack = inv[this.getCatalystPosition()];
                    if (flaskStack == null || ingredientStack == null || catalystStack == null) {
                        progress = 0;
                        if (worldObj != null) {
                            worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                        }
                        return;
                    }
                    int potionID = AlchemicalPotionCreationHandler.getPotionIDForStack(ingredientStack);
                    int catalystLevel = ((ICatalyst) catalystStack.getItem()).getCatalystLevel();
                    boolean isConcentration = ((ICatalyst) catalystStack.getItem()).isConcentration();
                    if (potionID == -1 || catalystLevel < 0) {
                        progress = 0;
                        if (worldObj != null) {
                            worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                        }
                        return;
                    }
                    if (isConcentration) {
                        ((AlchemyFlask) flaskStack.getItem()).setConcentrationOfPotion(flaskStack, potionID, catalystLevel);
                    } else {
                        ((AlchemyFlask) flaskStack.getItem()).setDurationFactorOfPotion(flaskStack, potionID, catalystLevel);
                    }
                    this.setInventorySlotContents(6, flaskStack);
                    this.decrStackSize(this.getPotionFlaskPosition(), 1);
                    this.decrStackSize(this.getCatalystPosition(), 1);
                    this.decrStackSize(this.getRegisteredPotionIngredientPosition(), 1);
                    progress = 0;
                    if (worldObj != null) {
                        worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                    }
                }
            }
        } else if (containsBindingAgent()) {
            if (getStackInSlot(6) == null) {
                progress++;
                if (worldTime % 4 == 0) {
                    SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
                }
                if (progress >= progressNeeded) {
                    ItemStack flaskStack = inv[this.getPotionFlaskPosition()];
                    ItemStack ingredientStack = inv[this.getRegisteredPotionIngredientPosition()];
                    ItemStack agentStack = inv[this.getBindingAgentPosition()];
                    if (flaskStack == null || ingredientStack == null || agentStack == null) {
                        progress = 0;
                        if (worldObj != null) {
                            worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                        }
                        return;
                    }
                    int potionEffectNumber = ((AlchemyFlask) flaskStack.getItem()).getNumberOfPotionEffects(flaskStack);
                    int potionID = AlchemicalPotionCreationHandler.getPotionIDForStack(ingredientStack);
                    int tickDuration = AlchemicalPotionCreationHandler.getPotionTickDurationForStack(ingredientStack);
                    float successChance = ((IBindingAgent) agentStack.getItem()).getSuccessRateForPotionNumber(potionEffectNumber);
                    if (potionID == -1) {
                        progress = 0;
                        if (worldObj != null) {
                            worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                        }
                        return;
                    }
                    ((AlchemyFlask) flaskStack.getItem()).addPotionEffect(flaskStack, potionID, tickDuration);
                    if (successChance > worldObj.rand.nextFloat()) {
                        this.setInventorySlotContents(6, flaskStack);
                    } else {
                        worldObj.createExplosion(null, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 2, false);
                    }
                    this.decrStackSize(this.getPotionFlaskPosition(), 1);
                    this.decrStackSize(this.getBindingAgentPosition(), 1);
                    this.decrStackSize(this.getRegisteredPotionIngredientPosition(), 1);
                    progress = 0;
                    if (worldObj != null) {
                        worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                    }
                }
            }
        }
    } else if (this.containsBlankSlate() && this.containsPotionFlask()) {
        if (getStackInSlot(6) == null) {
            progress++;
            if (worldTime % 4 == 0) {
                SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
            }
            if (progress >= progressNeeded) {
                ItemStack flaskStack = inv[this.getPotionFlaskPosition()];
                ItemStack blankSlate = inv[this.getBlankSlatePosition()];
                if (flaskStack == null || blankSlate == null) {
                    progress = 0;
                    if (worldObj != null) {
                        worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                    }
                    return;
                }
                ((AlchemyFlask) flaskStack.getItem()).setIsPotionThrowable(true, flaskStack);
                this.setInventorySlotContents(6, flaskStack);
                this.decrStackSize(this.getPotionFlaskPosition(), 1);
                this.decrStackSize(this.getBlankSlatePosition(), 1);
                progress = 0;
                if (worldObj != null) {
                    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                }
            }
        }
    } else if (this.containsFillingAgent() && this.containsPotionFlask()) {
        if (getStackInSlot(6) == null) {
            progress++;
            if (worldTime % 4 == 0) {
                SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
            }
            if (progress >= progressNeeded) {
                ItemStack flaskStack = inv[this.getPotionFlaskPosition()];
                ItemStack fillingAgent = inv[this.getFillingAgentPosition()];
                if (flaskStack == null || fillingAgent == null) {
                    progress = 0;
                    if (worldObj != null) {
                        worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                    }
                    return;
                }
                int potionEffects = ((AlchemyFlask) flaskStack.getItem()).getNumberOfPotionEffects(flaskStack);
                int potionFillAmount = ((IFillingAgent) fillingAgent.getItem()).getFilledAmountForPotionNumber(potionEffects);
                flaskStack.setItemDamage(Math.max(0, flaskStack.getItemDamage() - potionFillAmount));
                this.setInventorySlotContents(6, flaskStack);
                this.decrStackSize(this.getPotionFlaskPosition(), 1);
                this.decrStackSize(this.getFillingAgentPosition(), 1);
                progress = 0;
                if (worldObj != null) {
                    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                }
            }
        }
    } else if (this.containsPotionFlask() && this.containsCombinationCatalyst()) {
        // TODO
        if (getStackInSlot(6) == null && CombinedPotionRegistry.hasCombinablePotionEffect(inv[this.getPotionFlaskPosition()])) {
            progress++;
            if (worldTime % 4 == 0) {
                SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
            }
            if (progress >= progressNeeded) {
                ItemStack flaskStack = inv[this.getPotionFlaskPosition()];
                ItemStack combinationCatalyst = inv[this.getCombinationCatalystPosition()];
                if (flaskStack == null || combinationCatalyst == null) {
                    progress = 0;
                    if (worldObj != null) {
                        worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                    }
                    return;
                }
                ItemStack newFlask = CombinedPotionRegistry.applyPotionEffect(flaskStack);
                if (newFlask != null) {
                    this.setInventorySlotContents(6, newFlask);
                    this.decrStackSize(this.getPotionFlaskPosition(), 1);
                    this.decrStackSize(this.getCombinationCatalystPosition(), 1);
                    progress = 0;
                    if (worldObj != null) {
                        worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                    }
                }
            }
        }
    } else {
        if (!isRecipeValid()) {
            progress = 0;
            return;
        }
        if (progress <= 0) {
            progress = 0;
            amountUsed = this.getAmountNeeded(getStackInSlot(0));
            if (worldObj != null) {
                worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
            }
        }
        int acceleration = this.getSpeedIncrease();
        if (getStackInSlot(6) == null) {
            if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(getStackInSlot(0), amountUsed * acceleration)) {
                return;
            }
            if (worldTime % 4 == 0) {
                SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
            }
            progress += acceleration;
            if (progress >= progressNeeded) {
                progress = 0;
                this.setInventorySlotContents(6, getResultingItemStack());
                ItemStack[] composedRecipe = new ItemStack[5];
                for (int i = 0; i < 5; i++) {
                    composedRecipe[i] = inv[i + 1];
                }
                this.decrementSlots(this.getRecipeForItems(composedRecipe, inv[0]));
                if (worldObj != null) {
                    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                }
            }
        } else if (getStackInSlot(6).getItem() == getResultingItemStack().getItem() && getResultingItemStack().stackSize <= (getStackInSlot(6).getMaxStackSize() - getStackInSlot(6).stackSize)) {
            if (worldTime % 4 == 0) {
                SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
            }
            if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(getStackInSlot(0), amountUsed * acceleration)) {
                return;
            }
            progress += acceleration;
            if (progress >= progressNeeded) {
                progress = 0;
                ItemStack result = getResultingItemStack().copy();
                result.stackSize += getStackInSlot(6).stackSize;
                this.setInventorySlotContents(6, result);
                ItemStack[] composedRecipe = new ItemStack[5];
                for (int i = 0; i < 5; i++) {
                    composedRecipe[i] = inv[i + 1];
                }
                this.decrementSlots(this.getRecipeForItems(composedRecipe, inv[0]));
                if (worldObj != null) {
                    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                }
            }
        }
    }
}
Also used : IFillingAgent(WayofTime.alchemicalWizardry.common.IFillingAgent) ICatalyst(WayofTime.alchemicalWizardry.common.ICatalyst) ItemStack(net.minecraft.item.ItemStack) AlchemyFlask(WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask)

Example 4 with AlchemyFlask

use of WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask in project BloodMagic by WayofTime.

the class CombinedPotionRegistry method hasCombinablePotionEffect.

public static boolean hasCombinablePotionEffect(ItemStack stack) {
    if (stack == null || !(stack.getItem() instanceof AlchemyFlask)) {
        return false;
    }
    List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
    if (list == null) {
        return false;
    }
    for (AlchemyPotionHelper helper1 : list) {
        for (AlchemyPotionHelper helper2 : list) {
            int pot1 = helper1.getPotionID();
            int pot2 = helper2.getPotionID();
            if (isRecipeValid(pot1, pot2)) {
                return true;
            }
        }
    }
    return false;
}
Also used : AlchemyPotionHelper(WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper) AlchemyFlask(WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask)

Aggregations

AlchemyFlask (WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask)4 AlchemyPotionHelper (WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper)2 ItemSpellMultiTool (WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool)1 ICatalyst (WayofTime.alchemicalWizardry.common.ICatalyst)1 IFillingAgent (WayofTime.alchemicalWizardry.common.IFillingAgent)1 BoundArmour (WayofTime.alchemicalWizardry.common.items.armour.BoundArmour)1 OmegaArmourEarth (WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourEarth)1 OmegaArmourFire (WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourFire)1 OmegaArmourWater (WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourWater)1 OmegaArmourWind (WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourWind)1 ItemAttunedCrystal (WayofTime.alchemicalWizardry.common.items.energy.ItemAttunedCrystal)1 ItemDestinationClearer (WayofTime.alchemicalWizardry.common.items.energy.ItemDestinationClearer)1 ItemTankSegmenter (WayofTime.alchemicalWizardry.common.items.energy.ItemTankSegmenter)1 AlchemyReagent (WayofTime.alchemicalWizardry.common.items.potion.AlchemyReagent)1 AverageLengtheningCatalyst (WayofTime.alchemicalWizardry.common.items.potion.AverageLengtheningCatalyst)1 AveragePowerCatalyst (WayofTime.alchemicalWizardry.common.items.potion.AveragePowerCatalyst)1 CombinationalCatalyst (WayofTime.alchemicalWizardry.common.items.potion.CombinationalCatalyst)1 EnhancedFillingAgent (WayofTime.alchemicalWizardry.common.items.potion.EnhancedFillingAgent)1 GreaterLengtheningCatalyst (WayofTime.alchemicalWizardry.common.items.potion.GreaterLengtheningCatalyst)1 GreaterPowerCatalyst (WayofTime.alchemicalWizardry.common.items.potion.GreaterPowerCatalyst)1