Reintroduce the old-style farm

This commit is contained in:
Nedelosk committed 2018-01-14 02:35:12 +01:00
1 parent 1fc56c3b20
commit cc50a05f43
135 files changed
+2483 -516

No files matched your search

@@ -0,0 +1,29 @@
package forestry.api.cultivation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.farming.IFarmInventory;
import forestry.api.farming.IFarmLogic;
import forestry.api.farming.IFarmable;
import forestry.api.genetics.IHousing;
public interface IPlanterHousing extends IHousing {
/**
* Callback for {@link IFarmLogic}s to plant a sapling, seed, germling, stem.
* Will remove the appropriate germling from the farm's inventory.
* It's up to the logic to only call this on a valid location.
*
* @return true if planting was successful, false otherwise.
*/
boolean plantGermling(IFarmable germling, World world, BlockPos pos);
/* INTERACTION WITH HATCHES */
IFarmInventory getFarmInventory();
/* LOGIC */
IFarmLogic getFarmLogic();
/* GUI */
int getStoredFertilizerScaled(int scale);
}
@@ -5,12 +5,14 @@
******************************************************************************/
package forestry.api.farming;
import forestry.api.core.IErrorLogicSource;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import forestry.api.core.IErrorLogicSource;
public interface IFarmHousing extends IErrorLogicSource {
BlockPos getCoords();
@@ -33,10 +35,32 @@ public interface IFarmHousing extends IErrorLogicSource {
* Will remove the appropriate germling from the farm's inventory.
* It's up to the logic to only call this on a valid location.
*
* @deprecated TODO remove this method in 1.13
*
* @return true if planting was successful, false otherwise.
*/
@Deprecated
boolean plantGermling(IFarmable farmable, World world, BlockPos pos);
/**
* Callback for {@link IFarmLogic}s to plant a sapling, seed, germling, stem.
* Will remove the appropriate germling from the farm's inventory.
* It's up to the logic to only call this on a valid location.
*
* @return true if planting was successful, false otherwise.
*/
default boolean plantGermling(IFarmable farmable, World world, BlockPos pos, FarmDirection direction){
return plantGermling(farmable, world, pos);
}
default boolean isValidPlatform(World world, BlockPos pos){
return false;
}
default boolean isSquare(){
return false;
}
/* INTERACTION WITH HATCHES */
IFarmInventory getFarmInventory();
@@ -27,4 +27,6 @@ public interface IFarmInventory {
IInventory getResourcesInventory();
IInventory getFertilizerInventory();
}
@@ -13,6 +13,7 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -35,12 +36,18 @@ public interface IFarmLogic {
IFarmLogic setManual(boolean manual);
void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData);
@SideOnly(Side.CLIENT)
ResourceLocation getTextureMap();
String getName();
/* GUI ONLY */
/**
* @deprecated TODO remove this method in 1.13
*/
@Deprecated
@SideOnly(Side.CLIENT)
ResourceLocation getTextureMap();
/**
* @return the itemStack that represents this farm logic. Used as an icon for the farm logic.
*/
@@ -14,7 +14,7 @@ public interface IFarmRegistry {
/**
* Registers farming logic in registry under given identifier
* @param identifier Valid identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
* @param identifier Valid identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
* @param logic corresponding instance of logic
*/
void registerFarmLogic(String identifier, IFarmLogic logic);
@@ -22,7 +22,7 @@ public interface IFarmRegistry {
/**
* Can be used to add IFarmables to some of the vanilla farm logics.
* <p>
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
* Identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
*/
void registerFarmables(String identifier, IFarmable... farmable);