use of forestry.api.farming.ICrop in project PneumaticCraft by MineMaarten.
the class FarmablePlastic method getCropAt.
@Override
public ICrop getCropAt(World world, int x, int y, int z) {
if (!isSaplingAt(world, x, y, z))
return null;
int meta = world.getBlockMetadata(x, y, z);
return meta == 6 || meta == 13 ? new ICrop() {
private World world;
private int x, y, z;
public ICrop setCoord(World world, int x, int y, int z) {
this.world = world;
this.x = x;
this.y = y;
this.z = z;
return this;
}
@Override
public Collection<ItemStack> harvest() {
List<ItemStack> drops = world.getBlock(x, y, z).getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
for (ItemStack drop : drops) {
drop.setItemDamage(drop.getItemDamage() % 16);
}
world.func_147480_a(x, y, z, false);
world.setBlockToAir(x, y, z);
return drops;
}
}.setCoord(world, x, y, z) : null;
}