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;
|
2014-04-08 12:39:01 -07:00
|
|
|
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;
|
2013-05-22 00:42:49 -07:00
|
|
|
import forestry.api.genetics.IFlowerProvider;
|
|
|
|
|
import forestry.api.genetics.IIndividual;
|
2012-12-27 22:40:24 -08:00
|
|
|
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
|
|
|
{
|
2012-12-27 22:40:24 -08:00
|
|
|
boolean flag = false;
|
2014-04-08 12:39:01 -07:00
|
|
|
if (world.getBlock(x, i, j) == Blocks.bookshelf)
|
2012-12-27 22:40:24 -08:00
|
|
|
{
|
|
|
|
|
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
|
|
|
{
|
2012-12-27 22:40:24 -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
|
|
|
{
|
2012-12-27 22:40:24 -08:00
|
|
|
return products;
|
2012-12-24 15:12:37 -08:00
|
|
|
}
|
|
|
|
|
|
2012-12-27 22:40:24 -08:00
|
|
|
public ItemStack[] getItemStacks()
|
2012-12-24 15:12:37 -08:00
|
|
|
{
|
2014-04-08 12:39:01 -07: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
|
2012-12-27 22:40:24 -08:00
|
|
|
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable)
|
|
|
|
|
{
|
2013-04-21 15:38:52 -07:00
|
|
|
EnumSet<EnumPlantType> types = pollinatable.getPlantType();
|
2015-01-08 21:48:13 -08:00
|
|
|
return types.size() > 0 && !types.contains(EnumPlantType.Nether) && !types.contains(EnumPlantType.Water);
|
2012-12-27 22:40:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|