mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 03:39:09 +00:00
Fix farms only planting brown mushrooms
This commit is contained in:
1 parent
723d07ab7c
commit
84b1fa8c07
4 files changed
+16
-10
No files matched your search
@@ -12,6 +12,7 @@ package forestry.farming.logic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -59,7 +60,7 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
|
||||
}
|
||||
|
||||
Block block = BlockSoil.getBlockFromItem(soil.getItem());
|
||||
if (block == null || !(block instanceof BlockSoil)) {
|
||||
if (!(block instanceof BlockSoil)) {
|
||||
return false;
|
||||
}
|
||||
BlockSoil blockSoil = (BlockSoil) block;
|
||||
@@ -246,8 +247,8 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
|
||||
}
|
||||
|
||||
private boolean plantSapling(Vect position) {
|
||||
|
||||
World world = getWorld();
|
||||
Collections.shuffle(germlings);
|
||||
for (IFarmable candidate : germlings) {
|
||||
if (housing.plantGermling(candidate, world, position.x, position.y, position.z)) {
|
||||
return true;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.farming.logic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -29,7 +30,7 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
|
||||
|
||||
private final ItemStack resource;
|
||||
private final ItemStack soilBlock;
|
||||
protected final Iterable<IFarmable> germlings;
|
||||
protected final List<IFarmable> germlings;
|
||||
|
||||
ArrayList<ItemStack> produce = new ArrayList<>();
|
||||
|
||||
@@ -37,7 +38,10 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
|
||||
super(housing);
|
||||
this.resource = resource;
|
||||
this.soilBlock = soilBlock;
|
||||
this.germlings = germlings;
|
||||
this.germlings = new ArrayList<>();
|
||||
for (IFarmable germling : germlings) {
|
||||
this.germlings.add(germling);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isAcceptedSoil(ItemStack itemStack) {
|
||||
@@ -75,11 +79,7 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (maintainGermlings(x, y + 1, z, direction, extent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return maintainGermlings(x, y + 1, z, direction, extent);
|
||||
}
|
||||
|
||||
private boolean maintainSoil(int x, int yGround, int z, FarmDirection direction, int extent) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import forestry.core.utils.vect.Vect;
|
||||
|
||||
public class FarmableGenericSapling implements IFarmable {
|
||||
|
||||
private final Block sapling;
|
||||
protected final Block sapling;
|
||||
private final int saplingMeta;
|
||||
private final ItemStack[] windfall;
|
||||
|
||||
|
||||
@@ -39,6 +39,11 @@ public class FarmableVanillaMushroom extends FarmableGenericSapling {
|
||||
return new CropBlock(world, block, world.getBlockMetadata(x, y, z), new Vect(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGermling(ItemStack itemstack) {
|
||||
return ItemStackUtil.equals(sapling, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||
int meta = 0;
|
||||
|
||||
Reference in new issue
Block a user