Search in sources :

Example 6 with ElementItem

use of minechem.item.element.ElementItem in project Minechem by iopleke.

the class RadiationMoleculeHandler method handleRadiationMoleculeBucket.

public RadiationInfo handleRadiationMoleculeBucket(World world, ItemStack itemStack, IInventory inventory, double x, double y, double z) {
    PotionChemical[] decayedChemicals = getDecayedMolecule((MoleculeEnum) ((MinechemBucketItem) itemStack.getItem()).chemical);
    for (int i = 0; i < decayedChemicals.length; i++) {
        decayedChemicals[i].amount *= 8 * itemStack.stackSize;
    }
    ItemStack[] items = toItemStacks(decayedChemicals);
    for (int i = 1; i < items.length; i++) {
        ItemStack stack = MinechemUtil.addItemToInventory(inventory, items[i]);
        if (stack != null) {
            MinechemUtil.throwItemStack(world, itemStack, x, y, z);
        }
    }
    Item item = items[0].getItem();
    if (item instanceof MoleculeItem) {
        itemStack.func_150996_a(MinechemBucketHandler.getInstance().buckets.get(FluidHelper.moleculeBlocks.get(FluidHelper.molecules.get(MoleculeItem.getMolecule(items[0])))));
    } else if (item instanceof ElementItem) {
        itemStack.func_150996_a(MinechemBucketHandler.getInstance().buckets.get(FluidHelper.elementsBlocks.get(FluidHelper.elements.get(ElementItem.getElement(items[0])))));
    }
    itemStack.stackSize = (items[0].stackSize / 8);
    itemStack.setTagCompound(items[0].stackTagCompound);
    return ElementItem.initiateRadioactivity(itemStack, world);
}
Also used : ElementItem(minechem.item.element.ElementItem) MinechemBucketItem(minechem.item.bucket.MinechemBucketItem) Item(net.minecraft.item.Item) ElementItem(minechem.item.element.ElementItem) MoleculeItem(minechem.item.molecule.MoleculeItem) MoleculeItem(minechem.item.molecule.MoleculeItem) MinechemBucketItem(minechem.item.bucket.MinechemBucketItem) PotionChemical(minechem.potion.PotionChemical) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ElementItem (minechem.item.element.ElementItem)6 ItemStack (net.minecraft.item.ItemStack)5 MoleculeItem (minechem.item.molecule.MoleculeItem)3 ItemAtomicManipulator (minechem.item.ItemAtomicManipulator)1 MinechemChemicalType (minechem.item.MinechemChemicalType)1 OpticalMicroscopeLens (minechem.item.OpticalMicroscopeLens)1 ItemBlueprint (minechem.item.blueprint.ItemBlueprint)1 MinechemBucketItem (minechem.item.bucket.MinechemBucketItem)1 ChemistJournalItem (minechem.item.chemistjournal.ChemistJournalItem)1 ElementEnum (minechem.item.element.ElementEnum)1 MoleculeEnum (minechem.item.molecule.MoleculeEnum)1 PolytoolItem (minechem.item.polytool.PolytoolItem)1 PolytoolUpdateMessage (minechem.network.message.PolytoolUpdateMessage)1 PotionChemical (minechem.potion.PotionChemical)1 RadiationFluidTileEntity (minechem.radiation.RadiationFluidTileEntity)1 RadiationInfo (minechem.radiation.RadiationInfo)1 Block (net.minecraft.block.Block)1 IInventory (net.minecraft.inventory.IInventory)1 Slot (net.minecraft.inventory.Slot)1 Item (net.minecraft.item.Item)1