diff --git a/lang b/lang
index f26fbe9da..cf9f2c21f 160000
--- a/lang
+++ b/lang
@@ -1 +1 @@
-Subproject commit f26fbe9da8874b36881c9b1fe69f0e29ec768603
+Subproject commit cf9f2c21f53e6ad4ce180bdccf258ff7e717ce94
diff --git a/src/main/java/forestry/api/cultivation/IPlanterHousing.java b/src/main/java/forestry/api/cultivation/IPlanterHousing.java
new file mode 100644
index 000000000..3d1a4a1c8
--- /dev/null
+++ b/src/main/java/forestry/api/cultivation/IPlanterHousing.java
@@ -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);
+}
diff --git a/src/main/java/forestry/api/farming/IFarmHousing.java b/src/main/java/forestry/api/farming/IFarmHousing.java
index ba5708d9e..cc19ebd9f 100644
--- a/src/main/java/forestry/api/farming/IFarmHousing.java
+++ b/src/main/java/forestry/api/farming/IFarmHousing.java
@@ -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();
diff --git a/src/main/java/forestry/api/farming/IFarmInventory.java b/src/main/java/forestry/api/farming/IFarmInventory.java
index 7f9a793d8..0d08dbc22 100644
--- a/src/main/java/forestry/api/farming/IFarmInventory.java
+++ b/src/main/java/forestry/api/farming/IFarmInventory.java
@@ -27,4 +27,6 @@ public interface IFarmInventory {
IInventory getResourcesInventory();
IInventory getFertilizerInventory();
+
+
}
diff --git a/src/main/java/forestry/api/farming/IFarmLogic.java b/src/main/java/forestry/api/farming/IFarmLogic.java
index 03fa75cd8..873fcc353 100644
--- a/src/main/java/forestry/api/farming/IFarmLogic.java
+++ b/src/main/java/forestry/api/farming/IFarmLogic.java
@@ -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.
*/
diff --git a/src/main/java/forestry/api/farming/IFarmRegistry.java b/src/main/java/forestry/api/farming/IFarmRegistry.java
index 9119a990f..0b8d8bb9a 100644
--- a/src/main/java/forestry/api/farming/IFarmRegistry.java
+++ b/src/main/java/forestry/api/farming/IFarmRegistry.java
@@ -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.
*
- * Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
+ * Identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
*/
void registerFarmables(String identifier, IFarmable... farmable);
diff --git a/src/main/java/forestry/core/blocks/BlockBase.java b/src/main/java/forestry/core/blocks/BlockBase.java
index 366c5fba2..1922d22ca 100755
--- a/src/main/java/forestry/core/blocks/BlockBase.java
+++ b/src/main/java/forestry/core/blocks/BlockBase.java
@@ -20,6 +20,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@@ -40,8 +41,11 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import com.mojang.authlib.GameProfile;
+
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fluids.FluidUtil;
+
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -51,6 +55,8 @@ import forestry.api.core.ISpriteRegister;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.ITextureManager;
import forestry.core.circuits.ISocketable;
+import forestry.core.owner.IOwnedTile;
+import forestry.core.owner.IOwnerHandler;
import forestry.core.render.MachineParticleCallback;
import forestry.core.render.MachineStateMapper;
import forestry.core.render.ParticleHelper;
@@ -212,6 +218,22 @@ public class BlockBase
& IBlockType & IStringSerializable> ext
super.breakBlock(world, pos, state);
}
+ @Override
+ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
+ if (world.isRemote) {
+ return;
+ }
+
+ if (placer instanceof EntityPlayer) {
+ TileUtil.actOnTile(world, pos, IOwnedTile.class, tile -> {
+ IOwnerHandler ownerHandler = tile.getOwnerHandler();
+ EntityPlayer player = (EntityPlayer) placer;
+ GameProfile gameProfile = player.getGameProfile();
+ ownerHandler.setOwner(gameProfile);
+ });
+ }
+ }
+
public void init() {
blockType.getMachineProperties().registerTileEntity();
}
diff --git a/src/main/java/forestry/core/circuits/Circuits.java b/src/main/java/forestry/core/circuits/Circuits.java
index cecbb5c96..b45a1b1e3 100644
--- a/src/main/java/forestry/core/circuits/Circuits.java
+++ b/src/main/java/forestry/core/circuits/Circuits.java
@@ -10,8 +10,7 @@ public class Circuits {
public static ICircuit energyElectricBoost2;
public static ICircuit farmArborealManaged;
public static ICircuit farmShroomManaged;
- public static ICircuit farmCerealManaged;
- public static ICircuit farmVegetableManaged;
+ public static ICircuit farmCropsManaged;
public static ICircuit farmPeatManaged;
public static ICircuit farmSucculentManaged;
public static ICircuit farmPoaleManaged;
@@ -19,8 +18,7 @@ public class Circuits {
public static ICircuit farmInfernalManaged;
public static ICircuit farmGourdManaged;
public static ICircuit farmShroomManual;
- public static ICircuit farmCerealManual;
- public static ICircuit farmVegetableManual;
+ public static ICircuit farmCropsManual;
public static ICircuit farmPeatManual;
public static ICircuit farmSucculentManual;
public static ICircuit farmPoalesManual;
diff --git a/src/main/java/forestry/core/gui/GuiIdRegistry.java b/src/main/java/forestry/core/gui/GuiIdRegistry.java
index ff87193c6..62e1a5625 100644
--- a/src/main/java/forestry/core/gui/GuiIdRegistry.java
+++ b/src/main/java/forestry/core/gui/GuiIdRegistry.java
@@ -30,6 +30,7 @@ import forestry.core.items.ItemSolderingIron;
import forestry.core.tiles.TileAnalyzer;
import forestry.core.tiles.TileEscritoire;
import forestry.core.tiles.TileNaturalistChest;
+import forestry.cultivation.tiles.TilePlanter;
import forestry.database.tiles.TileDatabase;
import forestry.energy.tiles.TileEngineBiogas;
import forestry.energy.tiles.TileEngineElectric;
@@ -90,6 +91,8 @@ public class GuiIdRegistry {
TileFarm.class,
+ TilePlanter.class,
+
TileGreenhouse.class,
TileClimatiser.class,
TileHygroregulator.class,
diff --git a/src/main/java/forestry/core/network/packets/PacketGuiUpdate.java b/src/main/java/forestry/core/network/packets/PacketGuiUpdate.java
index d29541117..0e84e46ad 100644
--- a/src/main/java/forestry/core/network/packets/PacketGuiUpdate.java
+++ b/src/main/java/forestry/core/network/packets/PacketGuiUpdate.java
@@ -12,6 +12,12 @@ package forestry.core.network.packets;
import java.io.IOException;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.math.BlockPos;
+
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+
import forestry.api.core.ILocatable;
import forestry.core.network.ForestryPacket;
import forestry.core.network.IForestryPacketClient;
@@ -20,10 +26,6 @@ import forestry.core.network.IStreamableGui;
import forestry.core.network.PacketBufferForestry;
import forestry.core.network.PacketIdClient;
import forestry.core.tiles.TileUtil;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.util.math.BlockPos;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
public class PacketGuiUpdate extends ForestryPacket implements IForestryPacketClient {
private final BlockPos pos;
diff --git a/src/main/java/forestry/core/utils/VectUtil.java b/src/main/java/forestry/core/utils/VectUtil.java
index 4b0394fb7..64917ed1d 100644
--- a/src/main/java/forestry/core/utils/VectUtil.java
+++ b/src/main/java/forestry/core/utils/VectUtil.java
@@ -10,11 +10,12 @@
******************************************************************************/
package forestry.core.utils;
+import com.google.common.collect.AbstractIterator;
+
import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.Random;
-import com.google.common.collect.AbstractIterator;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
diff --git a/src/main/java/forestry/cultivation/ModuleCultivation.java b/src/main/java/forestry/cultivation/ModuleCultivation.java
new file mode 100644
index 000000000..28c23703f
--- /dev/null
+++ b/src/main/java/forestry/cultivation/ModuleCultivation.java
@@ -0,0 +1,117 @@
+package forestry.cultivation;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableSet;
+
+import javax.annotation.Nullable;
+import java.util.Set;
+
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.util.ResourceLocation;
+
+import forestry.api.modules.ForestryModule;
+import forestry.core.ModuleCore;
+import forestry.core.circuits.EnumCircuitBoardType;
+import forestry.core.config.Constants;
+import forestry.core.items.EnumElectronTube;
+import forestry.core.items.ItemRegistryCore;
+import forestry.core.recipes.RecipeUtil;
+import forestry.core.utils.OreDictUtil;
+import forestry.cultivation.blocks.BlockRegistryCultivation;
+import forestry.modules.BlankForestryModule;
+import forestry.modules.ForestryModuleUids;
+
+@ForestryModule(containerID = Constants.MOD_ID, moduleID = ForestryModuleUids.CULTIVATION, name = "Cultivation", author = "Nedelosk", url = Constants.URL, unlocalizedDescription = "for.module.cultivation.description")
+public class ModuleCultivation extends BlankForestryModule {
+ @Nullable
+ private static BlockRegistryCultivation blocks;
+
+ public static BlockRegistryCultivation getBlocks() {
+ Preconditions.checkState(blocks != null);
+ return blocks;
+ }
+
+ @Override
+ public void registerItemsAndBlocks() {
+ blocks = new BlockRegistryCultivation();
+ }
+
+ @Override
+ public Set getDependencyUids() {
+ return ImmutableSet.of(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.CORE),
+ new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING));
+ }
+
+ @Override
+ public void doInit() {
+ BlockRegistryCultivation blocks = getBlocks();
+
+ blocks.arboretum.init();
+ blocks.farmCrops.init();
+ blocks.farmMushroom.init();
+ blocks.farmNether.init();
+ blocks.farmGourd.init();
+ //blocks.plantation.init();
+ blocks.peatBog.init();
+ }
+
+ @Override
+ public void registerRecipes() {
+ BlockRegistryCultivation blocks = getBlocks();
+ ItemRegistryCore coreItems = ModuleCore.getItems();
+
+ RecipeUtil.addRecipe("arboretum", blocks.arboretum,
+ "GTG",
+ "TCT",
+ "GBG",
+ 'G', OreDictUtil.BLOCK_GLASS,
+ 'T', coreItems.tubes.get(EnumElectronTube.GOLD, 1),
+ 'C', coreItems.sturdyCasing,
+ 'B', coreItems.circuitboards.get(EnumCircuitBoardType.BASIC));
+
+ RecipeUtil.addRecipe("farm_crops", blocks.farmCrops,
+ "GTG",
+ "TCT",
+ "GBG",
+ 'G', OreDictUtil.BLOCK_GLASS,
+ 'T', coreItems.tubes.get(EnumElectronTube.BRONZE, 1),
+ 'C', coreItems.sturdyCasing,
+ 'B', coreItems.circuitboards.get(EnumCircuitBoardType.BASIC));
+
+ RecipeUtil.addRecipe("peat_bog", blocks.peatBog,
+ "GTG",
+ "TCT",
+ "GBG",
+ 'G', OreDictUtil.BLOCK_GLASS,
+ 'T', coreItems.tubes.get(EnumElectronTube.COPPER, 1),
+ 'C', coreItems.sturdyCasing,
+ 'B', coreItems.circuitboards.get(EnumCircuitBoardType.BASIC));
+
+ RecipeUtil.addRecipe("farm_mushroom", blocks.farmMushroom,
+ "BGR",
+ "GAG",
+ "RGB",
+ 'G', OreDictUtil.BLOCK_GLASS,
+ 'B', Blocks.BROWN_MUSHROOM,
+ 'R', Blocks.RED_MUSHROOM,
+ 'A', blocks.arboretum);
+
+ RecipeUtil.addRecipe("farm_gourd", blocks.farmGourd,
+ "MGP",
+ "GAG",
+ "PGM",
+ 'G', OreDictUtil.BLOCK_GLASS,
+ 'M', Blocks.MELON_BLOCK,
+ 'P', Blocks.PUMPKIN,
+ 'A', blocks.arboretum);
+
+ RecipeUtil.addRecipe("farm_nether", blocks.farmNether,
+ "WGW",
+ "GAG",
+ "WGW",
+ 'G', OreDictUtil.BLOCK_GLASS,
+ 'W', Items.NETHER_WART,
+ 'A', blocks.arboretum);
+ }
+}
diff --git a/src/main/java/forestry/cultivation/blocks/BlockPlanter.java b/src/main/java/forestry/cultivation/blocks/BlockPlanter.java
new file mode 100644
index 000000000..5f56462b9
--- /dev/null
+++ b/src/main/java/forestry/cultivation/blocks/BlockPlanter.java
@@ -0,0 +1,17 @@
+package forestry.cultivation.blocks;
+
+import net.minecraft.block.material.Material;
+import net.minecraft.util.BlockRenderLayer;
+
+import forestry.core.blocks.BlockBase;
+
+public class BlockPlanter extends BlockBase {
+ public BlockPlanter(BlockTypePlanter blockType) {
+ super(blockType, Material.WOOD);
+ }
+
+ @Override
+ public BlockRenderLayer getBlockLayer() {
+ return BlockRenderLayer.CUTOUT;
+ }
+}
diff --git a/src/main/java/forestry/cultivation/blocks/BlockRegistryCultivation.java b/src/main/java/forestry/cultivation/blocks/BlockRegistryCultivation.java
new file mode 100644
index 000000000..07d8f9516
--- /dev/null
+++ b/src/main/java/forestry/cultivation/blocks/BlockRegistryCultivation.java
@@ -0,0 +1,31 @@
+package forestry.cultivation.blocks;
+
+import forestry.core.blocks.BlockRegistry;
+import forestry.core.items.ItemBlockForestry;
+
+public class BlockRegistryCultivation extends BlockRegistry {
+ public final BlockPlanter arboretum;
+ public final BlockPlanter farmCrops;
+ public final BlockPlanter farmMushroom;
+ public final BlockPlanter farmGourd;
+ public final BlockPlanter farmNether;
+ public final BlockPlanter peatBog;
+ /*public final BlockPlanter plantation;*/
+
+ public BlockRegistryCultivation() {
+ arboretum = new BlockPlanter(BlockTypePlanter.ARBORETUM);
+ registerBlock(arboretum, new ItemBlockForestry<>(arboretum), "arboretum");
+ farmCrops = new BlockPlanter(BlockTypePlanter.FARM_CROPS);
+ registerBlock(farmCrops, new ItemBlockForestry<>(farmCrops), "farm_crops");
+ farmMushroom = new BlockPlanter(BlockTypePlanter.FARM_MUSHROOM);
+ registerBlock(farmMushroom, new ItemBlockForestry<>(farmMushroom), "farm_mushroom");
+ farmGourd = new BlockPlanter(BlockTypePlanter.FARM_GOURD);
+ registerBlock(farmGourd, new ItemBlockForestry<>(farmGourd), "farm_gourd");
+ farmNether = new BlockPlanter(BlockTypePlanter.FARM_NETHER);
+ registerBlock(farmNether, new ItemBlockForestry<>(farmNether), "farm_nether");
+ peatBog = new BlockPlanter(BlockTypePlanter.PEAT_POG);
+ registerBlock(peatBog, new ItemBlockForestry<>(peatBog), "peat_bog");
+ /* plantation = new BlockPlanter(BlockTypePlanter.PLANTATION);
+ registerBlock(plantation, new ItemBlockForestry<>(plantation), "plantation");*/
+ }
+}
diff --git a/src/main/java/forestry/cultivation/blocks/BlockTypePlanter.java b/src/main/java/forestry/cultivation/blocks/BlockTypePlanter.java
new file mode 100644
index 000000000..a2871d288
--- /dev/null
+++ b/src/main/java/forestry/cultivation/blocks/BlockTypePlanter.java
@@ -0,0 +1,40 @@
+package forestry.cultivation.blocks;
+
+import forestry.core.blocks.IBlockTypeCustom;
+import forestry.core.blocks.IMachineProperties;
+import forestry.core.blocks.MachineProperties;
+import forestry.core.tiles.TileForestry;
+import forestry.cultivation.tiles.TileArboretum;
+import forestry.cultivation.tiles.TileBog;
+import forestry.cultivation.tiles.TileFarmCrops;
+import forestry.cultivation.tiles.TileFarmGourd;
+import forestry.cultivation.tiles.TileFarmMushroom;
+import forestry.cultivation.tiles.TileFarmNether;
+
+public enum BlockTypePlanter implements IBlockTypeCustom {
+ ARBORETUM(TileArboretum.class, "arboretum"),
+ FARM_CROPS(TileFarmCrops.class, "farm_crop"),
+ FARM_MUSHROOM(TileFarmMushroom.class, "farm_mushroom"),
+ FARM_GOURD(TileFarmGourd.class, "farm_gourd"),
+ FARM_NETHER(TileFarmNether.class, "farm_nether"),
+ PEAT_POG(TileBog.class, "peat_bog"),
+
+ //TODO Add ic2 integration
+ /*PLANTATION(TilePlantation.class, "plantation")*/;
+
+ private final IMachineProperties machineProperties;
+
+ BlockTypePlanter(Class teClass, String name) {
+ this.machineProperties = new MachineProperties<>(teClass, name);
+ }
+
+ @Override
+ public IMachineProperties getMachineProperties() {
+ return machineProperties;
+ }
+
+ @Override
+ public String getName() {
+ return getMachineProperties().getName();
+ }
+}
diff --git a/src/main/java/forestry/cultivation/blocks/package-info.java b/src/main/java/forestry/cultivation/blocks/package-info.java
new file mode 100644
index 000000000..b9d177317
--- /dev/null
+++ b/src/main/java/forestry/cultivation/blocks/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.cultivation.blocks;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/cultivation/gui/ContainerPlanter.java b/src/main/java/forestry/cultivation/gui/ContainerPlanter.java
new file mode 100644
index 000000000..ec66f1eeb
--- /dev/null
+++ b/src/main/java/forestry/cultivation/gui/ContainerPlanter.java
@@ -0,0 +1,50 @@
+package forestry.cultivation.gui;
+
+import net.minecraft.entity.player.InventoryPlayer;
+
+import forestry.core.gui.ContainerLiquidTanks;
+import forestry.core.gui.slots.SlotFiltered;
+import forestry.core.gui.slots.SlotLiquidIn;
+import forestry.core.gui.slots.SlotOutput;
+import forestry.core.network.packets.PacketGuiUpdate;
+import forestry.cultivation.inventory.InventoryPlanter;
+import forestry.cultivation.tiles.TilePlanter;
+
+public class ContainerPlanter extends ContainerLiquidTanks {
+ public ContainerPlanter(TilePlanter tileForestry, InventoryPlayer playerInventory) {
+ super(tileForestry, playerInventory, 21, 110);
+
+ // Resources
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < 2; j++) {
+ addSlotToContainer(new SlotFiltered(tile.getInternalInventory(), InventoryPlanter.SLOT_RESOURCES_1 + j + i * 2, 11 + j * 18, 65 + i * 18));
+ }
+ }
+
+ // Germlings
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < 2; j++) {
+ addSlotToContainer(new SlotFiltered(tile.getInternalInventory(), InventoryPlanter.SLOT_GERMLINGS_1 + j + i * 2, 71 + j * 18, 65 + i * 18));
+ }
+ }
+
+ // Production
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < 2; j++) {
+ addSlotToContainer(new SlotOutput(tile.getInternalInventory(), InventoryPlanter.SLOT_PRODUCTION_1 + j + i * 2, 131 + j * 18, 65 + i * 18));
+ }
+ }
+
+ // Fertilizer
+ addSlotToContainer(new SlotFiltered(tile.getInternalInventory(), InventoryPlanter.SLOT_FERTILIZER, 83, 22));
+ // Can Slot
+ addSlotToContainer(new SlotLiquidIn(tile.getInternalInventory(), InventoryPlanter.SLOT_CAN, 178, 18));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ PacketGuiUpdate packet = new PacketGuiUpdate(tile);
+ sendPacketToListeners(packet);
+ }
+}
diff --git a/src/main/java/forestry/cultivation/gui/GuiPlanter.java b/src/main/java/forestry/cultivation/gui/GuiPlanter.java
new file mode 100644
index 000000000..eadaf7eaa
--- /dev/null
+++ b/src/main/java/forestry/cultivation/gui/GuiPlanter.java
@@ -0,0 +1,81 @@
+package forestry.cultivation.gui;
+
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+import forestry.core.ModuleCore;
+import forestry.core.config.Constants;
+import forestry.core.gui.GuiForestryTitled;
+import forestry.core.gui.widgets.TankWidget;
+import forestry.cultivation.gui.widgets.GhostItemStackWidget;
+import forestry.cultivation.inventory.InventoryPlanter;
+import forestry.cultivation.tiles.TilePlanter;
+import forestry.farming.gui.FarmLedger;
+
+public class GuiPlanter extends GuiForestryTitled {
+ private final TilePlanter tile;
+
+ public GuiPlanter(TilePlanter tile, InventoryPlayer playerInventory) {
+ super(Constants.TEXTURE_PATH_GUI + "/planter.png", new ContainerPlanter(tile, playerInventory), tile);
+ this.tile = tile;
+ this.xSize = 202;
+ this.ySize = 192;
+
+ ItemStack[] resourceStacks = tile.createResourceStacks();
+ ItemStack[] germlingStacks = tile.createGermlingStacks();
+ ItemStack[] productionStacks = tile.createProductionStacks();
+
+ widgetManager.add(new TankWidget(widgetManager, 178, 44, 0).setOverlayOrigin(xSize, 18));
+
+ // Resources
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < 2; j++) {
+ int index = j + i * 2;
+ if(resourceStacks.length == 4) {
+ widgetManager.add(new GhostItemStackWidget(widgetManager, 11 + j * 18, 65 + i * 18, resourceStacks[index], inventorySlots.getSlot(36 + InventoryPlanter.SLOT_RESOURCES_1 + index)));
+ }
+ }
+ }
+
+ // Germlings
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < 2; j++) {
+ int index = j + i * 2;
+ if(germlingStacks.length == 4){
+ widgetManager.add(new GhostItemStackWidget(widgetManager, 71 + j * 18, 65 + i * 18, germlingStacks[index], inventorySlots.getSlot(36 + InventoryPlanter.SLOT_GERMLINGS_1 + index)));
+ }
+ }
+ }
+
+ // Production
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < 2; j++) {
+ int index = j + i * 2;
+ if(productionStacks.length == 4) {
+ widgetManager.add(new GhostItemStackWidget(widgetManager, 131 + j * 18, 65 + i * 18, productionStacks[index], inventorySlots.getSlot(36 + InventoryPlanter.SLOT_PRODUCTION_1 + j + i * 2)));
+ }
+ }
+ }
+
+ widgetManager.add(new GhostItemStackWidget(widgetManager, 83, 22, new ItemStack(ModuleCore.getItems().fertilizerCompound), inventorySlots.getSlot(36 + InventoryPlanter.SLOT_FERTILIZER)));
+ }
+
+ @Override
+ protected void addLedgers() {
+ addErrorLedger(tile);
+ addClimateLedger(tile);
+ ledgerManager.add(new FarmLedger(ledgerManager, tile.getFarmLedgerDelegate()));
+ addOwnerLedger(tile);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
+ super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
+
+ // Fuel remaining
+ int fertilizerRemain = tile.getStoredFertilizerScaled(16);
+ if (fertilizerRemain > 0) {
+ drawTexturedModalRect(guiLeft + 101, guiTop + 21 + 17 - fertilizerRemain, xSize, 17 - fertilizerRemain, 4, fertilizerRemain);
+ }
+ }
+}
diff --git a/src/main/java/forestry/cultivation/gui/package-info.java b/src/main/java/forestry/cultivation/gui/package-info.java
new file mode 100644
index 000000000..a8015890e
--- /dev/null
+++ b/src/main/java/forestry/cultivation/gui/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.cultivation.gui;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/cultivation/gui/widgets/GhostItemStackWidget.java b/src/main/java/forestry/cultivation/gui/widgets/GhostItemStackWidget.java
new file mode 100644
index 000000000..0a4ef4641
--- /dev/null
+++ b/src/main/java/forestry/cultivation/gui/widgets/GhostItemStackWidget.java
@@ -0,0 +1,69 @@
+package forestry.cultivation.gui.widgets;
+
+import javax.annotation.Nullable;
+import java.util.Locale;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.renderer.texture.TextureManager;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+import forestry.api.farming.FarmDirection;
+import forestry.core.gui.tooltips.ToolTip;
+import forestry.core.gui.widgets.ItemStackWidget;
+import forestry.core.gui.widgets.WidgetManager;
+import forestry.core.render.ColourProperties;
+import forestry.core.utils.Translator;
+import forestry.cultivation.inventory.InventoryPlanter;
+import org.lwjgl.opengl.GL11;
+
+public class GhostItemStackWidget extends ItemStackWidget {
+ private final Slot slot;
+ public GhostItemStackWidget(WidgetManager widgetManager, int xPos, int yPos, ItemStack itemStack, Slot slot) {
+ super(widgetManager, xPos, yPos, itemStack);
+ this.slot = slot;
+ }
+
+ @Override
+ public void draw(int startX, int startY) {
+ if (!slot.getHasStack()) {
+ super.draw(startX, startY);
+ }
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
+ GL11.glEnable(GL11.GL_BLEND);
+
+ String directionString = getDirectionString();
+ if (!directionString.isEmpty()){
+ FontRenderer fontRenderer = manager.minecraft.fontRenderer;
+ fontRenderer.drawStringWithShadow(getDirectionString(), xPos + startX + 5, yPos + startY + 4, ColourProperties.INSTANCE.get("gui.screen"));
+ }
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.85F);
+
+ TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
+ textureManager.bindTexture(manager.gui.textureFile);
+ manager.gui.drawTexturedModalRect(xPos + startX, yPos + startY, 206, 0, 16, 16);
+
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_DEPTH_TEST);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ }
+
+ private String getDirectionString(){
+ if(slot.getSlotIndex() >= InventoryPlanter.SLOT_PRODUCTION_1 || slot.getSlotIndex() < InventoryPlanter.SLOT_RESOURCES_1 + InventoryPlanter.SLOT_RESOURCES_COUNT){
+ return "";
+ }
+ int index = slot.getSlotIndex() % 4;
+ FarmDirection direction = FarmDirection.values()[index];
+ String directionString = direction.toString().toLowerCase(Locale.ENGLISH);
+ return Translator.translateToLocal("for.gui.planter." + directionString);
+ }
+
+ @Nullable
+ @Override
+ public ToolTip getToolTip(int mouseX, int mouseY) {
+ return null;
+ }
+}
diff --git a/src/main/java/forestry/cultivation/gui/widgets/package-info.java b/src/main/java/forestry/cultivation/gui/widgets/package-info.java
new file mode 100644
index 000000000..13aec40b2
--- /dev/null
+++ b/src/main/java/forestry/cultivation/gui/widgets/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.cultivation.gui.widgets;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/cultivation/inventory/InventoryPlanter.java b/src/main/java/forestry/cultivation/inventory/InventoryPlanter.java
new file mode 100644
index 000000000..09267c68e
--- /dev/null
+++ b/src/main/java/forestry/cultivation/inventory/InventoryPlanter.java
@@ -0,0 +1,220 @@
+package forestry.cultivation.inventory;
+
+import java.util.Stack;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.NonNullList;
+import net.minecraft.util.math.BlockPos;
+
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidUtil;
+
+import forestry.api.core.ForestryAPI;
+import forestry.api.cultivation.IPlanterHousing;
+import forestry.api.farming.FarmDirection;
+import forestry.api.farming.IFarmLogic;
+import forestry.api.farming.IFarmable;
+import forestry.core.fluids.FluidHelper;
+import forestry.core.fluids.TankManager;
+import forestry.core.inventory.InventoryAdapterRestricted;
+import forestry.core.inventory.wrappers.InventoryMapper;
+import forestry.core.tiles.ILiquidTankTile;
+import forestry.core.utils.InventoryUtil;
+import forestry.core.utils.SlotUtil;
+import forestry.farming.multiblock.IFarmInventoryInternal;
+
+public class InventoryPlanter extends InventoryAdapterRestricted implements IFarmInventoryInternal {
+ public static final int SLOT_RESOURCES_1 = 0;
+ public static final int SLOT_RESOURCES_COUNT = 4;
+ public static final int SLOT_GERMLINGS_1 = 4;
+ public static final int SLOT_GERMLINGS_COUNT = 4;
+ public static final int SLOT_PRODUCTION_1 = 8;
+ public static final int SLOT_PRODUCTION_COUNT = 4;
+
+ public static final int SLOT_FERTILIZER = 12;
+ public static final int SLOT_FERTILIZER_COUNT = 1;
+ public static final int SLOT_CAN = 13;
+ public static final int SLOT_CAN_COUNT = 1;
+
+ public static final int SLOT_COUNT = SLOT_RESOURCES_COUNT + SLOT_GERMLINGS_COUNT + SLOT_PRODUCTION_COUNT + SLOT_FERTILIZER_COUNT + SLOT_CAN_COUNT;
+
+ private static final int FERTILIZER_MODIFIER = ForestryAPI.activeMode.getIntegerSetting("farms.fertilizer.modifier");
+
+ private final IPlanterHousing housing;
+
+ private final IInventory resourcesInventory;
+ private final IInventory germlingsInventory;
+ private final IInventory productInventory;
+ private final IInventory fertilizerInventory;
+
+ public InventoryPlanter(IPlanterHousing housing) {
+ super(SLOT_COUNT, "Items");
+ this.housing = housing;
+
+ this.resourcesInventory = new InventoryMapper(this, SLOT_RESOURCES_1, SLOT_RESOURCES_COUNT);
+ this.germlingsInventory = new InventoryMapper(this, SLOT_GERMLINGS_1, SLOT_GERMLINGS_COUNT);
+ this.productInventory = new InventoryMapper(this, SLOT_PRODUCTION_1, SLOT_PRODUCTION_COUNT);
+ this.fertilizerInventory = new InventoryMapper(this, SLOT_FERTILIZER, SLOT_FERTILIZER_COUNT);
+ }
+
+ @Override
+ public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
+ if (SlotUtil.isSlotInRange(slotIndex, SLOT_FERTILIZER, SLOT_FERTILIZER_COUNT)) {
+ return acceptsAsFertilizer(itemStack);
+ } else if (SlotUtil.isSlotInRange(slotIndex, SLOT_GERMLINGS_1, SLOT_GERMLINGS_COUNT)) {
+ return acceptsAsGermling(itemStack);
+ } else if (SlotUtil.isSlotInRange(slotIndex, SLOT_RESOURCES_1, SLOT_RESOURCES_COUNT)) {
+ return acceptsAsResource(itemStack);
+ } else if (SlotUtil.isSlotInRange(slotIndex, SLOT_CAN, SLOT_CAN_COUNT)) {
+ FluidStack fluid = FluidUtil.getFluidContained(itemStack);
+ return fluid != null && ((ILiquidTankTile) housing).getTankManager().canFillFluidType(fluid);
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int slotIndex, ItemStack stack, EnumFacing side) {
+ return SlotUtil.isSlotInRange(slotIndex, SLOT_PRODUCTION_1, SLOT_PRODUCTION_COUNT);
+ }
+
+ @Override
+ public boolean hasResources(NonNullList resources) {
+ return InventoryUtil.contains(resourcesInventory, resources);
+ }
+
+ @Override
+ public void removeResources(NonNullList resources) {
+ InventoryUtil.removeSets(resourcesInventory, 1, resources, null, false, true, false, true);
+ }
+
+ @Override
+ public boolean acceptsAsGermling(ItemStack itemstack) {
+ if (itemstack.isEmpty()) {
+ return false;
+ }
+
+ IFarmLogic logic = housing.getFarmLogic();
+ return logic.isAcceptedGermling(itemstack);
+
+ }
+
+ @Override
+ public boolean acceptsAsResource(ItemStack itemstack) {
+ if (itemstack.isEmpty()) {
+ return false;
+ }
+
+ IFarmLogic logic = housing.getFarmLogic();
+ return logic.isAcceptedResource(itemstack);
+
+ }
+
+ @Override
+ public boolean acceptsAsFertilizer(ItemStack itemstack) {
+ if (itemstack.isEmpty()) {
+ return false;
+ }
+
+ return ForestryAPI.farmRegistry.getFertilizeValue(itemstack) > 0;
+ }
+
+ @Override
+ public IInventory getProductInventory() {
+ return productInventory;
+ }
+
+ @Override
+ public IInventory getGermlingsInventory() {
+ return germlingsInventory;
+ }
+
+ @Override
+ public IInventory getResourcesInventory() {
+ return resourcesInventory;
+ }
+
+ @Override
+ public IInventory getFertilizerInventory() {
+ return fertilizerInventory;
+ }
+
+ public void drainCan(TankManager tankManager) {
+ FluidHelper.drainContainers(tankManager, this, SLOT_CAN);
+ }
+
+ public boolean plantGermling(IFarmable germling, EntityPlayer player, BlockPos pos) {
+ for(FarmDirection direction : FarmDirection.values()){
+ if(plantGermling(germling, player, pos, direction)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean plantGermling(IFarmable germling, EntityPlayer player, BlockPos pos, FarmDirection direction) {
+ int index = direction.ordinal();
+ ItemStack germlingStack = germlingsInventory.getStackInSlot(index);
+ if (germlingStack.isEmpty() || !germling.isGermling(germlingStack)) {
+ return false;
+ }
+
+ if (germling.plantSaplingAt(player, germlingStack, player.world, pos)) {
+ germlingsInventory.decrStackSize(index, 1);
+ return true;
+ }
+ return false;
+ }
+
+ public void addProduce(ItemStack produce) {
+ int added = InventoryUtil.addStack(productInventory, produce, true);
+ produce.shrink(added);
+ }
+
+ public void stowHarvest(Iterable harvested, Stack pendingProduce) {
+ for (ItemStack harvest : harvested) {
+ int added = InventoryUtil.addStack(productInventory, harvest, true);
+ harvest.shrink(added);
+ if (!harvest.isEmpty()) {
+ pendingProduce.push(harvest);
+ }
+ }
+ }
+
+ public boolean tryAddPendingProduce(Stack pendingProduce) {
+ IInventory productInventory = getProductInventory();
+
+ ItemStack next = pendingProduce.peek();
+ boolean added = InventoryUtil.tryAddStack(productInventory, next, true, true);
+
+ if (added) {
+ pendingProduce.pop();
+ }
+
+ return added;
+ }
+
+ public int getFertilizerValue() {
+ ItemStack fertilizerStack = getStackInSlot(SLOT_FERTILIZER);
+ if (fertilizerStack.isEmpty()) {
+ return 0;
+ }
+
+ int fertilizerValue = ForestryAPI.farmRegistry.getFertilizeValue(fertilizerStack);
+ if (fertilizerValue > 0) {
+ return fertilizerValue * FERTILIZER_MODIFIER;
+ }
+ return 0;
+ }
+
+ public boolean useFertilizer() {
+ ItemStack fertilizer = getStackInSlot(SLOT_FERTILIZER);
+ if (acceptsAsFertilizer(fertilizer)) {
+ decrStackSize(SLOT_FERTILIZER, 1);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/forestry/cultivation/inventory/package-info.java b/src/main/java/forestry/cultivation/inventory/package-info.java
new file mode 100644
index 000000000..3c2a1f622
--- /dev/null
+++ b/src/main/java/forestry/cultivation/inventory/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.cultivation.inventory;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/cultivation/items/package-info.java b/src/main/java/forestry/cultivation/items/package-info.java
new file mode 100644
index 000000000..05d9468d4
--- /dev/null
+++ b/src/main/java/forestry/cultivation/items/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.cultivation.items;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/cultivation/network/package-info.java b/src/main/java/forestry/cultivation/network/package-info.java
new file mode 100644
index 000000000..f0aea46cf
--- /dev/null
+++ b/src/main/java/forestry/cultivation/network/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.cultivation.network;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/cultivation/package-info.java b/src/main/java/forestry/cultivation/package-info.java
new file mode 100644
index 000000000..ece106cbb
--- /dev/null
+++ b/src/main/java/forestry/cultivation/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.cultivation;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/cultivation/tiles/TileArboretum.java b/src/main/java/forestry/cultivation/tiles/TileArboretum.java
new file mode 100644
index 000000000..065673270
--- /dev/null
+++ b/src/main/java/forestry/cultivation/tiles/TileArboretum.java
@@ -0,0 +1,41 @@
+package forestry.cultivation.tiles;
+
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+
+public class TileArboretum extends TilePlanter {
+ public TileArboretum() {
+ super("farmArboreal");
+ }
+
+ @Override
+ public ItemStack[] createGermlingStacks() {
+ return new ItemStack[]{
+ new ItemStack(Blocks.SAPLING),
+ new ItemStack(Blocks.SAPLING, 1, 2),
+ new ItemStack(Blocks.SAPLING, 1, 2),
+ new ItemStack(Blocks.SAPLING)
+ };
+ }
+
+ @Override
+ public ItemStack[] createResourceStacks() {
+ return new ItemStack[]{
+ new ItemStack(Blocks.DIRT),
+ new ItemStack(Blocks.DIRT),
+ new ItemStack(Blocks.DIRT),
+ new ItemStack(Blocks.DIRT)
+ };
+ }
+
+ @Override
+ public ItemStack[] createProductionStacks() {
+ return new ItemStack[]{
+ new ItemStack(Blocks.LOG),
+ new ItemStack(Items.APPLE),
+ new ItemStack(Items.APPLE),
+ new ItemStack(Blocks.LOG)
+ };
+ }
+}
diff --git a/src/main/java/forestry/cultivation/tiles/TileBog.java b/src/main/java/forestry/cultivation/tiles/TileBog.java
new file mode 100644
index 000000000..ebcd6815a
--- /dev/null
+++ b/src/main/java/forestry/cultivation/tiles/TileBog.java
@@ -0,0 +1,36 @@
+package forestry.cultivation.tiles;
+
+import net.minecraft.item.ItemStack;
+
+import forestry.core.ModuleCore;
+
+public class TileBog extends TilePlanter {
+ public TileBog() {
+ super("farmPeat");
+ }
+
+ @Override
+ public ItemStack[] createGermlingStacks() {
+ return new ItemStack[0];
+ }
+
+ @Override
+ public ItemStack[] createResourceStacks() {
+ return new ItemStack[]{
+ new ItemStack(ModuleCore.getBlocks().bogEarth),
+ new ItemStack(ModuleCore.getBlocks().bogEarth),
+ new ItemStack(ModuleCore.getBlocks().bogEarth),
+ new ItemStack(ModuleCore.getBlocks().bogEarth)
+ };
+ }
+
+ @Override
+ public ItemStack[] createProductionStacks() {
+ return new ItemStack[]{
+ new ItemStack(ModuleCore.getItems().peat),
+ new ItemStack(ModuleCore.getItems().peat),
+ new ItemStack(ModuleCore.getItems().peat),
+ new ItemStack(ModuleCore.getItems().peat)
+ };
+ }
+}
diff --git a/src/main/java/forestry/cultivation/tiles/TileFarmCrops.java b/src/main/java/forestry/cultivation/tiles/TileFarmCrops.java
new file mode 100644
index 000000000..17a1a865b
--- /dev/null
+++ b/src/main/java/forestry/cultivation/tiles/TileFarmCrops.java
@@ -0,0 +1,41 @@
+package forestry.cultivation.tiles;
+
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+
+public class TileFarmCrops extends TilePlanter {
+ public TileFarmCrops() {
+ super("farmCrops");
+ }
+
+ @Override
+ public ItemStack[] createGermlingStacks() {
+ return new ItemStack[]{
+ new ItemStack(Items.WHEAT_SEEDS),
+ new ItemStack(Items.POTATO),
+ new ItemStack(Items.CARROT),
+ new ItemStack(Items.BEETROOT_SEEDS)
+ };
+ }
+
+ @Override
+ public ItemStack[] createResourceStacks() {
+ return new ItemStack[]{
+ new ItemStack(Blocks.DIRT),
+ new ItemStack(Blocks.DIRT),
+ new ItemStack(Blocks.DIRT),
+ new ItemStack(Blocks.DIRT)
+ };
+ }
+
+ @Override
+ public ItemStack[] createProductionStacks() {
+ return new ItemStack[]{
+ new ItemStack(Items.WHEAT),
+ new ItemStack(Items.POTATO),
+ new ItemStack(Items.CARROT),
+ new ItemStack(Items.BEETROOT)
+ };
+ }
+}
diff --git a/src/main/java/forestry/cultivation/tiles/TileFarmGourd.java b/src/main/java/forestry/cultivation/tiles/TileFarmGourd.java
new file mode 100644
index 000000000..19d63f6bb
--- /dev/null
+++ b/src/main/java/forestry/cultivation/tiles/TileFarmGourd.java
@@ -0,0 +1,30 @@
+package forestry.cultivation.tiles;
+
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+
+public class TileFarmGourd extends TilePlanter {
+ public TileFarmGourd() {
+ super("farmGourd");
+ }
+
+ @Override
+ public ItemStack[] createGermlingStacks() {
+ return new ItemStack[0];
+ }
+
+ @Override
+ public ItemStack[] createResourceStacks() {
+ return new ItemStack[0];
+ }
+
+ @Override
+ public ItemStack[] createProductionStacks() {
+ return new ItemStack[]{
+ new ItemStack(Blocks.MELON_BLOCK),
+ new ItemStack(Blocks.PUMPKIN),
+ new ItemStack(Blocks.PUMPKIN),
+ new ItemStack(Blocks.MELON_BLOCK)
+ };
+ }
+}
diff --git a/src/main/java/forestry/cultivation/tiles/TileFarmMushroom.java b/src/main/java/forestry/cultivation/tiles/TileFarmMushroom.java
new file mode 100644
index 000000000..ecb696869
--- /dev/null
+++ b/src/main/java/forestry/cultivation/tiles/TileFarmMushroom.java
@@ -0,0 +1,40 @@
+package forestry.cultivation.tiles;
+
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+
+public class TileFarmMushroom extends TilePlanter {
+ public TileFarmMushroom() {
+ super("farmShroom");
+ }
+
+ @Override
+ public ItemStack[] createGermlingStacks() {
+ return new ItemStack[]{
+ new ItemStack(Blocks.RED_MUSHROOM),
+ new ItemStack(Blocks.BROWN_MUSHROOM),
+ new ItemStack(Blocks.BROWN_MUSHROOM),
+ new ItemStack(Blocks.RED_MUSHROOM)
+ };
+ }
+
+ @Override
+ public ItemStack[] createResourceStacks() {
+ return new ItemStack[]{
+ new ItemStack(Blocks.MYCELIUM),
+ new ItemStack(Blocks.DIRT, 1, 2),
+ new ItemStack(Blocks.DIRT, 1, 2),
+ new ItemStack(Blocks.MYCELIUM)
+ };
+ }
+
+ @Override
+ public ItemStack[] createProductionStacks() {
+ return new ItemStack[]{
+ new ItemStack(Blocks.RED_MUSHROOM),
+ new ItemStack(Blocks.BROWN_MUSHROOM),
+ new ItemStack(Blocks.BROWN_MUSHROOM),
+ new ItemStack(Blocks.RED_MUSHROOM)
+ };
+ }
+}
diff --git a/src/main/java/forestry/cultivation/tiles/TileFarmNether.java b/src/main/java/forestry/cultivation/tiles/TileFarmNether.java
new file mode 100644
index 000000000..be6b651a4
--- /dev/null
+++ b/src/main/java/forestry/cultivation/tiles/TileFarmNether.java
@@ -0,0 +1,41 @@
+package forestry.cultivation.tiles;
+
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+
+public class TileFarmNether extends TilePlanter {
+ public TileFarmNether() {
+ super("farmInfernal");
+ }
+
+ @Override
+ public ItemStack[] createGermlingStacks() {
+ return new ItemStack[]{
+ new ItemStack(Items.NETHER_WART),
+ new ItemStack(Items.NETHER_WART),
+ new ItemStack(Items.NETHER_WART),
+ new ItemStack(Items.NETHER_WART)
+ };
+ }
+
+ @Override
+ public ItemStack[] createResourceStacks() {
+ return new ItemStack[]{
+ new ItemStack(Blocks.SOUL_SAND),
+ new ItemStack(Blocks.SOUL_SAND),
+ new ItemStack(Blocks.SOUL_SAND),
+ new ItemStack(Blocks.SOUL_SAND)
+ };
+ }
+
+ @Override
+ public ItemStack[] createProductionStacks() {
+ return new ItemStack[]{
+ new ItemStack(Items.NETHER_WART),
+ new ItemStack(Items.NETHER_WART),
+ new ItemStack(Items.NETHER_WART),
+ new ItemStack(Items.NETHER_WART)
+ };
+ }
+}
diff --git a/src/main/java/forestry/cultivation/tiles/TilePlantation.java b/src/main/java/forestry/cultivation/tiles/TilePlantation.java
new file mode 100644
index 000000000..d0dfc9df1
--- /dev/null
+++ b/src/main/java/forestry/cultivation/tiles/TilePlantation.java
@@ -0,0 +1,26 @@
+package forestry.cultivation.tiles;
+
+import net.minecraft.item.ItemStack;
+
+import forestry.api.farming.IFarmLogic;
+
+public class TilePlantation extends TilePlanter {
+ public TilePlantation(IFarmLogic logic) {
+ super(logic);
+ }
+
+ @Override
+ public ItemStack[] createGermlingStacks() {
+ return new ItemStack[0];
+ }
+
+ @Override
+ public ItemStack[] createResourceStacks() {
+ return new ItemStack[0];
+ }
+
+ @Override
+ public ItemStack[] createProductionStacks() {
+ return new ItemStack[0];
+ }
+}
diff --git a/src/main/java/forestry/cultivation/tiles/TilePlanter.java b/src/main/java/forestry/cultivation/tiles/TilePlanter.java
new file mode 100644
index 000000000..88864b88c
--- /dev/null
+++ b/src/main/java/forestry/cultivation/tiles/TilePlanter.java
@@ -0,0 +1,488 @@
+package forestry.cultivation.tiles;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.NonNullList;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.Vec3i;
+import net.minecraft.world.World;
+
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+import forestry.api.core.EnumHumidity;
+import forestry.api.core.EnumTemperature;
+import forestry.api.core.IErrorLogic;
+import forestry.api.cultivation.IPlanterHousing;
+import forestry.api.farming.FarmDirection;
+import forestry.api.farming.ICrop;
+import forestry.api.farming.IFarmHousing;
+import forestry.api.farming.IFarmInventory;
+import forestry.api.farming.IFarmLogic;
+import forestry.api.farming.IFarmable;
+import forestry.core.config.Constants;
+import forestry.core.errors.EnumErrorCode;
+import forestry.core.fluids.FilteredTank;
+import forestry.core.fluids.ITankManager;
+import forestry.core.fluids.StandardTank;
+import forestry.core.fluids.TankManager;
+import forestry.core.network.IStreamableGui;
+import forestry.core.network.PacketBufferForestry;
+import forestry.core.owner.IOwnedTile;
+import forestry.core.owner.IOwnerHandler;
+import forestry.core.owner.OwnerHandler;
+import forestry.core.tiles.IClimatised;
+import forestry.core.tiles.ILiquidTankTile;
+import forestry.core.tiles.TilePowered;
+import forestry.core.utils.ClimateUtil;
+import forestry.core.utils.PlayerUtil;
+import forestry.core.utils.VectUtil;
+import forestry.cultivation.gui.ContainerPlanter;
+import forestry.cultivation.gui.GuiPlanter;
+import forestry.cultivation.inventory.InventoryPlanter;
+import forestry.farming.FarmHelper;
+import forestry.farming.FarmHelper.FarmWorkStatus;
+import forestry.farming.FarmHelper.Stage;
+import forestry.farming.FarmRegistry;
+import forestry.farming.FarmTarget;
+import forestry.farming.gui.IFarmLedgerDelegate;
+import forestry.farming.multiblock.FarmFertilizerManager;
+import forestry.farming.multiblock.FarmHydrationManager;
+
+public abstract class TilePlanter extends TilePowered implements IFarmHousing, IPlanterHousing, IClimatised, ILiquidTankTile, IOwnedTile, IStreamableGui {
+
+ private final static int ALLOWED_EXTENT = 4;
+
+ private int platformHeight = -1;
+ private final Map> targets = new EnumMap<>(FarmDirection.class);
+ private final Stack pendingProduce = new Stack<>();
+ private final List pendingCrops = new LinkedList<>();
+ private final IFarmLogic logic;
+ private final FarmHydrationManager hydrationManager;
+ private final FarmFertilizerManager fertilizerManager;
+ private final InventoryPlanter inventory;
+ private final TankManager tankManager;
+ private final StandardTank resourceTank;
+ private final OwnerHandler ownerHandler = new OwnerHandler();
+ private Stage stage = Stage.CULTIVATE;
+ @Nullable
+ private Vec3i offset;
+ @Nullable
+ private Vec3i area;
+ @Nullable
+ public Iterator areaIterator;
+
+ public TilePlanter(String identifier) {
+ this(FarmRegistry.getInstance().getFarmLogic(identifier));
+ }
+
+ protected TilePlanter(IFarmLogic logic) {
+ super(150, 1500);
+ setInternalInventory(inventory = new InventoryPlanter(this));
+ this.logic = logic;
+ this.hydrationManager = new FarmHydrationManager(this);
+ this.fertilizerManager = new FarmFertilizerManager();
+
+ this.resourceTank = new FilteredTank(Constants.PROCESSOR_TANK_CAPACITY).setFilters(FluidRegistry.WATER);
+
+ this.tankManager = new TankManager(this, resourceTank);
+ setEnergyPerWorkCycle(10);
+ setTicksPerWorkCycle(2);
+ }
+
+ @Override
+ public NBTTagCompound writeToNBT(NBTTagCompound data) {
+ data = super.writeToNBT(data);
+ hydrationManager.writeToNBT(data);
+ tankManager.writeToNBT(data);
+ fertilizerManager.writeToNBT(data);
+ ownerHandler.writeToNBT(data);
+ return data;
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound data) {
+ super.readFromNBT(data);
+ hydrationManager.readFromNBT(data);
+ tankManager.readFromNBT(data);
+ fertilizerManager.readFromNBT(data);
+ ownerHandler.readFromNBT(data);
+ }
+
+ @Override
+ public NBTTagCompound getUpdateTag() {
+ NBTTagCompound data = super.getUpdateTag();
+ hydrationManager.writeToNBT(data);
+ tankManager.writeToNBT(data);
+ fertilizerManager.writeToNBT(data);
+ return data;
+ }
+
+ @Override
+ public void writeGuiData(PacketBufferForestry data) {
+ tankManager.writeData(data);
+ hydrationManager.writeData(data);
+ fertilizerManager.writeData(data);
+ }
+
+ @Override
+ public void readGuiData(PacketBufferForestry data) throws IOException {
+ tankManager.readData(data);
+ hydrationManager.readData(data);
+ fertilizerManager.readData(data);
+ }
+
+ @Override
+ public IOwnerHandler getOwnerHandler() {
+ return ownerHandler;
+ }
+
+ @Override
+ public void setPos(BlockPos posIn) {
+ super.setPos(posIn);
+ this.platformHeight = posIn.getY() - 2;
+ }
+
+ @Override
+ public boolean hasWork() {
+ return true;
+ }
+
+ @Override
+ public void invalidate() {
+ super.invalidate();
+ targets.clear();
+ }
+
+ @Override
+ protected void updateServerSide() {
+ super.updateServerSide();
+ hydrationManager.updateServer(world, getCoords());
+
+ if (updateOnInterval(20)) {
+ inventory.drainCan(tankManager);
+ }
+ }
+
+ @Override
+ protected boolean workCycle() {
+ if (targets.isEmpty() || updateOnInterval(10)) {
+ setUpFarmlandTargets();
+ }
+ IErrorLogic errorLogic = getErrorLogic();
+
+ boolean hasFertilizer = fertilizerManager.maintainFertilizer(inventory);
+ if (errorLogic.setCondition(!hasFertilizer, EnumErrorCode.NO_FERTILIZER)) {
+ return false;
+ }
+
+ if (!pendingProduce.isEmpty()) {
+ boolean added = inventory.tryAddPendingProduce(pendingProduce);
+ errorLogic.setCondition(!added, EnumErrorCode.NO_SPACE_INVENTORY);
+ return added;
+ }
+
+ // Cull queued crops.
+ if (!pendingCrops.isEmpty()) {
+ ICrop first = pendingCrops.get(0);
+ if (cullCrop(first)) {
+ pendingCrops.remove(0);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ // Cultivation and collection
+ FarmWorkStatus farmWorkStatus = new FarmWorkStatus();
+
+ List farmDirections = Arrays.asList(FarmDirection.values());
+ Collections.shuffle(farmDirections, world.rand);
+ for (FarmDirection farmSide : farmDirections) {
+ IFarmLogic logic = getFarmLogic(farmSide);
+
+ // Always try to collect windfall.
+ if (collectWindfall()) {
+ farmWorkStatus.didWork = true;
+ }
+
+ List farmTargets = targets.get(farmSide);
+
+ if (stage == Stage.HARVEST) {
+ Collection harvested = FarmHelper.harvestTargets(world, farmTargets, logic, Collections.emptySet());
+ farmWorkStatus.didWork = !harvested.isEmpty();
+ if (!harvested.isEmpty()) {
+ pendingCrops.addAll(harvested);
+ pendingCrops.sort(FarmHelper.TopDownICropComparator.INSTANCE);
+ }
+ } else if (stage == Stage.CULTIVATE) {
+ farmWorkStatus = cultivateTargets(farmWorkStatus, farmTargets, farmSide);
+ }
+
+ if (farmWorkStatus.didWork) {
+ break;
+ }
+ }
+
+ if (stage == Stage.CULTIVATE) {
+ errorLogic.setCondition(!farmWorkStatus.hasFarmland, EnumErrorCode.NO_FARMLAND);
+ errorLogic.setCondition(!farmWorkStatus.hasFertilizer, EnumErrorCode.NO_FERTILIZER);
+ errorLogic.setCondition(!farmWorkStatus.hasLiquid, EnumErrorCode.NO_LIQUID_FARM);
+ }
+
+ // alternate between cultivation and harvest.
+ stage = stage.next();
+
+ return false;
+ }
+
+ protected final BlockPos translateWithOffset(BlockPos pos, FarmDirection farmDirection, int step) {
+ return VectUtil.scale(farmDirection.getFacing().getDirectionVec(), step).add(pos);
+ }
+
+ private FarmWorkStatus cultivateTargets(FarmWorkStatus farmWorkStatus, List farmTargets, FarmDirection farmSide) {
+ boolean hasFarmland = false;
+ for (FarmTarget target : farmTargets) {
+ if (target.getExtent() > 0) {
+ hasFarmland = true;
+ farmWorkStatus.hasFarmland = true;
+ break;
+ }
+ }
+
+ if (hasFarmland && !FarmHelper.isCycleCanceledByListeners(logic, farmSide, Collections.emptySet())) {
+ final float hydrationModifier = hydrationManager.getHydrationModifier();
+ final int fertilizerConsumption = logic.getFertilizerConsumption();
+ final int liquidConsumption = logic.getWaterConsumption(hydrationModifier);
+ final FluidStack liquid = new FluidStack(FluidRegistry.WATER, liquidConsumption);
+
+ for (FarmTarget target : farmTargets) {
+ // Check fertilizer and water
+ if (!fertilizerManager.hasFertilizer(inventory, fertilizerConsumption)) {
+ farmWorkStatus.hasFertilizer = false;
+ continue;
+ }
+
+ if (liquid.amount > 0 && !hasLiquid(liquid)) {
+ farmWorkStatus.hasLiquid = false;
+ continue;
+ }
+
+ if (FarmHelper.cultivateTarget(world, this, target, logic, Collections.emptySet())) {
+ // Remove fertilizer and water
+ fertilizerManager.removeFertilizer(inventory, fertilizerConsumption);
+ removeLiquid(liquid);
+
+ farmWorkStatus.didWork = true;
+ }
+ }
+ }
+
+ return farmWorkStatus;
+ }
+
+ private boolean collectWindfall() {
+ NonNullList collected = logic.collect(world, this);
+ if (collected.isEmpty()) {
+ return false;
+ }
+
+ for (ItemStack produce : collected) {
+ inventory.addProduce(produce);
+ pendingProduce.push(produce);
+ }
+
+ return true;
+ }
+
+ private boolean cullCrop(ICrop crop) {
+ final int fertilizerConsumption = logic.getFertilizerConsumption();
+
+ IErrorLogic errorLogic = getErrorLogic();
+
+ // Check fertilizer
+ Boolean hasFertilizer = fertilizerManager.hasFertilizer(inventory, fertilizerConsumption);
+ if (errorLogic.setCondition(!hasFertilizer, EnumErrorCode.NO_FERTILIZER)) {
+ return false;
+ }
+
+ // Check water
+ float hydrationModifier = hydrationManager.getHydrationModifier();
+ int waterConsumption = logic.getWaterConsumption(hydrationModifier);
+ FluidStack requiredLiquid = new FluidStack(FluidRegistry.WATER, waterConsumption);
+ boolean hasLiquid = requiredLiquid.amount == 0 || hasLiquid(requiredLiquid);
+
+ if (errorLogic.setCondition(!hasLiquid, EnumErrorCode.NO_LIQUID_FARM)) {
+ return false;
+ }
+
+ NonNullList harvested = crop.harvest();
+ if (harvested != null) {
+ // Remove fertilizer and water
+ fertilizerManager.removeFertilizer(inventory, fertilizerConsumption);
+ removeLiquid(requiredLiquid);
+
+ inventory.stowHarvest(harvested, pendingProduce);
+ }
+ return true;
+ }
+
+ @Override
+ public int getStoredFertilizerScaled(int scale) {
+ return fertilizerManager.getStoredFertilizerScaled(inventory, scale);
+ }
+
+ @Override
+ public boolean hasLiquid(FluidStack liquid) {
+ FluidStack drained = resourceTank.drainInternal(liquid, false);
+ return liquid.isFluidStackIdentical(drained);
+ }
+
+ @Override
+ public GuiContainer getGui(EntityPlayer player, int data) {
+ return new GuiPlanter(this, player.inventory);
+ }
+
+ @Override
+ public Container getContainer(EntityPlayer player, int data) {
+ return new ContainerPlanter(this, player.inventory);
+ }
+
+ @Override
+ public boolean plantGermling(IFarmable germling, World world, BlockPos pos) {
+ EntityPlayer player = PlayerUtil.getFakePlayer(world, getOwnerHandler().getOwner());
+ return player != null && inventory.plantGermling(germling, player, pos);
+ }
+
+ @Override
+ public boolean plantGermling(IFarmable farmable, World world, BlockPos pos, FarmDirection direction) {
+ EntityPlayer player = PlayerUtil.getFakePlayer(world, getOwnerHandler().getOwner());
+ return player != null && inventory.plantGermling(farmable, player, pos, direction);
+ }
+
+ @Override
+ public IFarmInventory getFarmInventory() {
+ return inventory;
+ }
+
+ @Override
+ public IFarmLogic getFarmLogic() {
+ return logic;
+ }
+
+ @Override
+ public BlockPos getCoords() {
+ return pos;
+ }
+
+ @Override
+ public Vec3i getOffset() {
+ if (offset == null) {
+ Vec3i area = getArea();
+ offset = new Vec3i(-area.getX() / 2, -2, -area.getZ() / 2);
+ }
+ return offset;
+ }
+
+ @Override
+ public Vec3i getArea() {
+ if (area == null) {
+ area = new Vec3i(7 + ALLOWED_EXTENT * 2, 13, 7 + ALLOWED_EXTENT * 2);
+ }
+ return area;
+ }
+
+ @Override
+ public boolean doWork() {
+ return false;
+ }
+
+
+ @Override
+ public void removeLiquid(FluidStack liquid) {
+ resourceTank.drain(liquid.amount, true);
+ }
+
+ @Override
+ public void setFarmLogic(FarmDirection direction, IFarmLogic logic) {
+ }
+
+ @Override
+ public void resetFarmLogic(FarmDirection direction) {
+ }
+
+ @Override
+ public IFarmLogic getFarmLogic(FarmDirection direction) {
+ return getFarmLogic();
+ }
+
+ public IFarmLedgerDelegate getFarmLedgerDelegate() {
+ return hydrationManager;
+ }
+
+ @Override
+ public EnumTemperature getTemperature() {
+ return EnumTemperature.getFromValue(getExactTemperature());
+ }
+
+ @Override
+ public EnumHumidity getHumidity() {
+ return EnumHumidity.getFromValue(getExactHumidity());
+ }
+
+ @Override
+ public float getExactTemperature() {
+ BlockPos coords = getCoordinates();
+ return ClimateUtil.getTemperature(getWorldObj(), coords);
+ }
+
+ @Override
+ public float getExactHumidity() {
+ BlockPos coords = getCoordinates();
+ return ClimateUtil.getHumidity(getWorldObj(), coords);
+ }
+
+ @Override
+ public ITankManager getTankManager() {
+ return tankManager;
+ }
+
+ @Override
+ public boolean isValidPlatform(World world, BlockPos pos) {
+ return pos.getY() == platformHeight;
+ }
+
+ @Override
+ public boolean isSquare() {
+ return true;
+ }
+
+ private void setUpFarmlandTargets() {
+ BlockPos targetStart = getCoords();
+
+ FarmHelper.createTargets(world, this, targets, targetStart, ALLOWED_EXTENT, 1, 1, pos, pos);
+ FarmHelper.setExtents(world, this, targets);
+ }
+
+ public abstract ItemStack[] createGermlingStacks();
+
+ public abstract ItemStack[] createResourceStacks();
+
+ public abstract ItemStack[] createProductionStacks();
+
+}
diff --git a/src/main/java/forestry/cultivation/tiles/package-info.java b/src/main/java/forestry/cultivation/tiles/package-info.java
new file mode 100644
index 000000000..451564e86
--- /dev/null
+++ b/src/main/java/forestry/cultivation/tiles/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.cultivation.tiles;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/farming/FarmHelper.java b/src/main/java/forestry/farming/FarmHelper.java
index c951cff3e..0f69dd92e 100755
--- a/src/main/java/forestry/farming/FarmHelper.java
+++ b/src/main/java/forestry/farming/FarmHelper.java
@@ -12,15 +12,62 @@ package forestry.farming;
import com.google.common.collect.ImmutableSet;
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
import forestry.api.farming.FarmDirection;
+import forestry.api.farming.ICrop;
+import forestry.api.farming.IFarmHousing;
+import forestry.api.farming.IFarmListener;
+import forestry.api.farming.IFarmLogic;
+import forestry.core.utils.TopDownBlockPosComparator;
public class FarmHelper {
+ public enum Stage {
+ CULTIVATE, HARVEST;
+
+ public Stage next() {
+ if (this == CULTIVATE) {
+ return HARVEST;
+ } else {
+ return CULTIVATE;
+ }
+ }
+ }
+
+ public static class FarmWorkStatus {
+ public boolean didWork = false;
+ public boolean hasFarmland = false;
+ public boolean hasFertilizer = true;
+ public boolean hasLiquid = true;
+ }
+
+ private static FarmDirection getLayoutDirection(FarmDirection farmSide) {
+ switch (farmSide) {
+ case NORTH:
+ return FarmDirection.WEST;
+ case WEST:
+ return FarmDirection.SOUTH;
+ case SOUTH:
+ return FarmDirection.EAST;
+ case EAST:
+ return FarmDirection.NORTH;
+ }
+ return null;
+ }
+
public static final ImmutableSet bricks = ImmutableSet.of(
Blocks.BRICK_BLOCK,
Blocks.STONEBRICK,
@@ -38,7 +85,7 @@ public class FarmHelper {
/**
* @return the corner of the farm for the given side and layout. Returns null if the corner is not in a loaded chunk.
*/
- public static BlockPos getFarmMultiblockCorner(BlockPos start, FarmDirection farmSide, FarmDirection layoutDirection, BlockPos minFarmCoord, BlockPos maxFarmCoord) {
+ private static BlockPos getFarmMultiblockCorner(BlockPos start, FarmDirection farmSide, FarmDirection layoutDirection, BlockPos minFarmCoord, BlockPos maxFarmCoord) {
BlockPos edge = getFarmMultiblockEdge(start, farmSide, maxFarmCoord, minFarmCoord);
return getFarmMultiblockEdge(edge, getOpposite(layoutDirection), maxFarmCoord, minFarmCoord);
}
@@ -60,4 +107,137 @@ public class FarmHelper {
throw new IllegalArgumentException("Invalid farm direction: " + direction);
}
}
+
+ public static void createTargets(World world, IFarmHousing farmHousing, Map> targets, BlockPos targetStart, final int allowedExtent, final int farmSizeNorthSouth, final int farmSizeEastWest, BlockPos minFarmCoord, BlockPos maxFarmCoord) {
+ for (FarmDirection farmSide : FarmDirection.values()) {
+
+ final int farmWidth;
+ if (farmSide == FarmDirection.NORTH || farmSide == FarmDirection.SOUTH) {
+ farmWidth = farmSizeEastWest;
+ } else {
+ farmWidth = farmSizeNorthSouth;
+ }
+
+ // targets extend sideways in a pinwheel pattern around the farm, so they need to go a little extra distance
+ final int targetMaxLimit = allowedExtent + farmWidth;
+
+ FarmDirection layoutDirection = getLayoutDirection(farmSide);
+
+ List farmSideTargets = new ArrayList<>();
+ targets.put(farmSide, farmSideTargets);
+
+ BlockPos targetLocation = FarmHelper.getFarmMultiblockCorner(targetStart, farmSide, layoutDirection, minFarmCoord, maxFarmCoord);
+ BlockPos firstLocation = targetLocation.offset(farmSide.getFacing());
+ BlockPos firstGroundPosition = getGroundPosition(world, farmHousing, firstLocation);
+ if (firstGroundPosition != null) {
+ int groundHeight = firstGroundPosition.getY();
+
+ for (int i = 0; i < allowedExtent; i++) {
+ targetLocation = targetLocation.offset(farmSide.getFacing());
+ BlockPos groundLocation = new BlockPos(targetLocation.getX(), groundHeight, targetLocation.getZ());
+
+ if (!world.isBlockLoaded(groundLocation)) {
+ break;
+ }
+
+ if (!farmHousing.isValidPlatform(world, groundLocation)) {
+ break;
+ }
+
+ int targetLimit = targetMaxLimit;
+ if (!farmHousing.isSquare()) {
+ targetLimit = targetMaxLimit - i - 1;
+ }
+
+ FarmTarget target = new FarmTarget(targetLocation, layoutDirection, targetLimit);
+ farmSideTargets.add(target);
+ }
+ }
+ }
+ }
+
+ @Nullable
+ private static BlockPos getGroundPosition(World world, IFarmHousing farmHousing, BlockPos targetPosition) {
+ if (!world.isBlockLoaded(targetPosition)) {
+ return null;
+ }
+
+ for (int yOffset = 2; yOffset > -4; yOffset--) {
+ BlockPos position = targetPosition.add(0, yOffset, 0);
+ if (farmHousing.isValidPlatform(world, position)) {
+ return position;
+ }
+ }
+
+ return null;
+ }
+
+ public static boolean isCycleCanceledByListeners(IFarmLogic logic, FarmDirection direction, Iterable farmListeners) {
+ for (IFarmListener listener : farmListeners) {
+ if (listener.cancelTask(logic, direction)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static void setExtents(World world, IFarmHousing farmHousing, Map> targets) {
+ for (List targetsList : targets.values()) {
+ if (!targetsList.isEmpty()) {
+ BlockPos groundPosition = getGroundPosition(world, farmHousing, targetsList.get(0).getStart());
+
+ for (FarmTarget target : targetsList) {
+ target.setExtentAndYOffset(world, groundPosition, farmHousing);
+ }
+ }
+ }
+ }
+
+ public static boolean cultivateTarget(World world, IFarmHousing farmHousing, FarmTarget target, IFarmLogic logic, Iterable farmListeners) {
+ BlockPos targetPosition = target.getStart().add(0, target.getYOffset(), 0);
+ if (logic.cultivate(world, farmHousing, targetPosition, target.getDirection(), target.getExtent())) {
+ for (IFarmListener listener : farmListeners) {
+ listener.hasCultivated(logic, targetPosition, target.getDirection(), target.getExtent());
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ public static Collection harvestTargets(World world, List farmTargets, IFarmLogic logic, Iterable farmListeners) {
+ for (FarmTarget target : farmTargets) {
+ Collection harvested = harvestTarget(world, target, logic, farmListeners);
+ if (!harvested.isEmpty()) {
+ return harvested;
+ }
+ }
+
+ return Collections.emptyList();
+ }
+
+ public static Collection harvestTarget(World world, FarmTarget target, IFarmLogic logic, Iterable farmListeners) {
+ BlockPos pos = target.getStart().add(0, target.getYOffset(), 0);
+ Collection harvested = logic.harvest(world, pos, target.getDirection(), target.getExtent());
+ if (!harvested.isEmpty()) {
+ // Let event handlers know.
+ for (IFarmListener listener : farmListeners) {
+ listener.hasScheduledHarvest(harvested, logic, pos, target.getDirection(), target.getExtent());
+ }
+ }
+ return harvested;
+ }
+
+ public static class TopDownICropComparator implements Comparator {
+ public static final TopDownICropComparator INSTANCE = new TopDownICropComparator();
+
+ private TopDownICropComparator() {
+
+ }
+
+ @Override
+ public int compare(ICrop o1, ICrop o2) {
+ return TopDownBlockPosComparator.INSTANCE.compare(o1.getPosition(), o2.getPosition());
+ }
+ }
}
diff --git a/src/main/java/forestry/farming/FarmTarget.java b/src/main/java/forestry/farming/FarmTarget.java
index 1b37e3e05..223a2b185 100755
--- a/src/main/java/forestry/farming/FarmTarget.java
+++ b/src/main/java/forestry/farming/FarmTarget.java
@@ -12,11 +12,11 @@ package forestry.farming;
import javax.annotation.Nullable;
-import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.farming.FarmDirection;
+import forestry.api.farming.IFarmHousing;
public class FarmTarget {
@@ -49,7 +49,7 @@ public class FarmTarget {
return direction;
}
- public void setExtentAndYOffset(World world, @Nullable BlockPos platformPosition) {
+ public void setExtentAndYOffset(World world, @Nullable BlockPos platformPosition, IFarmHousing housing) {
if (platformPosition == null) {
extent = 0;
return;
@@ -60,8 +60,7 @@ public class FarmTarget {
if (!world.isBlockLoaded(position)) {
break;
}
- IBlockState blockState = world.getBlockState(position);
- if (!FarmHelper.bricks.contains(blockState.getBlock())) {
+ if (!housing.isValidPlatform(world, position)) {
break;
}
position.move(getDirection().getFacing());
diff --git a/src/main/java/forestry/farming/ModuleFarming.java b/src/main/java/forestry/farming/ModuleFarming.java
index a52f4e4d0..352d7c6a5 100644
--- a/src/main/java/forestry/farming/ModuleFarming.java
+++ b/src/main/java/forestry/farming/ModuleFarming.java
@@ -59,8 +59,8 @@ import forestry.farming.blocks.BlockRegistryFarming;
import forestry.farming.blocks.EnumFarmBlockType;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.logic.FarmLogicArboreal;
-import forestry.farming.logic.FarmLogicCereal;
import forestry.farming.logic.FarmLogicCocoa;
+import forestry.farming.logic.FarmLogicCrops;
import forestry.farming.logic.FarmLogicGourd;
import forestry.farming.logic.FarmLogicInfernal;
import forestry.farming.logic.FarmLogicMushroom;
@@ -68,13 +68,12 @@ import forestry.farming.logic.FarmLogicOrchard;
import forestry.farming.logic.FarmLogicPeat;
import forestry.farming.logic.FarmLogicReeds;
import forestry.farming.logic.FarmLogicSucculent;
-import forestry.farming.logic.FarmLogicVegetable;
-import forestry.farming.logic.FarmableAgingCrop;
-import forestry.farming.logic.FarmableGE;
-import forestry.farming.logic.FarmableGourd;
-import forestry.farming.logic.FarmableStacked;
-import forestry.farming.logic.FarmableVanillaMushroom;
-import forestry.farming.logic.FarmableVanillaSapling;
+import forestry.farming.logic.farmables.FarmableAgingCrop;
+import forestry.farming.logic.farmables.FarmableGE;
+import forestry.farming.logic.farmables.FarmableGourd;
+import forestry.farming.logic.farmables.FarmableStacked;
+import forestry.farming.logic.farmables.FarmableVanillaMushroom;
+import forestry.farming.logic.farmables.FarmableVanillaSapling;
import forestry.farming.models.EnumFarmBlockTexture;
import forestry.farming.proxy.ProxyFarming;
import forestry.farming.tiles.TileFarmControl;
@@ -129,7 +128,7 @@ public class ModuleFarming extends BlankForestryModule {
registry.registerFarmables("farmArboreal", new FarmableGE());
}
- registry.registerFarmables("farmOrchard",
+ registry.registerFarmables("farmCrops",
new FarmableAgingCrop(new ItemStack(Items.WHEAT_SEEDS), Blocks.WHEAT, BlockCrops.AGE, 7, 0),
new FarmableAgingCrop(new ItemStack(Items.POTATO), Blocks.POTATOES, BlockCrops.AGE, 7, 0),
new FarmableAgingCrop(new ItemStack(Items.CARROT), Blocks.CARROTS, BlockCrops.AGE, 7, 0),
@@ -141,8 +140,6 @@ public class ModuleFarming extends BlankForestryModule {
IBlockState plantedRedMushroom = blocks.mushroom.getDefaultState().withProperty(BlockMushroom.VARIANT, BlockMushroom.MushroomType.RED);
registry.registerFarmables("farmShroom", new FarmableVanillaMushroom(new ItemStack(Blocks.RED_MUSHROOM), plantedRedMushroom, Blocks.RED_MUSHROOM_BLOCK));
- registry.registerFarmables("farmWheat", new FarmableAgingCrop(new ItemStack(Items.WHEAT_SEEDS), Blocks.WHEAT, BlockCrops.AGE, 7));
-
registry.registerFarmables("farmGourd", new FarmableGourd(new ItemStack(Items.PUMPKIN_SEEDS), Blocks.PUMPKIN_STEM, Blocks.PUMPKIN));
registry.registerFarmables("farmGourd", new FarmableGourd(new ItemStack(Items.MELON_SEEDS), Blocks.MELON_STEM, Blocks.MELON_BLOCK));
@@ -152,10 +149,6 @@ public class ModuleFarming extends BlankForestryModule {
registry.registerFarmables("farmSucculentes", new FarmableStacked(new ItemStack(Blocks.CACTUS), Blocks.CACTUS, 3));
- registry.registerFarmables("farmVegetables", new FarmableAgingCrop(new ItemStack(Items.POTATO), Blocks.POTATOES, BlockCrops.AGE, 7));
- registry.registerFarmables("farmVegetables", new FarmableAgingCrop(new ItemStack(Items.CARROT), Blocks.CARROTS, BlockCrops.AGE, 7));
- registry.registerFarmables("farmVegetables", new FarmableAgingCrop(new ItemStack(Items.BEETROOT_SEEDS), Blocks.BEETROOTS, BlockBeetroot.BEETROOT_AGE, 3));
-
//Forestry fertilizer
registry.registerFertilizer(new ItemStack(coreItems.fertilizerCompound, 1, OreDictionary.WILDCARD_VALUE), 500);
@@ -191,14 +184,12 @@ public class ModuleFarming extends BlankForestryModule {
Circuits.farmArborealManaged = new CircuitFarmLogic("managedArboreal", new FarmLogicArboreal());
Circuits.farmShroomManaged = new CircuitFarmLogic("managedShroom", new FarmLogicMushroom());
Circuits.farmPeatManaged = new CircuitFarmLogic("managedPeat", new FarmLogicPeat());
- Circuits.farmCerealManaged = new CircuitFarmLogic("managedCereal", new FarmLogicCereal());
- Circuits.farmVegetableManaged = new CircuitFarmLogic("managedVegetable", new FarmLogicVegetable());
+ Circuits.farmCropsManaged = new CircuitFarmLogic("managedCrops", new FarmLogicCrops());
Circuits.farmInfernalManaged = new CircuitFarmLogic("managedInfernal", new FarmLogicInfernal());
Circuits.farmPeatManual = new CircuitFarmLogic("manualPeat", new FarmLogicPeat()).setManual();
Circuits.farmShroomManual = new CircuitFarmLogic("manualShroom", new FarmLogicMushroom()).setManual();
- Circuits.farmCerealManual = new CircuitFarmLogic("manualCereal", new FarmLogicCereal()).setManual();
- Circuits.farmVegetableManual = new CircuitFarmLogic("manualVegetable", new FarmLogicVegetable()).setManual();
+ Circuits.farmCropsManual = new CircuitFarmLogic("manualCrops", new FarmLogicCrops()).setManual();
Circuits.farmSucculentManual = new CircuitFarmLogic("manualSucculent", new FarmLogicSucculent()).setManual();
Circuits.farmPoalesManual = new CircuitFarmLogic("manualPoales", new FarmLogicReeds()).setManual();
Circuits.farmGourdManual = new CircuitFarmLogic("manualGourd", new FarmLogicGourd()).setManual();
@@ -209,9 +200,10 @@ public class ModuleFarming extends BlankForestryModule {
// Make Forestry farming logics accessible to plugins via FarmRegistry
FarmRegistry.getInstance().registerFarmLogic("farmArboreal",((CircuitFarmLogic)Circuits.farmArborealManaged).getFarmLogic());
FarmRegistry.getInstance().registerFarmLogic("farmShroom",((CircuitFarmLogic)Circuits.farmShroomManaged).getFarmLogic());
- FarmRegistry.getInstance().registerFarmLogic("farmWheat",((CircuitFarmLogic)Circuits.farmCerealManaged).getFarmLogic());
- FarmRegistry.getInstance().registerFarmLogic("farmVegetables",((CircuitFarmLogic)Circuits.farmVegetableManaged).getFarmLogic());
+ FarmRegistry.getInstance().registerFarmLogic("farmCrops",((CircuitFarmLogic)Circuits.farmCropsManaged).getFarmLogic());
FarmRegistry.getInstance().registerFarmLogic("farmInfernal",((CircuitFarmLogic)Circuits.farmInfernalManaged).getFarmLogic());
+ FarmRegistry.getInstance().registerFarmLogic("farmGourd", ((CircuitFarmLogic)Circuits.farmGourdManual).getFarmLogic());
+ FarmRegistry.getInstance().registerFarmLogic("farmPeat", ((CircuitFarmLogic)Circuits.farmPeatManaged).getFarmLogic());
}
@Override
@@ -277,15 +269,13 @@ public class ModuleFarming extends BlankForestryModule {
ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.COPPER, 1), Circuits.farmArborealManaged);
ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.TIN, 1), Circuits.farmPeatManaged);
- ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.BRONZE, 1), Circuits.farmCerealManaged);
- ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.IRON, 1), Circuits.farmVegetableManaged);
+ ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.BRONZE, 1), Circuits.farmCropsManaged);
ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.BLAZE, 1), Circuits.farmInfernalManaged);
ChipsetManager.solderManager.addRecipe(layoutManaged, coreItems.tubes.get(EnumElectronTube.APATITE, 1), Circuits.farmShroomManaged);
ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.COPPER, 1), Circuits.farmOrchardManual);
ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.TIN, 1), Circuits.farmPeatManual);
- ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.BRONZE, 1), Circuits.farmCerealManual);
- ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.IRON, 1), Circuits.farmVegetableManual);
+ ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.BRONZE, 1), Circuits.farmCropsManual);
ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.GOLD, 1), Circuits.farmSucculentManual);
ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.DIAMOND, 1), Circuits.farmPoalesManual);
ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.OBSIDIAN, 1), Circuits.farmGourdManual);
diff --git a/src/main/java/forestry/farming/logic/FarmLogic.java b/src/main/java/forestry/farming/logic/FarmLogic.java
index b5318b478..23c3c9931 100755
--- a/src/main/java/forestry/farming/logic/FarmLogic.java
+++ b/src/main/java/forestry/farming/logic/FarmLogic.java
@@ -118,6 +118,11 @@ public abstract class FarmLogic implements IFarmLogic {
}
}
+ @Override
+ public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
+ // do nothing as soil is not managed by farm
+ }
+
// for debugging
@Override
public String toString() {
diff --git a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java
index 6d6da69bc..29645131e 100755
--- a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java
@@ -145,17 +145,17 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
BlockPos soilPosition = position.down();
IBlockState soilState = world.getBlockState(soilPosition);
if (isAcceptedSoil(soilState)) {
- return plantSapling(world, farmHousing, position);
+ return plantSapling(world, farmHousing, position, direction);
}
}
}
return false;
}
- private boolean plantSapling(World world, IFarmHousing farmHousing, BlockPos position) {
+ private boolean plantSapling(World world, IFarmHousing farmHousing, BlockPos position, FarmDirection direction) {
Collections.shuffle(farmables);
for (IFarmable candidate : farmables) {
- if (farmHousing.plantGermling(candidate, world, position)) {
+ if (farmHousing.plantGermling(candidate, world, position, direction)) {
return true;
}
}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicCereal.java b/src/main/java/forestry/farming/logic/FarmLogicCereal.java
deleted file mode 100755
index 3d148d0f3..000000000
--- a/src/main/java/forestry/farming/logic/FarmLogicCereal.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2014 SirSengir.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the GNU Lesser Public License v3
- * which accompanies this distribution, and is available at
- * http://www.gnu.org/licenses/lgpl-3.0.txt
- *
- * Various Contributors including, but not limited to:
- * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
- ******************************************************************************/
-package forestry.farming.logic;
-
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-
-import forestry.api.core.ForestryAPI;
-
-public class FarmLogicCereal extends FarmLogicCrops {
-
- public FarmLogicCereal() {
- super(ForestryAPI.farmRegistry.getFarmables("farmWheat"));
- }
-
- @Override
- public String getName() {
- if (isManual) {
- return "Manual Farm";
- } else {
- return "Managed Farm";
- }
- }
-
- @Override
- public ItemStack getIconItemStack() {
- return new ItemStack(Items.WHEAT);
- }
-}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicCocoa.java b/src/main/java/forestry/farming/logic/FarmLogicCocoa.java
index 6d9b743bd..5e816d77f 100755
--- a/src/main/java/forestry/farming/logic/FarmLogicCocoa.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicCocoa.java
@@ -35,6 +35,7 @@ import forestry.api.farming.FarmDirection;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
import forestry.api.farming.IFarmable;
+import forestry.farming.logic.farmables.FarmableCocoa;
public class FarmLogicCocoa extends FarmLogic {
private final IFarmable cocoa = new FarmableCocoa();
@@ -73,11 +74,6 @@ public class FarmLogicCocoa extends FarmLogic {
public boolean isAcceptedWindfall(ItemStack stack) {
return false;
}
-
- @Override
- public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
- // do nothing as soil is not managed by farm
- }
@Override
public NonNullList collect(World world, IFarmHousing farmHousing) {
@@ -88,7 +84,6 @@ public class FarmLogicCocoa extends FarmLogic {
@Override
public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
-
if (!lastExtentsCultivation.containsKey(pos)) {
lastExtentsCultivation.put(pos, 0);
}
@@ -99,7 +94,7 @@ public class FarmLogicCocoa extends FarmLogic {
}
BlockPos position = translateWithOffset(pos.up(), direction, lastExtent);
- boolean result = tryPlantingCocoa(world, farmHousing, position);
+ boolean result = tryPlantingCocoa(world, farmHousing, position, direction);
lastExtent++;
lastExtentsCultivation.put(pos, lastExtent);
@@ -128,14 +123,14 @@ public class FarmLogicCocoa extends FarmLogic {
return crops;
}
- private boolean tryPlantingCocoa(World world, IFarmHousing farmHousing, BlockPos position) {
+ private boolean tryPlantingCocoa(World world, IFarmHousing farmHousing, BlockPos position, FarmDirection farmDirection) {
BlockPos.MutableBlockPos current = new BlockPos.MutableBlockPos(position);
IBlockState blockState = world.getBlockState(current);
while (isJungleTreeTrunk(blockState)) {
for (EnumFacing direction : EnumFacing.HORIZONTALS) {
BlockPos candidate = new BlockPos(current.getX() + direction.getFrontOffsetX(), current.getY(), current.getZ() + direction.getFrontOffsetZ());
if (world.isAirBlock(candidate)) {
- return farmHousing.plantGermling(cocoa, world, candidate);
+ return farmHousing.plantGermling(cocoa, world, candidate, farmDirection);
}
}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicCrops.java b/src/main/java/forestry/farming/logic/FarmLogicCrops.java
index 3e77448cf..bf0678a9c 100755
--- a/src/main/java/forestry/farming/logic/FarmLogicCrops.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicCrops.java
@@ -15,6 +15,7 @@ import java.util.Stack;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
@@ -25,10 +26,15 @@ import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
import forestry.api.farming.IFarmable;
import forestry.core.utils.BlockUtil;
+import forestry.farming.FarmRegistry;
-public abstract class FarmLogicCrops extends FarmLogicWatered {
+public class FarmLogicCrops extends FarmLogicWatered {
private final Iterable seeds;
+ public FarmLogicCrops() {
+ this(FarmRegistry.getInstance().getFarmables("farmCrops"));
+ }
+
protected FarmLogicCrops(Iterable seeds) {
super(new ItemStack(Blocks.DIRT), Blocks.FARMLAND.getDefaultState());
@@ -78,16 +84,16 @@ public abstract class FarmLogicCrops extends FarmLogicWatered {
IBlockState groundState = world.getBlockState(position.down());
if (isAcceptedGround(groundState)) {
- return trySetCrop(world, farmHousing, position);
+ return trySetCrop(world, farmHousing, position, direction);
}
}
return false;
}
- private boolean trySetCrop(World world, IFarmHousing farmHousing, BlockPos position) {
+ private boolean trySetCrop(World world, IFarmHousing farmHousing, BlockPos position, FarmDirection direction) {
for (IFarmable candidate : seeds) {
- if (farmHousing.plantGermling(candidate, world, position)) {
+ if (farmHousing.plantGermling(candidate, world, position, direction)) {
return true;
}
}
@@ -112,4 +118,18 @@ public abstract class FarmLogicCrops extends FarmLogicWatered {
return crops;
}
+ @Override
+ public ItemStack getIconItemStack() {
+ return new ItemStack(Items.WHEAT);
+ }
+
+ @Override
+ public String getName() {
+ if (isManual) {
+ return "Manual Crop Farm";
+ } else {
+ return "Managed Crop Farm";
+ }
+ }
+
}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicExU.java b/src/main/java/forestry/farming/logic/FarmLogicExU.java
index 92cac7a94..84b0fd1bd 100644
--- a/src/main/java/forestry/farming/logic/FarmLogicExU.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicExU.java
@@ -13,21 +13,21 @@ package forestry.farming.logic;
import java.util.Collection;
import java.util.Stack;
-import forestry.farming.FarmRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+
import forestry.api.farming.FarmDirection;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
import forestry.api.farming.IFarmable;
import forestry.core.utils.BlockUtil;
+import forestry.farming.FarmRegistry;
public class FarmLogicExU extends FarmLogicHomogeneous {
@@ -102,17 +102,7 @@ public class FarmLogicExU extends FarmLogicHomogeneous {
continue;
}
- return trySetCrop(world, farmHousing, position);
- }
-
- return false;
- }
-
- private boolean trySetCrop(World world, IFarmHousing farmHousing, BlockPos position) {
- for (IFarmable candidate : farmables) {
- if (farmHousing.plantGermling(candidate, world, position)) {
- return true;
- }
+ return trySetCrop(world, farmHousing, position, direction);
}
return false;
diff --git a/src/main/java/forestry/farming/logic/FarmLogicGourd.java b/src/main/java/forestry/farming/logic/FarmLogicGourd.java
index ce62f72a6..ede28bc10 100755
--- a/src/main/java/forestry/farming/logic/FarmLogicGourd.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicGourd.java
@@ -96,10 +96,4 @@ public class FarmLogicGourd extends FarmLogic {
}
return crops;
}
-
- @Override
- public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
- // do nothing as soil is not managed by farm
-
- }
}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java
index 0bee068ea..f719d1690 100644
--- a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java
@@ -13,11 +13,7 @@ package forestry.farming.logic;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import forestry.api.farming.FarmDirection;
-import forestry.api.farming.IFarmHousing;
-import forestry.api.farming.IFarmable;
-import forestry.core.utils.BlockUtil;
-import forestry.farming.FarmHelper;
+
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@@ -25,9 +21,12 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
-public abstract class FarmLogicHomogeneous extends FarmLogic {
+import forestry.api.farming.FarmDirection;
+import forestry.api.farming.IFarmHousing;
+import forestry.api.farming.IFarmable;
+import forestry.core.utils.BlockUtil;
- private final List soils = new ArrayList<>();
+public abstract class FarmLogicHomogeneous extends FarmLogicSoil {
protected final List farmables;
protected NonNullList produce = NonNullList.create();
@@ -36,10 +35,6 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
addSoil(resource, soilState, false);
this.farmables = new ArrayList<>(farmables);
}
-
- public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData){
- soils.add(new Soil(resource, soilState, hasMetaData));
- }
protected boolean isAcceptedSoil(IBlockState blockState) {
for(Soil soil : soils){
@@ -86,6 +81,26 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
return false;
}
+ protected boolean trySetCrop(World world, IFarmHousing farmHousing, BlockPos position, FarmDirection direction, boolean shuffle) {
+ for (IFarmable candidate : farmables) {
+ if (farmHousing.plantGermling(candidate, world, position, direction)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ protected boolean trySetCrop(World world, IFarmHousing farmHousing, BlockPos position, FarmDirection direction) {
+ for (IFarmable candidate : farmables) {
+ if (farmHousing.plantGermling(candidate, world, position, direction)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
@Override
public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
return maintainSoil(world, farmHousing, pos, direction, extent) ||
@@ -104,7 +119,7 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
BlockPos position = translateWithOffset(pos, direction, i);
IBlockState soilState = world.getBlockState(position);
- if (FarmHelper.bricks.contains(soilState.getBlock())) {
+ if (farmHousing.isValidPlatform(world, pos)) {
break;
}
@@ -113,8 +128,7 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
}
BlockPos platformPosition = position.down();
- IBlockState platformState = world.getBlockState(platformPosition);
- if (!FarmHelper.bricks.contains(platformState.getBlock())) {
+ if (!farmHousing.isValidPlatform(world, platformPosition)) {
break;
}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicInfernal.java b/src/main/java/forestry/farming/logic/FarmLogicInfernal.java
index ada4a287f..c84476578 100755
--- a/src/main/java/forestry/farming/logic/FarmLogicInfernal.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicInfernal.java
@@ -90,17 +90,7 @@ public class FarmLogicInfernal extends FarmLogicHomogeneous {
BlockPos soilPosition = position.down();
IBlockState soilState = world.getBlockState(soilPosition);
if (isAcceptedSoil(soilState)) {
- return trySetCrop(world, farmHousing, position);
- }
- }
-
- return false;
- }
-
- private boolean trySetCrop(World world, IFarmHousing farmHousing, BlockPos position) {
- for (IFarmable candidate : farmables) {
- if (farmHousing.plantGermling(candidate, world, position)) {
- return true;
+ return trySetCrop(world, farmHousing, position, direction);
}
}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java
index 3d486f326..cb8501bb1 100644
--- a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java
@@ -36,6 +36,7 @@ import forestry.api.farming.IFarmable;
import forestry.api.genetics.IFruitBearer;
import forestry.core.ModuleCore;
import forestry.core.tiles.TileUtil;
+import forestry.farming.logic.crops.CropFruit;
public class FarmLogicOrchard extends FarmLogic {
@@ -105,7 +106,6 @@ public class FarmLogicOrchard extends FarmLogic {
@Override
public Collection harvest(World world, BlockPos pos, FarmDirection direction, int extent) {
-
if (!lastExtents.containsKey(pos)) {
lastExtents.put(pos, 0);
}
@@ -132,11 +132,6 @@ public class FarmLogicOrchard extends FarmLogic {
public String getName() {
return "Orchard";
}
-
- @Override
- public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
- // do nothing as soil is not managed by farm
- }
private Collection getHarvestBlocks(World world, BlockPos position) {
Set seen = new HashSet<>();
@@ -235,7 +230,6 @@ public class FarmLogicOrchard extends FarmLogic {
@Nullable
private ICrop getCrop(World world, BlockPos position) {
-
IFruitBearer fruitBearer = TileUtil.getTile(world, position, IFruitBearer.class);
if (fruitBearer != null) {
diff --git a/src/main/java/forestry/farming/logic/FarmLogicPeat.java b/src/main/java/forestry/farming/logic/FarmLogicPeat.java
index 1bf4022eb..85c4bef7a 100755
--- a/src/main/java/forestry/farming/logic/FarmLogicPeat.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicPeat.java
@@ -23,6 +23,7 @@ import forestry.api.farming.FarmDirection;
import forestry.api.farming.ICrop;
import forestry.core.ModuleCore;
import forestry.core.blocks.BlockBogEarth;
+import forestry.farming.logic.crops.CropPeat;
public class FarmLogicPeat extends FarmLogicWatered {
private static final ItemStack bogEarth = ModuleCore.getBlocks().bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, 1);
diff --git a/src/main/java/forestry/farming/logic/FarmLogicReeds.java b/src/main/java/forestry/farming/logic/FarmLogicReeds.java
index 986a72cca..cc32c662b 100644
--- a/src/main/java/forestry/farming/logic/FarmLogicReeds.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicReeds.java
@@ -10,16 +10,9 @@
******************************************************************************/
package forestry.farming.logic;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Stack;
-import forestry.api.farming.FarmDirection;
-import forestry.api.farming.ICrop;
-import forestry.api.farming.IFarmHousing;
-import forestry.api.farming.IFarmable;
-import forestry.core.utils.ItemStackUtil;
-import forestry.farming.FarmRegistry;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -27,23 +20,15 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+
import forestry.api.farming.FarmDirection;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
import forestry.api.farming.IFarmable;
import forestry.farming.FarmRegistry;
-import forestry.api.core.ForestryAPI;
-import forestry.api.farming.FarmDirection;
-import forestry.api.farming.ICrop;
-import forestry.api.farming.IFarmHousing;
-import forestry.api.farming.IFarmable;
-import forestry.core.utils.ItemStackUtil;
-
-public class FarmLogicReeds extends FarmLogic {
-
+public class FarmLogicReeds extends FarmLogicSoil {
private final Collection germlings = FarmRegistry.getInstance().getFarmables("farmPoales");
- private ArrayList soils = new ArrayList<>();
public FarmLogicReeds() {
@@ -65,11 +50,6 @@ public class FarmLogicReeds extends FarmLogic {
}
}
- @Override
- public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
- this.soils.add(new Soil(resource,soilState,hasMetaData));
- }
-
@Override
public int getFertilizerConsumption() {
return 10;
diff --git a/src/main/java/forestry/farming/logic/FarmLogicRubber.java b/src/main/java/forestry/farming/logic/FarmLogicRubber.java
index 3e9cb8df0..66da5f732 100755
--- a/src/main/java/forestry/farming/logic/FarmLogicRubber.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicRubber.java
@@ -27,6 +27,7 @@ import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
+import forestry.farming.logic.crops.CropRubber;
import forestry.plugins.PluginIC2;
public class FarmLogicRubber extends FarmLogic {
@@ -130,10 +131,5 @@ public class FarmLogicRubber extends FarmLogic {
return crops;
}
-
- @Override
- public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
- // do nothing as soil is not managed by farm
- }
}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicSoil.java b/src/main/java/forestry/farming/logic/FarmLogicSoil.java
new file mode 100644
index 000000000..d58e1f53c
--- /dev/null
+++ b/src/main/java/forestry/farming/logic/FarmLogicSoil.java
@@ -0,0 +1,20 @@
+package forestry.farming.logic;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.item.ItemStack;
+
+public abstract class FarmLogicSoil extends FarmLogic {
+ protected final Set soils = new HashSet<>();
+
+ public FarmLogicSoil() {
+ }
+
+ @Override
+ public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
+ soils.add(new Soil(resource,soilState,hasMetaData));
+ }
+
+}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicSucculent.java b/src/main/java/forestry/farming/logic/FarmLogicSucculent.java
index e53b76870..560162033 100755
--- a/src/main/java/forestry/farming/logic/FarmLogicSucculent.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicSucculent.java
@@ -10,7 +10,6 @@
******************************************************************************/
package forestry.farming.logic;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Stack;
@@ -21,6 +20,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+
import forestry.api.farming.FarmDirection;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
@@ -28,10 +28,8 @@ import forestry.api.farming.IFarmable;
import forestry.core.utils.ItemStackUtil;
import forestry.farming.FarmRegistry;
-public class FarmLogicSucculent extends FarmLogic {
-
+public class FarmLogicSucculent extends FarmLogicSoil {
private final Collection germlings = FarmRegistry.getInstance().getFarmables("farmSucculentes");
- private ArrayList soils = new ArrayList<>();
public FarmLogicSucculent() {
addSoil(new ItemStack(Blocks.SAND), Blocks.SAND.getDefaultState(),true);
@@ -50,11 +48,6 @@ public class FarmLogicSucculent extends FarmLogic {
return "Managed Succulent Farm";
}
}
-
- @Override
- public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
- this.soils.add(new Soil(resource,soilState,hasMetaData));
- }
@Override
public int getFertilizerConsumption() {
diff --git a/src/main/java/forestry/farming/logic/FarmLogicVegetable.java b/src/main/java/forestry/farming/logic/FarmLogicVegetable.java
deleted file mode 100755
index 7a7fda24f..000000000
--- a/src/main/java/forestry/farming/logic/FarmLogicVegetable.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2014 SirSengir.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the GNU Lesser Public License v3
- * which accompanies this distribution, and is available at
- * http://www.gnu.org/licenses/lgpl-3.0.txt
- *
- * Various Contributors including, but not limited to:
- * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
- ******************************************************************************/
-package forestry.farming.logic;
-
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-
-import forestry.farming.FarmRegistry;
-
-public class FarmLogicVegetable extends FarmLogicCrops {
-
- public FarmLogicVegetable() {
- super(FarmRegistry.getInstance().getFarmables("farmVegetables"));
- }
-
- @Override
- public ItemStack getIconItemStack() {
- return new ItemStack(Items.CARROT);
- }
-
- @Override
- public String getName() {
- if (isManual) {
- return "Manual Vegetable Farm";
- } else {
- return "Managed Vegetable Farm";
- }
- }
-
-}
diff --git a/src/main/java/forestry/farming/logic/FarmLogicWatered.java b/src/main/java/forestry/farming/logic/FarmLogicWatered.java
index 7102a54b0..e7143f186 100755
--- a/src/main/java/forestry/farming/logic/FarmLogicWatered.java
+++ b/src/main/java/forestry/farming/logic/FarmLogicWatered.java
@@ -10,9 +10,6 @@
******************************************************************************/
package forestry.farming.logic;
-import java.util.ArrayList;
-import java.util.List;
-
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@@ -20,19 +17,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
+
import forestry.api.farming.FarmDirection;
import forestry.api.farming.IFarmHousing;
import forestry.core.utils.BlockUtil;
-import forestry.farming.FarmHelper;
-public abstract class FarmLogicWatered extends FarmLogic {
-
-
- private final List soils = new ArrayList<>();
-
+public abstract class FarmLogicWatered extends FarmLogicSoil {
private static final FluidStack STACK_WATER = new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME);
protected NonNullList produce = NonNullList.create();
@@ -40,11 +34,6 @@ public abstract class FarmLogicWatered extends FarmLogic {
protected FarmLogicWatered(ItemStack resource, IBlockState ground) {
addSoil(resource,ground,false);
}
-
- @Override
- public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
- soils.add(new Soil(resource,soilState,hasMetaData));
- }
@Override
public int getFertilizerConsumption() {
@@ -99,11 +88,8 @@ public abstract class FarmLogicWatered extends FarmLogic {
return true;
}
- if (maintainCrops(world, farmHousing, pos.up(), direction, extent)) {
- return true;
- }
+ return maintainCrops(world, farmHousing, pos.up(), direction, extent);
- return false;
}
private boolean maintainSoil(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
@@ -119,8 +105,7 @@ public abstract class FarmLogicWatered extends FarmLogic {
}
BlockPos platformPosition = position.down();
- IBlockState blockState = world.getBlockState(platformPosition);
- if (!FarmHelper.bricks.contains(blockState.getBlock())) {
+ if (!farmHousing.isValidPlatform(world, platformPosition)) {
break;
}
@@ -149,8 +134,7 @@ public abstract class FarmLogicWatered extends FarmLogic {
BlockPos position = translateWithOffset(pos, direction, i);
BlockPos platformPosition = position.down();
- IBlockState blockState = world.getBlockState(platformPosition);
- if (!FarmHelper.bricks.contains(blockState.getBlock())) {
+ if (!farmHousing.isValidPlatform(world, platformPosition)) {
break;
}
diff --git a/src/main/java/forestry/farming/logic/Crop.java b/src/main/java/forestry/farming/logic/crops/Crop.java
old mode 100755
new mode 100644
similarity index 97%
rename from src/main/java/forestry/farming/logic/Crop.java
rename to src/main/java/forestry/farming/logic/crops/Crop.java
index fc2e1636a..9cb0ba818
--- a/src/main/java/forestry/farming/logic/Crop.java
+++ b/src/main/java/forestry/farming/logic/crops/Crop.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.crops;
import javax.annotation.Nullable;
diff --git a/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java b/src/main/java/forestry/farming/logic/crops/CropBasicAgriCraft.java
similarity index 98%
rename from src/main/java/forestry/farming/logic/CropBasicAgriCraft.java
rename to src/main/java/forestry/farming/logic/crops/CropBasicAgriCraft.java
index b17359173..6ec4cf8ef 100644
--- a/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java
+++ b/src/main/java/forestry/farming/logic/crops/CropBasicAgriCraft.java
@@ -8,9 +8,8 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.crops;
-import forestry.core.utils.BlockUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@@ -18,6 +17,8 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+import forestry.core.utils.BlockUtil;
+
public class CropBasicAgriCraft extends Crop {
private final IBlockState blockState;
diff --git a/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java b/src/main/java/forestry/farming/logic/crops/CropBasicGrowthCraft.java
similarity index 98%
rename from src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java
rename to src/main/java/forestry/farming/logic/crops/CropBasicGrowthCraft.java
index 811d54d70..59b2401cc 100644
--- a/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java
+++ b/src/main/java/forestry/farming/logic/crops/CropBasicGrowthCraft.java
@@ -8,11 +8,8 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.crops;
-import forestry.core.config.Constants;
-import forestry.core.network.packets.PacketFXSignal;
-import forestry.core.utils.NetworkUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@@ -20,6 +17,10 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+import forestry.core.config.Constants;
+import forestry.core.network.packets.PacketFXSignal;
+import forestry.core.utils.NetworkUtil;
+
public class CropBasicGrowthCraft extends Crop {
private final IBlockState blockState;
diff --git a/src/main/java/forestry/farming/logic/CropBasicIC2Crop.java b/src/main/java/forestry/farming/logic/crops/CropBasicIC2Crop.java
similarity index 95%
rename from src/main/java/forestry/farming/logic/CropBasicIC2Crop.java
rename to src/main/java/forestry/farming/logic/crops/CropBasicIC2Crop.java
index 64cc5315e..ba5444119 100644
--- a/src/main/java/forestry/farming/logic/CropBasicIC2Crop.java
+++ b/src/main/java/forestry/farming/logic/crops/CropBasicIC2Crop.java
@@ -1,4 +1,4 @@
-package forestry.farming.logic;
+package forestry.farming.logic.crops;
import javax.annotation.Nonnull;
@@ -12,7 +12,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.common.Optional;
import forestry.plugins.PluginIC2;
-
import ic2.api.crops.ICropTile;
public class CropBasicIC2Crop extends Crop {
@@ -40,10 +39,7 @@ public class CropBasicIC2Crop extends Crop {
*/
@Optional.Method(modid = PluginIC2.modId)
public static boolean isIC2Crop(TileEntity tileEntity) {
- if (tileEntity instanceof ICropTile) {
- return true;
- }
- return false;
+ return tileEntity instanceof ICropTile;
}
/**
diff --git a/src/main/java/forestry/farming/logic/CropDestroy.java b/src/main/java/forestry/farming/logic/crops/CropDestroy.java
similarity index 98%
rename from src/main/java/forestry/farming/logic/CropDestroy.java
rename to src/main/java/forestry/farming/logic/crops/CropDestroy.java
index 96f30285b..bd9d68263 100644
--- a/src/main/java/forestry/farming/logic/CropDestroy.java
+++ b/src/main/java/forestry/farming/logic/crops/CropDestroy.java
@@ -8,13 +8,10 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.crops;
import javax.annotation.Nullable;
-import forestry.core.config.Constants;
-import forestry.core.network.packets.PacketFXSignal;
-import forestry.core.utils.NetworkUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@@ -22,6 +19,10 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+import forestry.core.config.Constants;
+import forestry.core.network.packets.PacketFXSignal;
+import forestry.core.utils.NetworkUtil;
+
public class CropDestroy extends Crop {
protected final IBlockState blockState;
diff --git a/src/main/java/forestry/farming/logic/CropDestroyDouble.java b/src/main/java/forestry/farming/logic/crops/CropDestroyDouble.java
similarity index 91%
rename from src/main/java/forestry/farming/logic/CropDestroyDouble.java
rename to src/main/java/forestry/farming/logic/crops/CropDestroyDouble.java
index d8a21ff52..fea34f0ae 100644
--- a/src/main/java/forestry/farming/logic/CropDestroyDouble.java
+++ b/src/main/java/forestry/farming/logic/crops/CropDestroyDouble.java
@@ -1,4 +1,4 @@
-package forestry.farming.logic;
+package forestry.farming.logic.crops;
import javax.annotation.Nullable;
@@ -37,8 +37,8 @@ public class CropDestroyDouble extends Crop {
Block block = blockState.getBlock();
Block blockUp = blockStateUp.getBlock();
NonNullList harvested = NonNullList.create();
- harvested.addAll(block.getDrops(world, pos, blockState, 0));
- harvested.addAll(blockUp.getDrops(world, pos.up(), blockStateUp, 0));
+ block.getDrops(harvested, world, pos, blockState, 0);
+ blockUp.getDrops(harvested, world, pos.up(), blockStateUp, 0);
PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK, PacketFXSignal.SoundFXType.BLOCK_BREAK, pos, blockState);
NetworkUtil.sendNetworkPacket(packet, pos, world);
diff --git a/src/main/java/forestry/farming/logic/CropFruit.java b/src/main/java/forestry/farming/logic/crops/CropFruit.java
old mode 100755
new mode 100644
similarity index 97%
rename from src/main/java/forestry/farming/logic/CropFruit.java
rename to src/main/java/forestry/farming/logic/crops/CropFruit.java
index 880cee929..27304ce1d
--- a/src/main/java/forestry/farming/logic/CropFruit.java
+++ b/src/main/java/forestry/farming/logic/crops/CropFruit.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.crops;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
diff --git a/src/main/java/forestry/farming/logic/CropPeat.java b/src/main/java/forestry/farming/logic/crops/CropPeat.java
old mode 100755
new mode 100644
similarity index 98%
rename from src/main/java/forestry/farming/logic/CropPeat.java
rename to src/main/java/forestry/farming/logic/crops/CropPeat.java
index c92659ede..a0ad615ec
--- a/src/main/java/forestry/farming/logic/CropPeat.java
+++ b/src/main/java/forestry/farming/logic/crops/CropPeat.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.crops;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
diff --git a/src/main/java/forestry/farming/logic/CropRubber.java b/src/main/java/forestry/farming/logic/crops/CropRubber.java
old mode 100755
new mode 100644
similarity index 98%
rename from src/main/java/forestry/farming/logic/CropRubber.java
rename to src/main/java/forestry/farming/logic/crops/CropRubber.java
index dc11ef1e2..47572d1e2
--- a/src/main/java/forestry/farming/logic/CropRubber.java
+++ b/src/main/java/forestry/farming/logic/crops/CropRubber.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.crops;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableCollection;
diff --git a/src/main/java/forestry/farming/logic/crops/package-info.java b/src/main/java/forestry/farming/logic/crops/package-info.java
new file mode 100644
index 000000000..479c24953
--- /dev/null
+++ b/src/main/java/forestry/farming/logic/crops/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.farming.logic.crops;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/farming/logic/FarmableAgingCrop.java b/src/main/java/forestry/farming/logic/farmables/FarmableAgingCrop.java
similarity index 96%
rename from src/main/java/forestry/farming/logic/FarmableAgingCrop.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableAgingCrop.java
index 222dec7a8..53f539291 100644
--- a/src/main/java/forestry/farming/logic/FarmableAgingCrop.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableAgingCrop.java
@@ -1,11 +1,9 @@
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
+
+import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
-import com.google.common.base.Preconditions;
-import forestry.api.farming.ICrop;
-import forestry.api.farming.IFarmable;
-import forestry.core.utils.BlockUtil;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
@@ -14,6 +12,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+import forestry.api.farming.ICrop;
+import forestry.api.farming.IFarmable;
+import forestry.core.utils.BlockUtil;
+import forestry.farming.logic.crops.CropDestroy;
+
/**
* For blocks that are harvestable once they are a certain age.
*/
diff --git a/src/main/java/forestry/farming/logic/FarmableBase.java b/src/main/java/forestry/farming/logic/farmables/FarmableBase.java
similarity index 94%
rename from src/main/java/forestry/farming/logic/FarmableBase.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableBase.java
index 01dccc01e..5a83ffadd 100644
--- a/src/main/java/forestry/farming/logic/FarmableBase.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableBase.java
@@ -1,14 +1,16 @@
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
-import forestry.api.farming.ICrop;
-import forestry.api.farming.IFarmable;
-import forestry.core.utils.BlockUtil;
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;
+import forestry.api.farming.ICrop;
+import forestry.api.farming.IFarmable;
+import forestry.core.utils.BlockUtil;
+import forestry.farming.logic.crops.CropDestroy;
+
public abstract class FarmableBase implements IFarmable {
protected final ItemStack germling;
protected final IBlockState plantedState;
diff --git a/src/main/java/forestry/farming/logic/FarmableBasicAgricraft.java b/src/main/java/forestry/farming/logic/farmables/FarmableBasicAgricraft.java
similarity index 92%
rename from src/main/java/forestry/farming/logic/FarmableBasicAgricraft.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableBasicAgricraft.java
index a3391c911..a13a4e1ea 100644
--- a/src/main/java/forestry/farming/logic/FarmableBasicAgricraft.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableBasicAgricraft.java
@@ -8,14 +8,16 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
-import forestry.api.farming.ICrop;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+import forestry.api.farming.ICrop;
+import forestry.farming.logic.crops.CropBasicAgriCraft;
+
public class FarmableBasicAgricraft extends FarmableBase {
public FarmableBasicAgricraft(ItemStack germling, IBlockState plantedState, IBlockState matureState, boolean replant) {
super(germling, plantedState, matureState, replant);
diff --git a/src/main/java/forestry/farming/logic/FarmableBasicGrowthCraft.java b/src/main/java/forestry/farming/logic/farmables/FarmableBasicGrowthCraft.java
similarity index 97%
rename from src/main/java/forestry/farming/logic/FarmableBasicGrowthCraft.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableBasicGrowthCraft.java
index fe5c42420..c3e863f8a 100644
--- a/src/main/java/forestry/farming/logic/FarmableBasicGrowthCraft.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableBasicGrowthCraft.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
//TODO GrowthCraft for 1.9
public class FarmableBasicGrowthCraft {
diff --git a/src/main/java/forestry/farming/logic/FarmableBasicIC2Crop.java b/src/main/java/forestry/farming/logic/farmables/FarmableBasicIC2Crop.java
similarity index 95%
rename from src/main/java/forestry/farming/logic/FarmableBasicIC2Crop.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableBasicIC2Crop.java
index 944792619..42627e27c 100644
--- a/src/main/java/forestry/farming/logic/FarmableBasicIC2Crop.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableBasicIC2Crop.java
@@ -1,4 +1,4 @@
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import javax.annotation.Nullable;
@@ -13,8 +13,8 @@ import net.minecraftforge.fml.common.Optional;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
+import forestry.farming.logic.crops.CropBasicIC2Crop;
import forestry.plugins.PluginIC2;
-
import ic2.api.crops.ICropTile;
public class FarmableBasicIC2Crop implements IFarmable {
diff --git a/src/main/java/forestry/farming/logic/FarmableCocoa.java b/src/main/java/forestry/farming/logic/farmables/FarmableCocoa.java
old mode 100755
new mode 100644
similarity index 96%
rename from src/main/java/forestry/farming/logic/FarmableCocoa.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableCocoa.java
index 0f821f020..1c35f2788
--- a/src/main/java/forestry/farming/logic/FarmableCocoa.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableCocoa.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import net.minecraft.block.BlockCocoa;
import net.minecraft.entity.player.EntityPlayer;
diff --git a/src/main/java/forestry/farming/logic/FarmableDoubleCrop.java b/src/main/java/forestry/farming/logic/farmables/FarmableDoubleCrop.java
similarity index 91%
rename from src/main/java/forestry/farming/logic/FarmableDoubleCrop.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableDoubleCrop.java
index d524506ac..5e3b62a2e 100644
--- a/src/main/java/forestry/farming/logic/FarmableDoubleCrop.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableDoubleCrop.java
@@ -1,4 +1,4 @@
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@@ -6,6 +6,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.farming.ICrop;
+import forestry.farming.logic.crops.CropDestroyDouble;
public class FarmableDoubleCrop extends FarmableBase {
private final IBlockState topMatureState;
diff --git a/src/main/java/forestry/farming/logic/FarmableGE.java b/src/main/java/forestry/farming/logic/farmables/FarmableGE.java
old mode 100755
new mode 100644
similarity index 95%
rename from src/main/java/forestry/farming/logic/FarmableGE.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableGE.java
index 208f07e81..0ccbf303c
--- a/src/main/java/forestry/farming/logic/FarmableGE.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableGE.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -23,6 +23,7 @@ import forestry.api.arboriculture.TreeManager;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
import forestry.arboriculture.ModuleArboriculture;
+import forestry.farming.logic.crops.CropDestroy;
public class FarmableGE implements IFarmable {
diff --git a/src/main/java/forestry/farming/logic/FarmableGourd.java b/src/main/java/forestry/farming/logic/farmables/FarmableGourd.java
old mode 100755
new mode 100644
similarity index 95%
rename from src/main/java/forestry/farming/logic/FarmableGourd.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableGourd.java
index 3c1efe3b2..6cd382579
--- a/src/main/java/forestry/farming/logic/FarmableGourd.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableGourd.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -20,6 +20,7 @@ import net.minecraft.world.World;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
import forestry.core.utils.BlockUtil;
+import forestry.farming.logic.crops.CropDestroy;
public class FarmableGourd implements IFarmable {
diff --git a/src/main/java/forestry/farming/logic/FarmableRusticGrape.java b/src/main/java/forestry/farming/logic/farmables/FarmableRusticGrape.java
similarity index 94%
rename from src/main/java/forestry/farming/logic/FarmableRusticGrape.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableRusticGrape.java
index 598103d91..4fbde5151 100644
--- a/src/main/java/forestry/farming/logic/FarmableRusticGrape.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableRusticGrape.java
@@ -1,4 +1,4 @@
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import com.google.common.base.Preconditions;
@@ -14,6 +14,7 @@ import net.minecraft.world.World;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
+import forestry.farming.logic.crops.CropDestroy;
public class FarmableRusticGrape implements IFarmable {
public static final PropertyBool GRAPES = PropertyBool.create("grapes");
diff --git a/src/main/java/forestry/farming/logic/FarmableRusticSapling.java b/src/main/java/forestry/farming/logic/farmables/FarmableRusticSapling.java
similarity index 95%
rename from src/main/java/forestry/farming/logic/FarmableRusticSapling.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableRusticSapling.java
index 7ca0e7e33..79e321e88 100644
--- a/src/main/java/forestry/farming/logic/FarmableRusticSapling.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableRusticSapling.java
@@ -1,4 +1,4 @@
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -12,6 +12,7 @@ import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
import forestry.core.network.packets.PacketFXSignal;
import forestry.core.utils.NetworkUtil;
+import forestry.farming.logic.crops.CropDestroy;
public class FarmableRusticSapling implements IFarmable {
diff --git a/src/main/java/forestry/farming/logic/FarmableSapling.java b/src/main/java/forestry/farming/logic/farmables/FarmableSapling.java
similarity index 97%
rename from src/main/java/forestry/farming/logic/FarmableSapling.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableSapling.java
index cd3d2553d..95df1a937 100644
--- a/src/main/java/forestry/farming/logic/FarmableSapling.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableSapling.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -26,6 +26,7 @@ import forestry.api.farming.IFarmable;
import forestry.core.network.packets.PacketFXSignal;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.NetworkUtil;
+import forestry.farming.logic.crops.CropDestroy;
public class FarmableSapling implements IFarmable {
protected final ItemStack germling;
diff --git a/src/main/java/forestry/farming/logic/FarmableStacked.java b/src/main/java/forestry/farming/logic/farmables/FarmableStacked.java
old mode 100755
new mode 100644
similarity index 95%
rename from src/main/java/forestry/farming/logic/FarmableStacked.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableStacked.java
index 2bc8bea39..adc3f3e8d
--- a/src/main/java/forestry/farming/logic/FarmableStacked.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableStacked.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -20,6 +20,7 @@ import net.minecraft.world.World;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
import forestry.core.utils.BlockUtil;
+import forestry.farming.logic.crops.CropDestroy;
public class FarmableStacked implements IFarmable {
protected final ItemStack germling;
diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java b/src/main/java/forestry/farming/logic/farmables/FarmableVanillaMushroom.java
similarity index 93%
rename from src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableVanillaMushroom.java
index ab3af235b..57333114b 100644
--- a/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableVanillaMushroom.java
@@ -8,15 +8,17 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
-import forestry.api.farming.ICrop;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+import forestry.api.farming.ICrop;
+import forestry.farming.logic.crops.CropDestroy;
+
public class FarmableVanillaMushroom extends FarmableBase {
private final Block hugeMushroomBlock;
diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java b/src/main/java/forestry/farming/logic/farmables/FarmableVanillaSapling.java
old mode 100755
new mode 100644
similarity index 95%
rename from src/main/java/forestry/farming/logic/FarmableVanillaSapling.java
rename to src/main/java/forestry/farming/logic/farmables/FarmableVanillaSapling.java
index c22cc397e..7009613b4
--- a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java
+++ b/src/main/java/forestry/farming/logic/farmables/FarmableVanillaSapling.java
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
-package forestry.farming.logic;
+package forestry.farming.logic.farmables;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
diff --git a/src/main/java/forestry/farming/logic/farmables/package-info.java b/src/main/java/forestry/farming/logic/farmables/package-info.java
new file mode 100644
index 000000000..661f5e768
--- /dev/null
+++ b/src/main/java/forestry/farming/logic/farmables/package-info.java
@@ -0,0 +1,10 @@
+@ParametersAreNonnullByDefault
+@FieldsAreNonnullByDefault
+@MethodsReturnNonnullByDefault
+package forestry.farming.logic.farmables;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import mcp.MethodsReturnNonnullByDefault;
+
+import forestry.core.utils.FieldsAreNonnullByDefault;
\ No newline at end of file
diff --git a/src/main/java/forestry/farming/multiblock/FakeFarmController.java b/src/main/java/forestry/farming/multiblock/FakeFarmController.java
index a9ed92059..db497891c 100644
--- a/src/main/java/forestry/farming/multiblock/FakeFarmController.java
+++ b/src/main/java/forestry/farming/multiblock/FakeFarmController.java
@@ -10,6 +10,15 @@
******************************************************************************/
package forestry.farming.multiblock;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.NonNullList;
+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.circuits.CircuitSocketType;
import forestry.api.circuits.ICircuitSocketType;
import forestry.api.farming.FarmDirection;
@@ -23,13 +32,6 @@ import forestry.core.inventory.IInventoryAdapter;
import forestry.core.multiblock.FakeMultiblockController;
import forestry.farming.gui.IFarmLedgerDelegate;
import forestry.farming.logic.FarmLogicArboreal;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.NonNullList;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.Vec3i;
-import net.minecraft.world.World;
-import net.minecraftforge.fluids.FluidStack;
public class FakeFarmController extends FakeMultiblockController implements IFarmControllerInternal {
public static final FakeFarmController instance = new FakeFarmController();
@@ -138,6 +140,11 @@ public class FakeFarmController extends FakeMultiblockController implements IFar
return "for.multiblock.farm.type";
}
+ @Override
+ public boolean isValidPlatform(World world, BlockPos pos) {
+ return false;
+ }
+
private static class FakeFarmInventory implements IFarmInventory {
public static final FakeFarmInventory instance = new FakeFarmInventory();
diff --git a/src/main/java/forestry/farming/multiblock/FarmController.java b/src/main/java/forestry/farming/multiblock/FarmController.java
index a7a4371d8..27dd0941d 100755
--- a/src/main/java/forestry/farming/multiblock/FarmController.java
+++ b/src/main/java/forestry/farming/multiblock/FarmController.java
@@ -15,11 +15,9 @@ import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
@@ -50,7 +48,6 @@ import forestry.api.core.EnumTemperature;
import forestry.api.core.IErrorLogic;
import forestry.api.farming.FarmDirection;
import forestry.api.farming.ICrop;
-import forestry.api.farming.IFarmHousing;
import forestry.api.farming.IFarmInventory;
import forestry.api.farming.IFarmListener;
import forestry.api.farming.IFarmLogic;
@@ -73,9 +70,10 @@ import forestry.core.network.PacketBufferForestry;
import forestry.core.tiles.ILiquidTankTile;
import forestry.core.utils.ClimateUtil;
import forestry.core.utils.PlayerUtil;
-import forestry.core.utils.TopDownBlockPosComparator;
import forestry.core.utils.Translator;
import forestry.farming.FarmHelper;
+import forestry.farming.FarmHelper.FarmWorkStatus;
+import forestry.farming.FarmHelper.Stage;
import forestry.farming.FarmTarget;
import forestry.farming.gui.IFarmLedgerDelegate;
import forestry.farming.logic.FarmLogicArboreal;
@@ -84,32 +82,6 @@ import forestry.farming.tiles.TileFarmPlain;
public class FarmController extends RectangularMultiblockControllerBase implements IFarmControllerInternal, ILiquidTankTile {
- private enum Stage {
- CULTIVATE, HARVEST;
-
- public Stage next() {
- if (this == CULTIVATE) {
- return HARVEST;
- } else {
- return CULTIVATE;
- }
- }
- }
-
- private static FarmDirection getLayoutDirection(FarmDirection farmSide) {
- switch (farmSide) {
- case NORTH:
- return FarmDirection.WEST;
- case WEST:
- return FarmDirection.SOUTH;
- case SOUTH:
- return FarmDirection.EAST;
- case EAST:
- return FarmDirection.NORTH;
- }
- return null;
- }
-
private final Map> targets = new EnumMap<>(FarmDirection.class);
private int allowedExtent = 0;
@Nullable
@@ -473,11 +445,11 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
List farmTargets = targets.get(farmSide);
if (stage == Stage.HARVEST) {
- Collection harvested = harvestTargets(world, farmTargets, logic, farmListeners);
+ Collection harvested = FarmHelper.harvestTargets(world, farmTargets, logic, farmListeners);
farmWorkStatus.didWork = !harvested.isEmpty();
if (!harvested.isEmpty()) {
pendingCrops.addAll(harvested);
- pendingCrops.sort(TopDownICropComparator.INSTANCE);
+ pendingCrops.sort(FarmHelper.TopDownICropComparator.INSTANCE);
harvestProvider = logic;
}
} else if (stage == Stage.CULTIVATE) {
@@ -513,102 +485,8 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
// Set the maximum allowed extent.
allowedExtent = Math.max(sizeNorthSouth, sizeEastWest) * Config.farmSize + 1;
- createTargets(world, targets, targetStart, allowedExtent, sizeNorthSouth, sizeEastWest, min, max);
- setExtents(world, targets);
- }
-
- private static void createTargets(World world, Map> targets, BlockPos targetStart, final int allowedExtent, final int farmSizeNorthSouth, final int farmSizeEastWest, BlockPos minFarmCoord, BlockPos maxFarmCoord) {
- for (FarmDirection farmSide : FarmDirection.values()) {
-
- final int farmWidth;
- if (farmSide == FarmDirection.NORTH || farmSide == FarmDirection.SOUTH) {
- farmWidth = farmSizeEastWest;
- } else {
- farmWidth = farmSizeNorthSouth;
- }
-
- // targets extend sideways in a pinwheel pattern around the farm, so they need to go a little extra distance
- final int targetMaxLimit = allowedExtent + farmWidth;
-
- FarmDirection layoutDirection = getLayoutDirection(farmSide);
-
- List farmSideTargets = new ArrayList<>();
- targets.put(farmSide, farmSideTargets);
-
- BlockPos targetLocation = FarmHelper.getFarmMultiblockCorner(targetStart, farmSide, layoutDirection, minFarmCoord, maxFarmCoord);
- BlockPos firstLocation = targetLocation.offset(farmSide.getFacing());
- BlockPos firstGroundPosition = getGroundPosition(world, firstLocation);
- if (firstGroundPosition != null) {
- int groundHeight = firstGroundPosition.getY();
-
- for (int i = 0; i < allowedExtent; i++) {
- targetLocation = targetLocation.offset(farmSide.getFacing());
- BlockPos groundLocation = new BlockPos(targetLocation.getX(), groundHeight, targetLocation.getZ());
-
- if (!world.isBlockLoaded(groundLocation)) {
- break;
- }
-
- IBlockState blockState = world.getBlockState(groundLocation);
- if (!FarmHelper.bricks.contains(blockState.getBlock())) {
- break;
- }
-
- int targetLimit = targetMaxLimit;
- if (!Config.squareFarms) {
- targetLimit = targetMaxLimit - i - 1;
- }
-
- FarmTarget target = new FarmTarget(targetLocation, layoutDirection, targetLimit);
- farmSideTargets.add(target);
- }
- }
- }
- }
-
- @Nullable
- private static BlockPos getGroundPosition(World world, BlockPos targetPosition) {
- if (!world.isBlockLoaded(targetPosition)) {
- return null;
- }
-
- for (int yOffset = 2; yOffset > -4; yOffset--) {
- BlockPos position = targetPosition.add(0, yOffset, 0);
- IBlockState blockState = world.getBlockState(position);
- if (FarmHelper.bricks.contains(blockState.getBlock())) {
- return position;
- }
- }
-
- return null;
- }
-
- private static boolean isCycleCanceledByListeners(IFarmLogic logic, FarmDirection direction, Iterable farmListeners) {
- for (IFarmListener listener : farmListeners) {
- if (listener.cancelTask(logic, direction)) {
- return true;
- }
- }
- return false;
- }
-
- private static void setExtents(World world, Map> targets) {
- for (List targetsList : targets.values()) {
- if (!targetsList.isEmpty()) {
- BlockPos groundPosition = getGroundPosition(world, targetsList.get(0).getStart());
-
- for (FarmTarget target : targetsList) {
- target.setExtentAndYOffset(world, groundPosition);
- }
- }
- }
- }
-
- private static class FarmWorkStatus {
- public boolean didWork = false;
- public boolean hasFarmland = false;
- public boolean hasFertilizer = true;
- public boolean hasLiquid = true;
+ FarmHelper.createTargets(world, this, targets, targetStart, allowedExtent, sizeNorthSouth, sizeEastWest, min, max);
+ FarmHelper.setExtents(world, this, targets);
}
private FarmWorkStatus cultivateTargets(FarmWorkStatus farmWorkStatus, List farmTargets, IFarmLogic logic, FarmDirection farmSide) {
@@ -621,7 +499,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
}
}
- if (hasFarmland && !isCycleCanceledByListeners(logic, farmSide, farmListeners)) {
+ if (hasFarmland && !FarmHelper.isCycleCanceledByListeners(logic, farmSide, farmListeners)) {
final float hydrationModifier = hydrationManager.getHydrationModifier();
final int fertilizerConsumption = logic.getFertilizerConsumption();
final int liquidConsumption = logic.getWaterConsumption(hydrationModifier);
@@ -639,7 +517,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
continue;
}
- if (cultivateTarget(world, this, target, logic, farmListeners)) {
+ if (FarmHelper.cultivateTarget(world, this, target, logic, farmListeners)) {
// Remove fertilizer and water
fertilizerManager.removeFertilizer(inventory, fertilizerConsumption);
removeLiquid(liquid);
@@ -652,41 +530,6 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
return farmWorkStatus;
}
- private static boolean cultivateTarget(World world, IFarmHousing farmHousing, FarmTarget target, IFarmLogic logic, Iterable farmListeners) {
- BlockPos targetPosition = target.getStart().add(0, target.getYOffset(), 0);
- if (logic.cultivate(world, farmHousing, targetPosition, target.getDirection(), target.getExtent())) {
- for (IFarmListener listener : farmListeners) {
- listener.hasCultivated(logic, targetPosition, target.getDirection(), target.getExtent());
- }
- return true;
- }
-
- return false;
- }
-
- private static Collection harvestTargets(World world, List farmTargets, IFarmLogic logic, Iterable farmListeners) {
- for (FarmTarget target : farmTargets) {
- Collection harvested = harvestTarget(world, target, logic, farmListeners);
- if (!harvested.isEmpty()) {
- return harvested;
- }
- }
-
- return Collections.emptyList();
- }
-
- private static Collection harvestTarget(World world, FarmTarget target, IFarmLogic logic, Iterable farmListeners) {
- BlockPos pos = target.getStart().add(0, target.getYOffset(), 0);
- Collection harvested = logic.harvest(world, pos, target.getDirection(), target.getExtent());
- if (!harvested.isEmpty()) {
- // Let event handlers know.
- for (IFarmListener listener : farmListeners) {
- listener.hasScheduledHarvest(harvested, logic, pos, target.getDirection(), target.getExtent());
- }
- }
- return harvested;
- }
-
private boolean collectWindfall(IFarmLogic logic) {
NonNullList collected = logic.collect(world, this);
if (collected.isEmpty()) {
@@ -835,22 +678,20 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
return CircuitSocketType.FARM;
}
+ @Override
+ public boolean isValidPlatform(World world, BlockPos pos) {
+ IBlockState blockState = world.getBlockState(pos);
+ return FarmHelper.bricks.contains(blockState.getBlock());
+ }
+
+ @Override
+ public boolean isSquare() {
+ return Config.squareFarms;
+ }
+
// for debugging
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("stage", stage).add("logic", farmLogics.toString()).toString();
}
-
- private static class TopDownICropComparator implements Comparator {
- public static final TopDownICropComparator INSTANCE = new TopDownICropComparator();
-
- private TopDownICropComparator() {
-
- }
-
- @Override
- public int compare(ICrop o1, ICrop o2) {
- return TopDownBlockPosComparator.INSTANCE.compare(o1.getPosition(), o2.getPosition());
- }
- }
}
diff --git a/src/main/java/forestry/farming/multiblock/FarmFertilizerManager.java b/src/main/java/forestry/farming/multiblock/FarmFertilizerManager.java
index e7e3cb935..99887e966 100644
--- a/src/main/java/forestry/farming/multiblock/FarmFertilizerManager.java
+++ b/src/main/java/forestry/farming/multiblock/FarmFertilizerManager.java
@@ -12,11 +12,12 @@ package forestry.farming.multiblock;
import java.io.IOException;
+import net.minecraft.nbt.NBTTagCompound;
+
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
import forestry.core.network.IStreamable;
import forestry.core.network.PacketBufferForestry;
-import net.minecraft.nbt.NBTTagCompound;
public class FarmFertilizerManager implements INbtWritable, INbtReadable, IStreamable {
private static final int BUFFER_FERTILIZER = 200;
@@ -26,7 +27,7 @@ public class FarmFertilizerManager implements INbtWritable, INbtReadable, IStrea
storedFertilizer = 0;
}
- public boolean hasFertilizer(InventoryFarm inventory, int amount) {
+ public boolean hasFertilizer(IFarmInventoryInternal inventory, int amount) {
if (inventory.getFertilizerValue() < 0) {
return true;
}
@@ -34,7 +35,7 @@ public class FarmFertilizerManager implements INbtWritable, INbtReadable, IStrea
return storedFertilizer >= amount;
}
- public void removeFertilizer(InventoryFarm inventory, int amount) {
+ public void removeFertilizer(IFarmInventoryInternal inventory, int amount) {
if (inventory.getFertilizerValue() < 0) {
return;
}
@@ -45,7 +46,7 @@ public class FarmFertilizerManager implements INbtWritable, INbtReadable, IStrea
}
}
- public boolean maintainFertilizer(InventoryFarm inventory) {
+ public boolean maintainFertilizer(IFarmInventoryInternal inventory) {
if (storedFertilizer <= BUFFER_FERTILIZER) {
int fertilizerValue = inventory.getFertilizerValue();
if (fertilizerValue < 0) {
@@ -69,7 +70,7 @@ public class FarmFertilizerManager implements INbtWritable, INbtReadable, IStrea
return data;
}
- public int getStoredFertilizerScaled(InventoryFarm inventory, int scale) {
+ public int getStoredFertilizerScaled(IFarmInventoryInternal inventory, int scale) {
if (storedFertilizer == 0) {
return 0;
}
diff --git a/src/main/java/forestry/farming/multiblock/IFarmInventoryInternal.java b/src/main/java/forestry/farming/multiblock/IFarmInventoryInternal.java
new file mode 100644
index 000000000..823c4b6e2
--- /dev/null
+++ b/src/main/java/forestry/farming/multiblock/IFarmInventoryInternal.java
@@ -0,0 +1,10 @@
+package forestry.farming.multiblock;
+
+import forestry.api.farming.IFarmInventory;
+
+public interface IFarmInventoryInternal extends IFarmInventory {
+
+ int getFertilizerValue();
+
+ boolean useFertilizer();
+}
diff --git a/src/main/java/forestry/farming/multiblock/InventoryFarm.java b/src/main/java/forestry/farming/multiblock/InventoryFarm.java
index 2703411f3..3d9306e69 100644
--- a/src/main/java/forestry/farming/multiblock/InventoryFarm.java
+++ b/src/main/java/forestry/farming/multiblock/InventoryFarm.java
@@ -24,7 +24,6 @@ import net.minecraftforge.fluids.FluidUtil;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.FarmDirection;
-import forestry.api.farming.IFarmInventory;
import forestry.api.farming.IFarmLogic;
import forestry.api.farming.IFarmable;
import forestry.core.fluids.FluidHelper;
@@ -32,10 +31,9 @@ import forestry.core.fluids.TankManager;
import forestry.core.inventory.InventoryAdapterRestricted;
import forestry.core.inventory.wrappers.InventoryMapper;
import forestry.core.utils.InventoryUtil;
-import forestry.core.utils.PlayerUtil;
import forestry.core.utils.SlotUtil;
-public class InventoryFarm extends InventoryAdapterRestricted implements IFarmInventory {
+public class InventoryFarm extends InventoryAdapterRestricted implements IFarmInventoryInternal {
public static final int SLOT_RESOURCES_1 = 0;
public static final int SLOT_RESOURCES_COUNT = 6;
public static final int SLOT_GERMLINGS_1 = 6;
diff --git a/src/main/java/forestry/modules/ForestryModuleUids.java b/src/main/java/forestry/modules/ForestryModuleUids.java
index fe4f8c8c9..a7dfb8dc0 100644
--- a/src/main/java/forestry/modules/ForestryModuleUids.java
+++ b/src/main/java/forestry/modules/ForestryModuleUids.java
@@ -18,6 +18,7 @@ public class ForestryModuleUids {
public static final String CRATE = "crates";
public static final String BACKPACKS = "backpacks";
public static final String DATABASE = "database";
+ public static final String CULTIVATION = "cultivation";
//Mod Plugins
public static final String BIOMES_O_PLENTY = "biomes.o.plenty";
diff --git a/src/main/java/forestry/plugins/PluginActuallyAdditions.java b/src/main/java/forestry/plugins/PluginActuallyAdditions.java
index ecf152245..0b67e44d4 100644
--- a/src/main/java/forestry/plugins/PluginActuallyAdditions.java
+++ b/src/main/java/forestry/plugins/PluginActuallyAdditions.java
@@ -17,7 +17,7 @@ import forestry.api.modules.ForestryModule;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
-import forestry.farming.logic.FarmableAgingCrop;
+import forestry.farming.logic.farmables.FarmableAgingCrop;
import forestry.modules.ForestryModuleUids;
@SuppressWarnings("unused")
diff --git a/src/main/java/forestry/plugins/PluginBetterWithMods.java b/src/main/java/forestry/plugins/PluginBetterWithMods.java
index 60f1c38c8..91ba8beca 100644
--- a/src/main/java/forestry/plugins/PluginBetterWithMods.java
+++ b/src/main/java/forestry/plugins/PluginBetterWithMods.java
@@ -13,7 +13,7 @@ import forestry.api.modules.ForestryModule;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
-import forestry.farming.logic.FarmableDoubleCrop;
+import forestry.farming.logic.farmables.FarmableDoubleCrop;
import forestry.modules.ForestryModuleUids;
@SuppressWarnings("unused")
diff --git a/src/main/java/forestry/plugins/PluginExtraUtilities.java b/src/main/java/forestry/plugins/PluginExtraUtilities.java
index d19c035d5..625b3c745 100644
--- a/src/main/java/forestry/plugins/PluginExtraUtilities.java
+++ b/src/main/java/forestry/plugins/PluginExtraUtilities.java
@@ -38,7 +38,7 @@ import forestry.core.utils.ModUtil;
import forestry.farming.FarmRegistry;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.logic.FarmLogicExU;
-import forestry.farming.logic.FarmableAgingCrop;
+import forestry.farming.logic.farmables.FarmableAgingCrop;
import forestry.modules.BlankForestryModule;
import forestry.modules.ForestryModuleUids;
diff --git a/src/main/java/forestry/plugins/PluginHarvestCraft.java b/src/main/java/forestry/plugins/PluginHarvestCraft.java
index 71d5c8296..f2329e230 100644
--- a/src/main/java/forestry/plugins/PluginHarvestCraft.java
+++ b/src/main/java/forestry/plugins/PluginHarvestCraft.java
@@ -30,7 +30,7 @@ import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.core.items.ItemRegistryCore;
import forestry.core.recipes.RecipeUtil;
-import forestry.farming.logic.FarmableAgingCrop;
+import forestry.farming.logic.farmables.FarmableAgingCrop;
import forestry.modules.ForestryModuleUids;
@SuppressWarnings("unused")
@@ -199,8 +199,7 @@ public class PluginHarvestCraft extends CompatPlugin {
RecipeManagers.squeezerManager.addRecipe(10, berrySeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && berrySeed != null && berryBlock != null) {
- farmRegistry.registerFarmables("farmWheat", new FarmableAgingCrop(berrySeed, berryBlock, plantAGE, 3));
- farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(berrySeed, berryBlock, plantAGE, 3, 0));
+ farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(berrySeed, berryBlock, plantAGE, 3, 0));
}
plants.add(berryName);
}
@@ -217,8 +216,7 @@ public class PluginHarvestCraft extends CompatPlugin {
RecipeManagers.squeezerManager.addRecipe(10, fruitSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && fruitSeed != null && fruitBlock != null) {
- farmRegistry.registerFarmables("farmWheat", new FarmableAgingCrop(fruitSeed, fruitBlock, plantAGE, 3));
- farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(fruitSeed, fruitBlock, plantAGE, 3, 0));
+ farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(fruitSeed, fruitBlock, plantAGE, 3, 0));
}
plants.add(fruitName);
}
@@ -236,8 +234,7 @@ public class PluginHarvestCraft extends CompatPlugin {
RecipeManagers.squeezerManager.addRecipe(10, vegetableSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && vegetableSeed != null && vegetableBlock != null) {
- farmRegistry.registerFarmables("farmVegetables", new FarmableAgingCrop(vegetableSeed, vegetableBlock, plantAGE, 3));
- farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(vegetableSeed, vegetableBlock, plantAGE, 3, 0));
+ farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(vegetableSeed, vegetableBlock, plantAGE, 3, 0));
}
plants.add(vegetableName);
}
@@ -256,8 +253,7 @@ public class PluginHarvestCraft extends CompatPlugin {
RecipeManagers.moistenerManager.addRecipe(grainSeed, new ItemStack(Blocks.MYCELIUM), 5000);
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && grainSeed != null && grainBlock != null) {
- farmRegistry.registerFarmables("farmWheat", new FarmableAgingCrop(grainSeed, grainBlock, plantAGE, 3));
- farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(grainSeed, grainBlock, plantAGE, 3, 0));
+ farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(grainSeed, grainBlock, plantAGE, 3, 0));
}
plants.add(grainName);
}
@@ -303,8 +299,7 @@ public class PluginHarvestCraft extends CompatPlugin {
RecipeManagers.squeezerManager.addRecipe(10, genericCropSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && genericCropSeed != null && genericCropBlock != null) {
- farmRegistry.registerFarmables("farmWheat", new FarmableAgingCrop(genericCropSeed, genericCropBlock, plantAGE, 3));
- farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(genericCropSeed, genericCropBlock, plantAGE, 3, 0));
+ farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(genericCropSeed, genericCropBlock, plantAGE, 3, 0));
}
plants.add(cropName);
}
@@ -315,8 +310,7 @@ public class PluginHarvestCraft extends CompatPlugin {
RecipeManagers.squeezerManager.addRecipe(10, mustardCropSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && mustardCropSeed != null && mustardCropBlock != null) {
- farmRegistry.registerFarmables("farmWheat", new FarmableAgingCrop(mustardCropSeed, mustardCropBlock, plantAGE, 3));
- farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(mustardCropSeed, mustardCropBlock, plantAGE, 3, 0));
+ farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(mustardCropSeed, mustardCropBlock, plantAGE, 3, 0));
}
if (mustardFruit != null) {
RecipeUtil.addFermenterRecipes(mustardFruit, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
@@ -337,8 +331,7 @@ public class PluginHarvestCraft extends CompatPlugin {
RecipeManagers.squeezerManager.addRecipe(10, cropnutSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && cropnutSeed != null && cropnutBlock != null) {
- farmRegistry.registerFarmables("farmWheat", new FarmableAgingCrop(cropnutSeed, cropnutBlock, plantAGE, 3));
- farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(cropnutSeed, cropnutBlock, plantAGE, 3, 0));
+ farmRegistry.registerFarmables("farmCrops", new FarmableAgingCrop(cropnutSeed, cropnutBlock, plantAGE, 3, 0));
}
if (cropnut != null) {
RecipeManagers.squeezerManager.addRecipe(20, cropnut, Fluids.SEED_OIL.getFluid(12 * seedamount));
diff --git a/src/main/java/forestry/plugins/PluginIC2.java b/src/main/java/forestry/plugins/PluginIC2.java
index a143e8435..687a629f2 100644
--- a/src/main/java/forestry/plugins/PluginIC2.java
+++ b/src/main/java/forestry/plugins/PluginIC2.java
@@ -61,10 +61,9 @@ import forestry.energy.circuits.CircuitElectricEfficiency;
import forestry.farming.FarmRegistry;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.logic.FarmLogicRubber;
-import forestry.farming.logic.FarmableBasicIC2Crop;
+import forestry.farming.logic.farmables.FarmableBasicIC2Crop;
import forestry.modules.BlankForestryModule;
import forestry.modules.ForestryModuleUids;
-
import ic2.api.item.IC2Items;
import ic2.api.recipe.Recipes;
diff --git a/src/main/java/forestry/plugins/PluginImmersiveEngineering.java b/src/main/java/forestry/plugins/PluginImmersiveEngineering.java
index 37ae523a2..c97bf05fd 100644
--- a/src/main/java/forestry/plugins/PluginImmersiveEngineering.java
+++ b/src/main/java/forestry/plugins/PluginImmersiveEngineering.java
@@ -22,7 +22,7 @@ import forestry.api.modules.ForestryModule;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
-import forestry.farming.logic.FarmableDoubleCrop;
+import forestry.farming.logic.farmables.FarmableDoubleCrop;
import forestry.modules.ForestryModuleUids;
@SuppressWarnings("unused")
diff --git a/src/main/java/forestry/plugins/PluginMysticalAgriculture.java b/src/main/java/forestry/plugins/PluginMysticalAgriculture.java
index a8a192b14..643a56eff 100644
--- a/src/main/java/forestry/plugins/PluginMysticalAgriculture.java
+++ b/src/main/java/forestry/plugins/PluginMysticalAgriculture.java
@@ -13,7 +13,7 @@ import forestry.api.modules.ForestryModule;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
-import forestry.farming.logic.FarmableAgingCrop;
+import forestry.farming.logic.farmables.FarmableAgingCrop;
import forestry.modules.ForestryModuleUids;
@SuppressWarnings("unused")
diff --git a/src/main/java/forestry/plugins/PluginNatura.java b/src/main/java/forestry/plugins/PluginNatura.java
index fee432f6c..ef1befabc 100644
--- a/src/main/java/forestry/plugins/PluginNatura.java
+++ b/src/main/java/forestry/plugins/PluginNatura.java
@@ -48,8 +48,8 @@ import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
import forestry.core.utils.ModUtil;
import forestry.farming.FarmRegistry;
-import forestry.farming.logic.FarmableAgingCrop;
-import forestry.farming.logic.FarmableSapling;
+import forestry.farming.logic.farmables.FarmableAgingCrop;
+import forestry.farming.logic.farmables.FarmableSapling;
import forestry.modules.BlankForestryModule;
import forestry.modules.ForestryModuleUids;
@@ -220,7 +220,7 @@ public class PluginNatura extends BlankForestryModule {
return;
}
- FarmRegistry.getInstance().registerFarmables("farmWheat",
+ FarmRegistry.getInstance().registerFarmables("farmCrops",
new FarmableAgingCrop(
seedItem,
block,
diff --git a/src/main/java/forestry/plugins/PluginRoots.java b/src/main/java/forestry/plugins/PluginRoots.java
index ebe7f3056..fb077bc21 100644
--- a/src/main/java/forestry/plugins/PluginRoots.java
+++ b/src/main/java/forestry/plugins/PluginRoots.java
@@ -12,7 +12,7 @@ import forestry.api.modules.ForestryModule;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
-import forestry.farming.logic.FarmableAgingCrop;
+import forestry.farming.logic.farmables.FarmableAgingCrop;
import forestry.modules.ForestryModuleUids;
@SuppressWarnings("unused")
diff --git a/src/main/java/forestry/plugins/PluginRustic.java b/src/main/java/forestry/plugins/PluginRustic.java
index e9bc0b304..405825de7 100644
--- a/src/main/java/forestry/plugins/PluginRustic.java
+++ b/src/main/java/forestry/plugins/PluginRustic.java
@@ -12,9 +12,9 @@ import forestry.api.modules.ForestryModule;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
-import forestry.farming.logic.FarmableAgingCrop;
-import forestry.farming.logic.FarmableRusticGrape;
-import forestry.farming.logic.FarmableRusticSapling;
+import forestry.farming.logic.farmables.FarmableAgingCrop;
+import forestry.farming.logic.farmables.FarmableRusticGrape;
+import forestry.farming.logic.farmables.FarmableRusticSapling;
import forestry.modules.ForestryModuleUids;
@SuppressWarnings("unused")
diff --git a/src/main/resources/assets/forestry/blockstates/arboretum.json b/src/main/resources/assets/forestry/blockstates/arboretum.json
new file mode 100644
index 000000000..38cfda3d7
--- /dev/null
+++ b/src/main/resources/assets/forestry/blockstates/arboretum.json
@@ -0,0 +1,8 @@
+{
+ "variants": {
+ "facing=north": { "model": "forestry:arboretum" },
+ "facing=east": { "model": "forestry:arboretum", "y": 90 },
+ "facing=south": { "model": "forestry:arboretum", "y": 180 },
+ "facing=west": { "model": "forestry:arboretum", "y": -90 }
+ }
+}
diff --git a/src/main/resources/assets/forestry/blockstates/farm_crops.json b/src/main/resources/assets/forestry/blockstates/farm_crops.json
new file mode 100644
index 000000000..f5d9956f2
--- /dev/null
+++ b/src/main/resources/assets/forestry/blockstates/farm_crops.json
@@ -0,0 +1,8 @@
+{
+ "variants": {
+ "facing=north": { "model": "forestry:farm_crops" },
+ "facing=east": { "model": "forestry:farm_crops", "y": 90 },
+ "facing=south": { "model": "forestry:farm_crops", "y": 180 },
+ "facing=west": { "model": "forestry:farm_crops", "y": -90 }
+ }
+}
diff --git a/src/main/resources/assets/forestry/blockstates/farm_gourd.json b/src/main/resources/assets/forestry/blockstates/farm_gourd.json
new file mode 100644
index 000000000..3f2e93938
--- /dev/null
+++ b/src/main/resources/assets/forestry/blockstates/farm_gourd.json
@@ -0,0 +1,8 @@
+{
+ "variants": {
+ "facing=north": { "model": "forestry:farm_gourd" },
+ "facing=east": { "model": "forestry:farm_gourd", "y": 90 },
+ "facing=south": { "model": "forestry:farm_gourd", "y": 180 },
+ "facing=west": { "model": "forestry:farm_gourd", "y": -90 }
+ }
+}
diff --git a/src/main/resources/assets/forestry/blockstates/farm_mushroom.json b/src/main/resources/assets/forestry/blockstates/farm_mushroom.json
new file mode 100644
index 000000000..1fd7c7fa6
--- /dev/null
+++ b/src/main/resources/assets/forestry/blockstates/farm_mushroom.json
@@ -0,0 +1,8 @@
+{
+ "variants": {
+ "facing=north": { "model": "forestry:farm_mushroom" },
+ "facing=east": { "model": "forestry:farm_mushroom", "y": 90 },
+ "facing=south": { "model": "forestry:farm_mushroom", "y": 180 },
+ "facing=west": { "model": "forestry:farm_mushroom", "y": -90 }
+ }
+}
diff --git a/src/main/resources/assets/forestry/blockstates/farm_nether.json b/src/main/resources/assets/forestry/blockstates/farm_nether.json
new file mode 100644
index 000000000..2affb37af
--- /dev/null
+++ b/src/main/resources/assets/forestry/blockstates/farm_nether.json
@@ -0,0 +1,8 @@
+{
+ "variants": {
+ "facing=north": { "model": "forestry:farm_nether" },
+ "facing=east": { "model": "forestry:farm_nether", "y": 90 },
+ "facing=south": { "model": "forestry:farm_nether", "y": 180 },
+ "facing=west": { "model": "forestry:farm_nether", "y": -90 }
+ }
+}
diff --git a/src/main/resources/assets/forestry/blockstates/peat_bog.json b/src/main/resources/assets/forestry/blockstates/peat_bog.json
new file mode 100644
index 000000000..fbd9a1f1c
--- /dev/null
+++ b/src/main/resources/assets/forestry/blockstates/peat_bog.json
@@ -0,0 +1,8 @@
+{
+ "variants": {
+ "facing=north": { "model": "forestry:peat_bog" },
+ "facing=east": { "model": "forestry:peat_bog", "y": 90 },
+ "facing=south": { "model": "forestry:peat_bog", "y": 180 },
+ "facing=west": { "model": "forestry:peat_bog", "y": -90 }
+ }
+}
diff --git a/src/main/resources/assets/forestry/blockstates/plantation.json b/src/main/resources/assets/forestry/blockstates/plantation.json
new file mode 100644
index 000000000..37abb8efb
--- /dev/null
+++ b/src/main/resources/assets/forestry/blockstates/plantation.json
@@ -0,0 +1,8 @@
+{
+ "variants": {
+ "facing=north": { "model": "forestry:plantation" },
+ "facing=east": { "model": "forestry:plantation", "y": 90 },
+ "facing=south": { "model": "forestry:plantation", "y": 180 },
+ "facing=west": { "model": "forestry:plantation", "y": -90 }
+ }
+}
diff --git a/src/main/resources/assets/forestry/models/block/arboretum.json b/src/main/resources/assets/forestry/models/block/arboretum.json
new file mode 100644
index 000000000..f67ff350c
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/block/arboretum.json
@@ -0,0 +1,57 @@
+{
+ "parent": "block/block",
+ "textures": {
+ "particle": "forestry:blocks/arboretum_particle",
+ "texture": "forestry:blocks/arboretum"
+ },
+ "elements": [
+ {
+ "__comment": "base",
+ "from": [ 0, 0, 0 ],
+ "to": [ 16, 4, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 4, 8, 8 ], "texture": "#texture", "cullface": "down" },
+ "up": { "uv": [ 0, 4, 4, 8 ], "texture": "#texture" },
+ "north": { "uv": [ 8, 4, 12, 5 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 6, 12, 7 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 7, 12, 8 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 5, 12, 6 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "ceiling",
+ "from": [ 0, 12, 0 ],
+ "to": [ 16, 16, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 0, 8, 4 ], "texture": "#texture" },
+ "up": { "uv": [ 0, 0, 4, 4 ], "texture": "#texture", "cullface": "up" },
+ "north": { "uv": [ 8, 0, 12, 1 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 2, 12, 3 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 3, 12, 4 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 1, 12, 2 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "terrarium",
+ "from": [ 2, 4, 2 ],
+ "to": [ 14, 12, 14 ],
+ "faces": {
+ "north": { "uv": [ 0, 13.5, 3, 15.5 ], "texture": "#texture" },
+ "south": { "uv": [ 6, 13.5, 9, 15.5 ], "texture": "#texture" },
+ "west": { "uv": [ 9, 13.5, 12, 15.5 ], "texture": "#texture" },
+ "east": { "uv": [ 3, 13.5, 6, 15.5 ], "texture": "#texture" }
+ }
+ },
+ {
+ "__comment": "showcase",
+ "from": [ 4, 4, 4 ],
+ "to": [ 12, 12, 12 ],
+ "faces": {
+ "north": { "uv": [ 6, 10, 8, 12 ], "texture": "#texture" },
+ "south": { "uv": [ 10, 10, 12, 12 ], "texture": "#texture" },
+ "west": { "uv": [ 12, 10, 14, 12 ], "texture": "#texture" },
+ "east": { "uv": [ 8, 10, 10, 12 ], "texture": "#texture" }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/resources/assets/forestry/models/block/farm_crops.json b/src/main/resources/assets/forestry/models/block/farm_crops.json
new file mode 100644
index 000000000..4665ccd49
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/block/farm_crops.json
@@ -0,0 +1,57 @@
+{
+ "parent": "block/block",
+ "textures": {
+ "particle": "forestry:blocks/farm_crops_particle",
+ "texture": "forestry:blocks/farm_crops"
+ },
+ "elements": [
+ {
+ "__comment": "base",
+ "from": [ 0, 0, 0 ],
+ "to": [ 16, 4, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 4, 8, 8 ], "texture": "#texture", "cullface": "down" },
+ "up": { "uv": [ 0, 4, 4, 8 ], "texture": "#texture" },
+ "north": { "uv": [ 8, 4, 12, 5 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 6, 12, 7 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 7, 12, 8 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 5, 12, 6 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "ceiling",
+ "from": [ 0, 12, 0 ],
+ "to": [ 16, 16, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 0, 8, 4 ], "texture": "#texture" },
+ "up": { "uv": [ 0, 0, 4, 4 ], "texture": "#texture", "cullface": "up" },
+ "north": { "uv": [ 8, 0, 12, 1 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 2, 12, 3 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 3, 12, 4 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 1, 12, 2 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "terrarium",
+ "from": [ 2, 4, 2 ],
+ "to": [ 14, 12, 14 ],
+ "faces": {
+ "north": { "uv": [ 0, 13.5, 3, 15.5 ], "texture": "#texture" },
+ "south": { "uv": [ 6, 13.5, 9, 15.5 ], "texture": "#texture" },
+ "west": { "uv": [ 9, 13.5, 12, 15.5 ], "texture": "#texture" },
+ "east": { "uv": [ 3, 13.5, 6, 15.5 ], "texture": "#texture" }
+ }
+ },
+ {
+ "__comment": "showcase",
+ "from": [ 4, 4, 4 ],
+ "to": [ 12, 12, 12 ],
+ "faces": {
+ "north": { "uv": [ 6, 10, 8, 12 ], "texture": "#texture" },
+ "south": { "uv": [ 10, 10, 12, 12 ], "texture": "#texture" },
+ "west": { "uv": [ 12, 10, 14, 12 ], "texture": "#texture" },
+ "east": { "uv": [ 8, 10, 10, 12 ], "texture": "#texture" }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/resources/assets/forestry/models/block/farm_gourd.json b/src/main/resources/assets/forestry/models/block/farm_gourd.json
new file mode 100644
index 000000000..27486a1e7
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/block/farm_gourd.json
@@ -0,0 +1,57 @@
+{
+ "parent": "block/block",
+ "textures": {
+ "particle": "forestry:blocks/farm_gourd_particle",
+ "texture": "forestry:blocks/farm_gourd"
+ },
+ "elements": [
+ {
+ "__comment": "base",
+ "from": [ 0, 0, 0 ],
+ "to": [ 16, 4, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 4, 8, 8 ], "texture": "#texture", "cullface": "down" },
+ "up": { "uv": [ 0, 4, 4, 8 ], "texture": "#texture" },
+ "north": { "uv": [ 8, 4, 12, 5 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 6, 12, 7 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 7, 12, 8 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 5, 12, 6 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "ceiling",
+ "from": [ 0, 12, 0 ],
+ "to": [ 16, 16, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 0, 8, 4 ], "texture": "#texture" },
+ "up": { "uv": [ 0, 0, 4, 4 ], "texture": "#texture", "cullface": "up" },
+ "north": { "uv": [ 8, 0, 12, 1 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 2, 12, 3 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 3, 12, 4 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 1, 12, 2 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "terrarium",
+ "from": [ 2, 4, 2 ],
+ "to": [ 14, 12, 14 ],
+ "faces": {
+ "north": { "uv": [ 0, 13.5, 3, 15.5 ], "texture": "#texture" },
+ "south": { "uv": [ 6, 13.5, 9, 15.5 ], "texture": "#texture" },
+ "west": { "uv": [ 9, 13.5, 12, 15.5 ], "texture": "#texture" },
+ "east": { "uv": [ 3, 13.5, 6, 15.5 ], "texture": "#texture" }
+ }
+ },
+ {
+ "__comment": "showcase",
+ "from": [ 4, 4, 4 ],
+ "to": [ 12, 12, 12 ],
+ "faces": {
+ "north": { "uv": [ 6, 10, 8, 12 ], "texture": "#texture" },
+ "south": { "uv": [ 10, 10, 12, 12 ], "texture": "#texture" },
+ "west": { "uv": [ 12, 10, 14, 12 ], "texture": "#texture" },
+ "east": { "uv": [ 8, 10, 10, 12 ], "texture": "#texture" }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/resources/assets/forestry/models/block/farm_mushroom.json b/src/main/resources/assets/forestry/models/block/farm_mushroom.json
new file mode 100644
index 000000000..0835f8385
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/block/farm_mushroom.json
@@ -0,0 +1,57 @@
+{
+ "parent": "block/block",
+ "textures": {
+ "particle": "forestry:blocks/farm_mushroom_particle",
+ "texture": "forestry:blocks/farm_mushroom"
+ },
+ "elements": [
+ {
+ "__comment": "base",
+ "from": [ 0, 0, 0 ],
+ "to": [ 16, 4, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 4, 8, 8 ], "texture": "#texture", "cullface": "down" },
+ "up": { "uv": [ 0, 4, 4, 8 ], "texture": "#texture" },
+ "north": { "uv": [ 8, 4, 12, 5 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 6, 12, 7 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 7, 12, 8 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 5, 12, 6 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "ceiling",
+ "from": [ 0, 12, 0 ],
+ "to": [ 16, 16, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 0, 8, 4 ], "texture": "#texture" },
+ "up": { "uv": [ 0, 0, 4, 4 ], "texture": "#texture", "cullface": "up" },
+ "north": { "uv": [ 8, 0, 12, 1 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 2, 12, 3 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 3, 12, 4 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 1, 12, 2 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "terrarium",
+ "from": [ 2, 4, 2 ],
+ "to": [ 14, 12, 14 ],
+ "faces": {
+ "north": { "uv": [ 0, 13.5, 3, 15.5 ], "texture": "#texture" },
+ "south": { "uv": [ 6, 13.5, 9, 15.5 ], "texture": "#texture" },
+ "west": { "uv": [ 9, 13.5, 12, 15.5 ], "texture": "#texture" },
+ "east": { "uv": [ 3, 13.5, 6, 15.5 ], "texture": "#texture" }
+ }
+ },
+ {
+ "__comment": "showcase",
+ "from": [ 4, 4, 4 ],
+ "to": [ 12, 12, 12 ],
+ "faces": {
+ "north": { "uv": [ 6, 10, 8, 12 ], "texture": "#texture" },
+ "south": { "uv": [ 10, 10, 12, 12 ], "texture": "#texture" },
+ "west": { "uv": [ 12, 10, 14, 12 ], "texture": "#texture" },
+ "east": { "uv": [ 8, 10, 10, 12 ], "texture": "#texture" }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/resources/assets/forestry/models/block/farm_nether.json b/src/main/resources/assets/forestry/models/block/farm_nether.json
new file mode 100644
index 000000000..38939afd0
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/block/farm_nether.json
@@ -0,0 +1,57 @@
+{
+ "parent": "block/block",
+ "textures": {
+ "particle": "forestry:blocks/farm_nether_particle",
+ "texture": "forestry:blocks/farm_nether"
+ },
+ "elements": [
+ {
+ "__comment": "base",
+ "from": [ 0, 0, 0 ],
+ "to": [ 16, 4, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 4, 8, 8 ], "texture": "#texture", "cullface": "down" },
+ "up": { "uv": [ 0, 4, 4, 8 ], "texture": "#texture" },
+ "north": { "uv": [ 8, 4, 12, 5 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 6, 12, 7 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 7, 12, 8 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 5, 12, 6 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "ceiling",
+ "from": [ 0, 12, 0 ],
+ "to": [ 16, 16, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 0, 8, 4 ], "texture": "#texture" },
+ "up": { "uv": [ 0, 0, 4, 4 ], "texture": "#texture", "cullface": "up" },
+ "north": { "uv": [ 8, 0, 12, 1 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 2, 12, 3 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 3, 12, 4 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 1, 12, 2 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "terrarium",
+ "from": [ 2, 4, 2 ],
+ "to": [ 14, 12, 14 ],
+ "faces": {
+ "north": { "uv": [ 0, 13.5, 3, 15.5 ], "texture": "#texture" },
+ "south": { "uv": [ 6, 13.5, 9, 15.5 ], "texture": "#texture" },
+ "west": { "uv": [ 9, 13.5, 12, 15.5 ], "texture": "#texture" },
+ "east": { "uv": [ 3, 13.5, 6, 15.5 ], "texture": "#texture" }
+ }
+ },
+ {
+ "__comment": "showcase",
+ "from": [ 4, 4, 4 ],
+ "to": [ 12, 12, 12 ],
+ "faces": {
+ "north": { "uv": [ 6, 10, 8, 12 ], "texture": "#texture" },
+ "south": { "uv": [ 10, 10, 12, 12 ], "texture": "#texture" },
+ "west": { "uv": [ 12, 10, 14, 12 ], "texture": "#texture" },
+ "east": { "uv": [ 8, 10, 10, 12 ], "texture": "#texture" }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/resources/assets/forestry/models/block/peat_bog.json b/src/main/resources/assets/forestry/models/block/peat_bog.json
new file mode 100644
index 000000000..930fd9fa8
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/block/peat_bog.json
@@ -0,0 +1,57 @@
+{
+ "parent": "block/block",
+ "textures": {
+ "particle": "forestry:blocks/peat_bog_particle",
+ "texture": "forestry:blocks/peat_bog"
+ },
+ "elements": [
+ {
+ "__comment": "base",
+ "from": [ 0, 0, 0 ],
+ "to": [ 16, 4, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 4, 8, 8 ], "texture": "#texture", "cullface": "down" },
+ "up": { "uv": [ 0, 4, 4, 8 ], "texture": "#texture" },
+ "north": { "uv": [ 8, 4, 12, 5 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 6, 12, 7 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 7, 12, 8 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 5, 12, 6 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "ceiling",
+ "from": [ 0, 12, 0 ],
+ "to": [ 16, 16, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 0, 8, 4 ], "texture": "#texture" },
+ "up": { "uv": [ 0, 0, 4, 4 ], "texture": "#texture", "cullface": "up" },
+ "north": { "uv": [ 8, 0, 12, 1 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 2, 12, 3 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 3, 12, 4 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 1, 12, 2 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "terrarium",
+ "from": [ 2, 4, 2 ],
+ "to": [ 14, 12, 14 ],
+ "faces": {
+ "north": { "uv": [ 0, 13.5, 3, 15.5 ], "texture": "#texture" },
+ "south": { "uv": [ 6, 13.5, 9, 15.5 ], "texture": "#texture" },
+ "west": { "uv": [ 9, 13.5, 12, 15.5 ], "texture": "#texture" },
+ "east": { "uv": [ 3, 13.5, 6, 15.5 ], "texture": "#texture" }
+ }
+ },
+ {
+ "__comment": "showcase",
+ "from": [ 4, 4, 4 ],
+ "to": [ 12, 12, 12 ],
+ "faces": {
+ "north": { "uv": [ 6, 10, 8, 12 ], "texture": "#texture" },
+ "south": { "uv": [ 10, 10, 12, 12 ], "texture": "#texture" },
+ "west": { "uv": [ 12, 10, 14, 12 ], "texture": "#texture" },
+ "east": { "uv": [ 8, 10, 10, 12 ], "texture": "#texture" }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/resources/assets/forestry/models/block/plantation.json b/src/main/resources/assets/forestry/models/block/plantation.json
new file mode 100644
index 000000000..cbd8eb271
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/block/plantation.json
@@ -0,0 +1,57 @@
+{
+ "parent": "block/block",
+ "textures": {
+ "particle": "forestry:blocks/plantation_particle",
+ "texture": "forestry:blocks/plantation"
+ },
+ "elements": [
+ {
+ "__comment": "base",
+ "from": [ 0, 0, 0 ],
+ "to": [ 16, 4, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 4, 8, 8 ], "texture": "#texture", "cullface": "down" },
+ "up": { "uv": [ 0, 4, 4, 8 ], "texture": "#texture" },
+ "north": { "uv": [ 8, 4, 12, 5 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 6, 12, 7 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 7, 12, 8 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 5, 12, 6 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "ceiling",
+ "from": [ 0, 12, 0 ],
+ "to": [ 16, 16, 16 ],
+ "faces": {
+ "down": { "uv": [ 4, 0, 8, 4 ], "texture": "#texture" },
+ "up": { "uv": [ 0, 0, 4, 4 ], "texture": "#texture", "cullface": "up" },
+ "north": { "uv": [ 8, 0, 12, 1 ], "texture": "#texture", "cullface": "north" },
+ "south": { "uv": [ 8, 2, 12, 3 ], "texture": "#texture", "cullface": "south" },
+ "west": { "uv": [ 8, 3, 12, 4 ], "texture": "#texture", "cullface": "west" },
+ "east": { "uv": [ 8, 1, 12, 2 ], "texture": "#texture", "cullface": "east" }
+ }
+ },
+ {
+ "__comment": "terrarium",
+ "from": [ 2, 4, 2 ],
+ "to": [ 14, 12, 14 ],
+ "faces": {
+ "north": { "uv": [ 0, 13.5, 3, 15.5 ], "texture": "#texture" },
+ "south": { "uv": [ 6, 13.5, 9, 15.5 ], "texture": "#texture" },
+ "west": { "uv": [ 9, 13.5, 12, 15.5 ], "texture": "#texture" },
+ "east": { "uv": [ 3, 13.5, 6, 15.5 ], "texture": "#texture" }
+ }
+ },
+ {
+ "__comment": "showcase",
+ "from": [ 4, 4, 4 ],
+ "to": [ 12, 12, 12 ],
+ "faces": {
+ "north": { "uv": [ 6, 10, 8, 12 ], "texture": "#texture" },
+ "south": { "uv": [ 10, 10, 12, 12 ], "texture": "#texture" },
+ "west": { "uv": [ 12, 10, 14, 12 ], "texture": "#texture" },
+ "east": { "uv": [ 8, 10, 10, 12 ], "texture": "#texture" }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/resources/assets/forestry/models/item/arboretum.json b/src/main/resources/assets/forestry/models/item/arboretum.json
new file mode 100644
index 000000000..44bea737c
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/item/arboretum.json
@@ -0,0 +1,3 @@
+{
+ "parent": "forestry:block/arboretum"
+}
diff --git a/src/main/resources/assets/forestry/models/item/farm_crops.json b/src/main/resources/assets/forestry/models/item/farm_crops.json
new file mode 100644
index 000000000..62eb2bffe
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/item/farm_crops.json
@@ -0,0 +1,3 @@
+{
+ "parent": "forestry:block/farm_crops"
+}
diff --git a/src/main/resources/assets/forestry/models/item/farm_gourd.json b/src/main/resources/assets/forestry/models/item/farm_gourd.json
new file mode 100644
index 000000000..da1f79c97
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/item/farm_gourd.json
@@ -0,0 +1,3 @@
+{
+ "parent": "forestry:block/farm_gourd"
+}
diff --git a/src/main/resources/assets/forestry/models/item/farm_mushroom.json b/src/main/resources/assets/forestry/models/item/farm_mushroom.json
new file mode 100644
index 000000000..ef45652eb
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/item/farm_mushroom.json
@@ -0,0 +1,3 @@
+{
+ "parent": "forestry:block/farm_mushroom"
+}
diff --git a/src/main/resources/assets/forestry/models/item/farm_nether.json b/src/main/resources/assets/forestry/models/item/farm_nether.json
new file mode 100644
index 000000000..31e2689fe
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/item/farm_nether.json
@@ -0,0 +1,3 @@
+{
+ "parent": "forestry:block/farm_nether"
+}
diff --git a/src/main/resources/assets/forestry/models/item/peat_bog.json b/src/main/resources/assets/forestry/models/item/peat_bog.json
new file mode 100644
index 000000000..b697de6c8
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/item/peat_bog.json
@@ -0,0 +1,3 @@
+{
+ "parent": "forestry:block/peat_bog"
+}
diff --git a/src/main/resources/assets/forestry/models/item/plantation.json b/src/main/resources/assets/forestry/models/item/plantation.json
new file mode 100644
index 000000000..40309ffdf
--- /dev/null
+++ b/src/main/resources/assets/forestry/models/item/plantation.json
@@ -0,0 +1,3 @@
+{
+ "parent": "forestry:block/plantation"
+}
diff --git a/src/main/resources/assets/forestry/textures/blocks/arboretum.png b/src/main/resources/assets/forestry/textures/blocks/arboretum.png
new file mode 100644
index 000000000..10fbf0364
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/arboretum.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/arboretum_particle.png b/src/main/resources/assets/forestry/textures/blocks/arboretum_particle.png
new file mode 100644
index 000000000..571cf354d
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/arboretum_particle.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/farm_crops.png b/src/main/resources/assets/forestry/textures/blocks/farm_crops.png
new file mode 100644
index 000000000..8825a487a
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/farm_crops.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/farm_crops_particle.png b/src/main/resources/assets/forestry/textures/blocks/farm_crops_particle.png
new file mode 100644
index 000000000..aed262599
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/farm_crops_particle.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/farm_gourd.png b/src/main/resources/assets/forestry/textures/blocks/farm_gourd.png
new file mode 100644
index 000000000..49fcf74c9
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/farm_gourd.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/farm_gourd_particle.png b/src/main/resources/assets/forestry/textures/blocks/farm_gourd_particle.png
new file mode 100644
index 000000000..9d1941586
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/farm_gourd_particle.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/farm_mushroom.png b/src/main/resources/assets/forestry/textures/blocks/farm_mushroom.png
new file mode 100644
index 000000000..435a43e5e
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/farm_mushroom.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/farm_mushroom_particle.png b/src/main/resources/assets/forestry/textures/blocks/farm_mushroom_particle.png
new file mode 100644
index 000000000..9c651a543
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/farm_mushroom_particle.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/farm_nether.png b/src/main/resources/assets/forestry/textures/blocks/farm_nether.png
new file mode 100644
index 000000000..e6efda824
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/farm_nether.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/farm_nether_particle.png b/src/main/resources/assets/forestry/textures/blocks/farm_nether_particle.png
new file mode 100644
index 000000000..4c91f68b1
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/farm_nether_particle.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/peat_bog.png b/src/main/resources/assets/forestry/textures/blocks/peat_bog.png
new file mode 100644
index 000000000..700845a12
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/peat_bog.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/peat_bog_particle.png b/src/main/resources/assets/forestry/textures/blocks/peat_bog_particle.png
new file mode 100644
index 000000000..416d80ed6
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/peat_bog_particle.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/plantation.png b/src/main/resources/assets/forestry/textures/blocks/plantation.png
new file mode 100644
index 000000000..0325070fb
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/plantation.png differ
diff --git a/src/main/resources/assets/forestry/textures/blocks/plantation_particle.png b/src/main/resources/assets/forestry/textures/blocks/plantation_particle.png
new file mode 100644
index 000000000..3ae105a84
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/blocks/plantation_particle.png differ
diff --git a/src/main/resources/assets/forestry/textures/gui/arboretum.png b/src/main/resources/assets/forestry/textures/gui/arboretum.png
new file mode 100644
index 000000000..8b8117d14
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/gui/arboretum.png differ
diff --git a/src/main/resources/assets/forestry/textures/gui/buttons.png b/src/main/resources/assets/forestry/textures/gui/buttons.png
index dc5ee1fee..c2d3824e4 100755
Binary files a/src/main/resources/assets/forestry/textures/gui/buttons.png and b/src/main/resources/assets/forestry/textures/gui/buttons.png differ
diff --git a/src/main/resources/assets/forestry/textures/gui/planter.png b/src/main/resources/assets/forestry/textures/gui/planter.png
new file mode 100644
index 000000000..2b71e1ff1
Binary files /dev/null and b/src/main/resources/assets/forestry/textures/gui/planter.png differ