mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-10-26 14:24:40 +00:00
#1371 Farming Stations don't harvest third/top block of sugar cane or cactus
This commit is contained in:
1 parent
85533e2e9a
commit
52302bbac3
2 files changed
+25
-2
No files matched your search
@@ -43,6 +43,7 @@ Bugs
|
||||
- #1357 Power Conduits replaced by growing tree's
|
||||
- #1361 Enlightened Fused Quartz is not blast resistant
|
||||
- #1366 Powered Spawner doesn't remain active when chunk loaded
|
||||
- #1371 Farming Stations don't harvest third/top block of sugar cane or cactus
|
||||
- #1373 Fluid Tank accepts fluid regardless of configuration
|
||||
- #1383 Travel Anchor crash
|
||||
- #1384 Disabling one side of machines disables the opposite side as well.
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package crazypants.enderio.machine.farm.farmers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -12,6 +15,7 @@ import crazypants.util.BlockCoord;
|
||||
|
||||
public class StemFarmer extends CustomSeedFarmer {
|
||||
|
||||
private static final HeightCompatator COMP = new HeightCompatator();
|
||||
|
||||
public StemFarmer(Block plantedBlock, ItemStack seeds) {
|
||||
super(plantedBlock, seeds);
|
||||
@@ -39,7 +43,7 @@ public class StemFarmer extends CustomSeedFarmer {
|
||||
|
||||
@Override
|
||||
public IHarvestResult harvestBlock(TileFarmStation farm, BlockCoord bc, Block block, int meta) {
|
||||
|
||||
|
||||
|
||||
HarvestResult res = new HarvestResult();
|
||||
BlockCoord harvestCoord = bc;
|
||||
@@ -57,12 +61,17 @@ public class StemFarmer extends CustomSeedFarmer {
|
||||
}
|
||||
farm.damageHoe(1, harvestCoord);
|
||||
farm.actionPerformed(false);
|
||||
farm.getWorldObj().setBlockToAir(harvestCoord.x, harvestCoord.y, harvestCoord.z);
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
} while(!done);
|
||||
|
||||
List<BlockCoord> toClear = new ArrayList<BlockCoord>(res.getHarvestedBlocks());
|
||||
Collections.sort(toClear, COMP);
|
||||
for (BlockCoord coord : toClear) {
|
||||
farm.getWorldObj().setBlockToAir(coord.x, coord.y, coord.z);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -75,4 +84,17 @@ public class StemFarmer extends CustomSeedFarmer {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class HeightCompatator implements Comparator<BlockCoord> {
|
||||
|
||||
@Override
|
||||
public int compare(BlockCoord o1, BlockCoord o2) {
|
||||
return -compare(o1.y, o2.y);
|
||||
}
|
||||
|
||||
public static int compare(int x, int y) {
|
||||
return (x < y) ? -1 : ((x == y) ? 0 : 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user