mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 14:53:05 +00:00
Reintroduce the old-style farm
This commit is contained in:
1 parent
1fc56c3b20
commit
cc50a05f43
135 files changed
+2483
-516
No files matched your search
@@ -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<IFarmable> seeds;
|
||||
|
||||
public FarmLogicCrops() {
|
||||
this(FarmRegistry.getInstance().getFarmables("farmCrops"));
|
||||
}
|
||||
|
||||
protected FarmLogicCrops(Iterable<IFarmable> 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";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user