Java Examples for WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler

The following java examples will help you to understand the usage of WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler. These source code samples are taken from different open source projects.

Example 1
Project: PneumaticCraft-master  File: BloodMagic.java View source code
@Override
public void preInit() {
    HarvestRegistry.registerHarvestHandler(new IHarvestHandler() {

        @Override
        public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) {
            List<ItemStack> seeds = new ArrayList<ItemStack>();
            ((ItemPlasticPlants) Itemss.plasticPlant).addSubItems(seeds);
            for (ItemStack seed : seeds) {
                Block plantBlock = ItemPlasticPlants.getPlantBlockIDFromSeed(seed.getItemDamage());
                if (block == plantBlock && (meta == 6 || meta == 13)) {
                    if (!world.isRemote) {
                        List<ItemStack> drops = block.getDrops(world, xCoord, yCoord, zCoord, meta, 0);
                        if (drops.size() == 2) {
                            world.spawnEntityInWorld(new EntityItem(world, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, drops.get(1)));
                        }
                        world.func_147480_a(xCoord, yCoord, zCoord, false);
                        world.setBlock(xCoord, yCoord, zCoord, block);
                    }
                    return true;
                }
            }
            return false;
        }
    });
}