mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 11:59:17 +00:00
#857 Farming station issues harvesting Cotton from Natura
This commit is contained in:
1 parent
7257976ff4
commit
2e438bc4e8
2 files changed
+13
-2
No files matched your search
@@ -12,6 +12,8 @@ import crazypants.enderio.Log;
|
||||
|
||||
public final class FarmersRegistry {
|
||||
|
||||
public static final PlantableFarmer DEFAULT_FARMER = new PlantableFarmer();
|
||||
|
||||
public static void addFarmers() {
|
||||
|
||||
addExtraUtilities();
|
||||
@@ -30,7 +32,7 @@ public final class FarmersRegistry {
|
||||
//'BlockNetherWart' is not an IGrowable
|
||||
FarmersCommune.instance.joinCommune(new NetherWartFarmer());
|
||||
//Handles all 'vanilla' style crops
|
||||
FarmersCommune.instance.joinCommune(new PlantableFarmer());
|
||||
FarmersCommune.instance.joinCommune(DEFAULT_FARMER);
|
||||
}
|
||||
|
||||
public static void addPickable(String mod, String blockName, String itemName) {
|
||||
@@ -100,6 +102,7 @@ public final class FarmersRegistry {
|
||||
|
||||
Block cropBlock = GameRegistry.findBlock(mod, blockName);
|
||||
if(cropBlock != null) {
|
||||
DEFAULT_FARMER.addHarvestExlude(cropBlock);
|
||||
Item seedItem = GameRegistry.findItem(mod, "barley.seed");
|
||||
if(seedItem != null) {
|
||||
//barley
|
||||
|
||||
@@ -8,7 +8,9 @@ import static net.minecraftforge.common.EnumPlantType.Plains;
|
||||
import static net.minecraftforge.common.EnumPlantType.Water;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStem;
|
||||
@@ -25,6 +27,12 @@ import crazypants.util.BlockCoord;
|
||||
|
||||
public class PlantableFarmer implements IFarmerJoe {
|
||||
|
||||
private Set<Block> harvestExcludes = new HashSet<Block>();
|
||||
|
||||
public void addHarvestExlude(Block block) {
|
||||
harvestExcludes.add(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlant(ItemStack stack) {
|
||||
if(stack == null) {
|
||||
@@ -121,7 +129,7 @@ public class PlantableFarmer implements IFarmerJoe {
|
||||
|
||||
@Override
|
||||
public boolean canHarvest(TileFarmStation farm, BlockCoord bc, Block block, int meta) {
|
||||
if(block instanceof IGrowable && !(block instanceof BlockStem)) {
|
||||
if(!harvestExcludes.contains(block) && block instanceof IGrowable && !(block instanceof BlockStem)) {
|
||||
return !((IGrowable)block).func_149851_a(farm.getWorldObj(), bc.x, bc.y, bc.z, true);
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user