Files
MagicBees/src/main/java/magicbees/bees/FlowerProviderBookshelf.java
T

57 lines
1.5 KiB
Java
Raw Normal View History

2013-05-23 21:07:28 -07:00
package magicbees.bees;
2012-12-24 15:12:37 -08:00
2013-04-21 15:38:52 -07:00
import java.util.EnumSet;
2013-05-23 21:07:28 -07:00
import magicbees.main.utils.LocalizationManager;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
2012-12-24 15:12:37 -08:00
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
2013-04-21 15:38:52 -07:00
import net.minecraftforge.common.EnumPlantType;
2012-12-24 15:12:37 -08:00
import forestry.api.apiculture.IBeeGenome;
2013-05-22 00:42:49 -07:00
import forestry.api.genetics.IFlowerProvider;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
2012-12-24 15:12:37 -08:00
public class FlowerProviderBookshelf implements IFlowerProvider
{
2013-05-22 00:42:49 -07:00
public boolean isAcceptedFlower(World world, IIndividual genome, int x, int i, int j)
2012-12-24 15:12:37 -08:00
{
boolean flag = false;
if (world.getBlock(x, i, j) == Blocks.bookshelf)
{
flag = true;
}
return flag;
2012-12-24 15:12:37 -08:00
}
2013-05-22 00:42:49 -07:00
public boolean growFlower(World world, IIndividual genome, int x, int i, int j)
2012-12-24 15:12:37 -08:00
{
// Always return true so the system thinks we grew a flower.
// Bees can't grow bookshelves! Are you crazy?!
return true;
2012-12-24 15:12:37 -08:00
}
2013-05-22 00:42:49 -07:00
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int i, int j, ItemStack products[])
2012-12-24 15:12:37 -08:00
{
return products;
2012-12-24 15:12:37 -08:00
}
public ItemStack[] getItemStacks()
2012-12-24 15:12:37 -08:00
{
return new ItemStack[] { new ItemStack(Blocks.bookshelf) };
2012-12-24 15:12:37 -08:00
}
2013-04-21 15:38:52 -07:00
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable)
{
2013-04-21 15:38:52 -07:00
EnumSet<EnumPlantType> types = pollinatable.getPlantType();
return types.size() > 0 && !types.contains(EnumPlantType.Nether) && !types.contains(EnumPlantType.Water) ;
}
public String getDescription()
2012-12-24 15:12:37 -08:00
{
2013-06-04 13:26:44 -07:00
return LocalizationManager.getLocalizedString("flowerProvider.book");
2012-12-24 15:12:37 -08:00
}
}