Files
ForestryMC/src/main/java/forestry/api/farming/IFarmable.java
T
temp1011 13905ee4a9 merge (#1)
* Reintroduce the old-style farm

* Remove Unused Files

* Fix #1945 Database duping trees / bees

* Fix broken model baker uvs

* Improve Farm Logic System and add ring farm layout

* Rebalance electron tubes and add ender farm

* Improve fertilizer config and Clean Up

* Clean Up API

* Add missing farm logic localisation

* Add missing fluid handler capability to the planter

* Remove unneeded GL state changes

* Update Lang

* Fix #1955 Add Filter Sorting to fix a server sided bug

* Make cultivation farms more expensive

* Round fertilizer values

* Add deprecated circuit replacement and Version 5.8
2018-02-03 11:55:03 +00:00

62 lines
2.2 KiB
Java

/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.farming;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
* IFarmable describes a crop or other harvestable object and can be used to inspect item stacks and blocks for matches.
*/
public interface IFarmable {
/**
* @return true if the block at the given location is a "sapling" for this type, i.e. a non-harvestable immature version of the crop.
* @deprecated Since Forestry 5.8. Use the version below. TODO Remove this method in 1.13
*/
@Deprecated
default boolean isSaplingAt(World world, BlockPos pos){
return false;
}
/**
* @return true if the block at the given location is a "sapling" for this type, i.e. a non-harvestable immature version of the crop.
*/
default boolean isSaplingAt(World world, BlockPos pos, IBlockState blockState){
return isSaplingAt(world, pos);
}
/**
* @return {@link ICrop} if the block at the given location is a harvestable and mature crop, null otherwise.
*/
@Nullable
ICrop getCropAt(World world, BlockPos pos, IBlockState blockState);
/**
* @return true if the item is a valid germling (plantable sapling, seed, etc.) for this type.
*/
boolean isGermling(ItemStack itemstack);
/**
* @return true if the item is something that can drop from this type without actually being harvested as a crop. (Apples or sapling from decaying leaves.)
*/
boolean isWindfall(ItemStack itemstack);
/**
* Plants a sapling by manipulating the world. The {@link IFarmLogic} should have verified the given location as valid. Called by the {@link IFarmHousing}
* which handles resources.
*
* @return true on success, false otherwise.
*/
boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos);
}