mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 04:22:32 +00:00
Update for 1.11. Missing assets, unstable.
This commit is contained in:
1 parent
30d7365518
commit
9611ae08ae
1145 files changed
+15561
-18107
No files matched your search
@@ -10,21 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
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.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.farming.FarmHelper;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class FarmLogicHomogeneous extends FarmLogic {
|
||||
|
||||
@@ -32,15 +31,15 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
|
||||
private final IBlockState soilState;
|
||||
protected final List<IFarmable> farmables;
|
||||
|
||||
List<ItemStack> produce = new ArrayList<>();
|
||||
protected NonNullList<ItemStack> produce = NonNullList.create();
|
||||
|
||||
protected FarmLogicHomogeneous(ItemStack resource, @Nonnull IBlockState soilState, Collection<IFarmable> farmables) {
|
||||
protected FarmLogicHomogeneous(ItemStack resource, IBlockState soilState, Collection<IFarmable> farmables) {
|
||||
this.resource = resource;
|
||||
this.soilState = soilState;
|
||||
this.farmables = new ArrayList<>(farmables);
|
||||
}
|
||||
|
||||
protected boolean isAcceptedSoil(@Nonnull IBlockState blockState) {
|
||||
protected boolean isAcceptedSoil(IBlockState blockState) {
|
||||
return soilState.getBlock() == blockState.getBlock();
|
||||
}
|
||||
|
||||
@@ -71,16 +70,13 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
|
||||
|
||||
@Override
|
||||
public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
|
||||
|
||||
if (maintainSoil(world, farmHousing, pos, direction, extent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return maintainGermlings(world, farmHousing, pos.up(), direction, extent);
|
||||
return maintainSoil(world, farmHousing, pos, direction, extent) ||
|
||||
maintainGermlings(world, farmHousing, pos.up(), direction, extent);
|
||||
}
|
||||
|
||||
private boolean maintainSoil(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
|
||||
ItemStack[] resources = new ItemStack[]{resource};
|
||||
NonNullList<ItemStack> resources = NonNullList.create();
|
||||
resources.add(resource);
|
||||
if (!farmHousing.getFarmInventory().hasResources(resources)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user