Files
MagicBees/magicbees_src/magicbees/bees/FlowerProviderThaumcraftFlower.java
T
MysteriousAges 406132babc Adding Wither Skull crafting, sort of.
Loc string fixes
Escritoire work

... I really need to commit more often. :x
2013-06-04 13:26:44 -07:00

78 lines
2.0 KiB
Java

package magicbees.bees;
import magicbees.main.Config;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IFlowerProvider;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
public class FlowerProviderThaumcraftFlower implements IFlowerProvider
{
private ItemStack[] flowers = {new ItemStack(Config.tcPlant, 1, 2), new ItemStack(Config.tcPlant, 1, 3) };
@Override
public boolean isAcceptedFlower(World world, IIndividual genome, int x, int y, int z)
{
boolean flag = false;
if (world.getBlockId(x, y, z) == Config.tcPlant.blockID)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 2 || meta == 3)
{
flag = true;
}
}
return flag;
}
@Override
public boolean growFlower(World world, IIndividual genome, int x, int y, int z)
{
boolean flag = false;
int blockDown = world.getBlockId(x, y - 1, z);
if (world.getBlockId(x, y, z) == 0)
{
if (blockDown == Block.dirt.blockID || blockDown == Block.grass.blockID)
{
world.setBlockMetadataWithNotify(x, y, z, Config.tcPlant.blockID, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal());
flag = true;
}
else if (blockDown == Block.sand.blockID)
{
world.setBlockMetadataWithNotify(x, y, z, Config.tcPlant.blockID, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal());
flag = true;
}
}
return flag;
}
@Override
public String getDescription()
{
return LocalizationManager.getLocalizedString("flowerProvider.magic");
}
@Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products)
{
return products;
}
@Override
public ItemStack[] getItemStacks()
{
return this.flowers;
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable)
{
return pollinatable.getPlantType().size() > 1;
}
}